feat:首页完成

This commit is contained in:
李伊帆
2026-09-11 08:02:01 +08:00
parent 5b31eac508
commit 173cd6b975
68 changed files with 3181 additions and 112 deletions

View File

@@ -1,16 +1,28 @@
<script setup lang="ts">
import AppTabBar from '@/components/AppTabBar.vue'
import { useGreeting } from '@/hooks/use-greeting'
import type { ProjectItem, QuickEntryItem, ServiceItem } from '@/types/home'
import { useQuickEntries } from '@/hooks/use-quick-entries'
import type { ProjectItem, ServiceItem } from '@/types/home'
import headerBg from '@/static/icons/1.png'
import softwareIllus from '@/static/icons/software.png'
import hardwareIllus from '@/static/icons/hardware.png'
import iotIllus from '@/static/icons/iot.png'
import productionIllus from '@/static/icons/production.png'
import HomeFloatingActions from './components/HomeFloatingActions.vue'
import ProjectCard from './components/ProjectCard.vue'
import QuickEntryEditor from './components/QuickEntryEditor.vue'
import ServiceCard from './components/ServiceCard.vue'
const greeting = useGreeting()
const {
pinnedEntries,
otherEntries,
editorVisible,
openEditor,
closeEditor,
removeFromPinned,
addToPinned,
} = useQuickEntries()
const services: ServiceItem[] = [
{
@@ -19,6 +31,7 @@ const services: ServiceItem[] = [
desc: 'Web/小程序/APP/二次开发/桌面工具等',
theme: 'blue',
illus: softwareIllus,
detailId: 'software',
},
{
id: '2',
@@ -43,14 +56,6 @@ const services: ServiceItem[] = [
},
]
const quickEntries: QuickEntryItem[] = [
{ id: '1', label: '项目中心', icon: '/static/icons/quick-project.png', bgColor: '#E8F0FF' },
{ id: '2', label: '快捷提报', icon: '/static/icons/quick-report.png', bgColor: '#E8FAF4' },
{ id: '3', label: '在线客服', icon: '/static/icons/quick-service.png', bgColor: '#F3E8FF' },
{ id: '4', label: '合同管理', icon: '/static/icons/quick-contract.png', bgColor: '#FEE2E2' },
{ id: '5', label: '财务管理', icon: '/static/icons/quick-finance.png', bgColor: '#E0F2FE' },
]
const projects: ProjectItem[] = [
{
id: '1',
@@ -70,7 +75,7 @@ const projects: ProjectItem[] = [
progress: 65,
status: '进行中',
updateTime: '2026-8-13 11:04:12',
tagTheme: 'peach',
tagTheme: 'orange',
},
]
</script>
@@ -146,13 +151,16 @@ const projects: ProjectItem[] = [
<text class="home__section-title">
快捷入口
</text>
<text class="home__section-action">
<text
class="home__section-action"
@tap="openEditor"
>
编辑
</text>
</view>
<view class="home__quick-row">
<view
v-for="entry in quickEntries"
v-for="entry in pinnedEntries"
:key="entry.id"
class="home__quick-item"
>
@@ -168,7 +176,7 @@ const projects: ProjectItem[] = [
</view>
</view>
<view class="home__section home__section--last">
<view class="home__sectionss home__section--last">
<view class="home__section-header">
<text class="home__section-title">
在办项目
@@ -180,17 +188,27 @@ const projects: ProjectItem[] = [
<view class="home__stats-row">
<view class="home__stat-card home__stat-card--blue">
<text class="home__stat-value">
3 个项目
</text>
<view class="home__stat-value">
<text class="home__stat-num">
3
</text>
<text class="home__stat-unit">
个项目
</text>
</view>
<text class="home__stat-label">
进行中
</text>
</view>
<view class="home__stat-card home__stat-card--orange">
<text class="home__stat-value">
3 项待办
</text>
<view class="home__stat-value">
<text class="home__stat-num">
3
</text>
<text class="home__stat-unit">
项待办
</text>
</view>
<text class="home__stat-label">
待您处理
</text>
@@ -211,6 +229,17 @@ const projects: ProjectItem[] = [
</scroll-view>
<AppTabBar active="home" />
<HomeFloatingActions />
<QuickEntryEditor
:visible="editorVisible"
:pinned-entries="pinnedEntries"
:other-entries="otherEntries"
@close="closeEditor"
@remove="removeFromPinned"
@add="addToPinned"
/>
</view>
</template>
@@ -361,6 +390,14 @@ const projects: ProjectItem[] = [
padding-top: 20rpx
}
.home__sectionss {
margin-bottom: 20rpx;
width: 711.83rpx;
background: $color-bg-page;
border-radius: 20rpx;
padding-top: 20rpx
}
.home__section--last {
margin-bottom: 0;
}
@@ -422,34 +459,52 @@ const projects: ProjectItem[] = [
.home__stats-row {
display: flex;
gap: 20rpx;
padding: 0 20rpx;
}
.home__stat-card {
display: flex;
flex: 1;
flex-direction: column;
padding: 28rpx 24rpx;
align-items: center;
justify-content: center;
padding: 32rpx 24rpx;
border-radius: 16rpx;
text-align: center;
&--blue {
background: $color-primary-light;
background: linear-gradient(180deg, #D3E1FC 0%, #FFFFFF 100%);
}
&--orange {
background: $color-stat-orange-bg;
background: linear-gradient(180deg, #FFECE1 0%, #FFFFFF 100%);
}
}
.home__stat-value {
font-size: 32rpx;
display: flex;
align-items: baseline;
justify-content: center;
}
.home__stat-num {
font-size: 56rpx;
font-weight: 700;
line-height: 1;
color: $color-text-primary;
}
.home__stat-unit {
margin-left: 4rpx;
font-size: 28rpx;
font-weight: 500;
color: $color-text-primary;
}
.home__stat-label {
margin-top: 8rpx;
margin-top: 12rpx;
font-size: 24rpx;
color: $color-text-secondary;
color: #333333;
}
.home__recent-title {