优化日程界面

This commit is contained in:
2026-07-15 18:14:17 +08:00
parent 11e0763766
commit bca5170e22
19 changed files with 2805 additions and 1070 deletions
+236 -383
View File
@@ -1,451 +1,304 @@
<template>
<view class="page">
<view class="page-header">
<text class="page-title">功能中心</text>
<text class="page-desc">探索更多精彩功能</text>
<view class="search-wrap">
<view class="search-bar">
<FaIcon name="magnifying-glass" color="#909399" :size="16" />
<input
class="search-input"
v-model="keyword"
type="text"
placeholder="搜索功能名称"
placeholder-class="search-placeholder"
confirm-type="search"
/>
<view v-if="keyword" class="search-clear" @tap="keyword = ''">
<FaIcon name="circle-xmark" color="#c0c4cc" :size="16" />
</view>
</view>
</view>
<view class="main-scroll">
<view class="feature-banner" @tap="onBannerTap">
<view class="banner-content">
<text class="banner-title">新功能上线</text>
<text class="banner-desc">AI 智能助手效率翻倍</text>
<view class="body">
<view class="sidebar">
<view
v-for="(cat, index) in categories"
:key="cat.id"
class="category-item"
:class="{ active: activeIndex === index }"
@tap="selectCategory(index)"
>
<text class="category-text">{{ cat.title }}</text>
</view>
<view class="banner-btn">立即体验</view>
</view>
<view class="category" v-for="cat in categories" :key="cat.title">
<text class="category-title">{{ cat.title }}</text>
<view class="feature-grid">
<view
class="feature-card"
v-for="item in cat.items"
:key="item.name"
@tap="onFeatureTap(item)"
>
<view class="feature-icon">
<FaIcon :name="item.icon" color="#3c9cff" :size="22" />
</view>
<text class="feature-name">{{ item.name }}</text>
<text class="feature-desc">{{ item.desc }}</text>
</view>
<view class="content">
<view v-if="displayItems.length === 0" class="empty">
<FaIcon name="magnifying-glass" color="#c0c4cc" :size="32" />
<text class="empty-text">未找到相关功能</text>
</view>
<view
v-for="item in displayItems"
:key="item.id"
class="item-card"
:class="{ active: activeItemId === item.id }"
@tap="onItemTap(item)"
>
<text class="item-name">{{ item.name }}</text>
</view>
</view>
<view class="bottom-space" />
</view>
<AppTabbar current="features" />
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { isLoggedIn } from '@/utils/auth.js'
import AppTabbar from '@/components/AppTabbar.vue'
const keyword = ref('')
const activeIndex = ref(0)
const activeItemId = ref('')
const routeMap = {
notepad: '/pages/tools/notepad/index',
schedule: '/pages/tools/schedule/index'
}
const categories = ref([
{
id: 'handy',
title: '便捷工具',
items: [
{ id: 'notepad', name: '记事本', route: routeMap.notepad },
{ id: 'schedule', name: '日程提醒', route: routeMap.schedule }
]
},
{
id: 'tools',
title: '常用工具',
items: [
{ name: '扫一扫', desc: '快速识别', icon: 'qrcode' },
{ name: '收付款', desc: '便捷支付', icon: 'coins' },
{ name: '卡包', desc: '优惠券', icon: 'ticket' },
{ name: '出行', desc: '交通服务', icon: 'car' }
{ id: 't1', name: '扫一扫' },
{ id: 't2', name: '收付款' },
{ id: 't3', name: '卡包管理' },
{ id: 't4', name: '出行服务' },
{ id: 't5', name: '二维码生成' },
{ id: 't6', name: '发票助手' }
]
},
{
id: 'life',
title: '生活服务',
items: [
{ name: '外卖', desc: '美食到家', icon: 'bag-shopping' },
{ name: '电影', desc: '在线购票', icon: 'film' },
{ name: '酒店', desc: '预订住宿', icon: 'hotel' },
{ name: '更多', desc: '发现更多', icon: 'ellipsis' }
{ id: 'l1', name: '外卖订餐' },
{ id: 'l2', name: '电影购票' },
{ id: 'l3', name: '酒店预订' },
{ id: 'l4', name: '快递查询' },
{ id: 'l5', name: '家政预约' },
{ id: 'l6', name: '更多服务' }
]
},
{
id: 'office',
title: '办公效率',
items: [
{ name: '文档', desc: '在线协作', icon: 'file-lines' },
{ name: '日历', desc: '日程管理', icon: 'calendar-days' },
{ name: '云盘', desc: '文件存储', icon: 'folder' },
{ name: '会议', desc: '视频会议', icon: 'video' }
{ id: 'o1', name: '文档协作' },
{ id: 'o2', name: '日程管理' },
{ id: 'o3', name: '云盘存储' },
{ id: 'o4', name: '视频会议' },
{ id: 'o5', name: '任务看板' },
{ id: 'o6', name: '审批流程' }
]
},
{
id: 'data',
title: '数据报表',
items: [
{ id: 'd1', name: '销售统计' },
{ id: 'd2', name: '用户分析' },
{ id: 'd3', name: '访问趋势' },
{ id: 'd4', name: '转化报表' },
{ id: 'd5', name: '导出数据' }
]
},
{
id: 'system',
title: '系统设置',
items: [
{ id: 's1', name: '账号管理' },
{ id: 's2', name: '权限配置' },
{ id: 's3', name: '消息通知' },
{ id: 's4', name: '安全中心' },
{ id: 's5', name: '关于系统' }
]
}
])
const currentCategory = computed(() => categories.value[activeIndex.value])
onMounted(() => {
if (!isLoggedIn()) {
uni.reLaunch({ url: '/pages/login/login' })
}
const displayItems = computed(() => {
const items = currentCategory.value?.items || []
const q = keyword.value.trim().toLowerCase()
if (!q) return items
return items.filter(item => item.name.toLowerCase().includes(q))
})
onMounted(() => {
if (!isLoggedIn()) {
uni.reLaunch({ url: '/pages/login/login' })
}
})
function onBannerTap() {
uni.showToast({ title: 'AI 智能助手', icon: 'none' })
function selectCategory(index) {
activeIndex.value = index
activeItemId.value = ''
}
function onFeatureTap(item) {
function onItemTap(item) {
activeItemId.value = item.id
if (item.route) {
uni.navigateTo({ url: item.route })
return
}
uni.showToast({ title: item.name, icon: 'none' })
}
</script>
<style lang="scss" scoped>
@import '@/src/styles/page-common.scss';
.page {
height: 100vh;
background: #ffffff;
display: flex;
flex-direction: column;
overflow: hidden;
@include page-shell;
}
.page-header {
.search-wrap {
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 24rpx) 40rpx 24rpx;
padding: calc(var(--status-bar-height, 44px) + 16rpx) 24rpx 20rpx;
background: $color-card;
}
.page-title {
display: block;
font-size: 40rpx;
font-weight: 600;
color: $u-primary;
.search-bar {
display: flex;
align-items: center;
gap: 12rpx;
height: 72rpx;
padding: 0 24rpx;
background: $color-bg-page;
border-radius: $radius-full;
}
.page-desc {
display: block;
font-size: 26rpx;
color: $u-primary-disabled;
margin-top: 6rpx;
}
.main-scroll {
.search-input {
flex: 1;
min-height: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding: 0 40rpx;
}
.feature-banner {
background: #ffffff;
border: 2rpx solid #e8f0f8;
border-radius: 16rpx;
padding: 32rpx 28rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 48rpx;
&:active {
border-color: $u-primary-disabled;
}
}
.banner-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $u-primary;
}
.banner-desc {
display: block;
font-size: 24rpx;
color: $u-primary-disabled;
margin-top: 8rpx;
}
.banner-btn {
padding: 14rpx 28rpx;
background: #ffffff;
border: 2rpx solid #e8f0f8;
border-radius: 16rpx;
font-size: 24rpx;
color: $u-primary;
font-weight: 500;
}
.category {
margin-bottom: 48rpx;
}
.category-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $u-primary;
margin-bottom: 24rpx;
}
.feature-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20rpx;
}
.feature-card {
background: #ffffff;
border: 2rpx solid #e8f0f8;
border-radius: 16rpx;
padding: 28rpx;
&:active {
border-color: $u-primary-disabled;
}
}
.feature-icon {
width: 80rpx;
height: 80rpx;
border-radius: 20rpx;
background: #ffffff;
border: 2rpx solid #e8f0f8;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
.feature-name {
display: block;
height: 72rpx;
font-size: 28rpx;
font-weight: 600;
color: $u-primary;
color: $color-text;
}
.feature-desc {
display: block;
font-size: 22rpx;
color: $u-primary-disabled;
margin-top: 4rpx;
.search-placeholder {
color: $color-text-muted;
font-size: 28rpx;
}
.bottom-space {
height: 40rpx;
.search-clear {
display: flex;
align-items: center;
padding: 8rpx;
}
.body {
flex: 1;
display: flex;
min-height: 0;
overflow: hidden;
background: $color-card;
}
.sidebar {
width: 200rpx;
flex-shrink: 0;
background: $color-bg-page;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.category-item {
position: relative;
padding: 32rpx 16rpx;
text-align: center;
&.active {
background: $color-card;
.category-text {
color: $color-primary;
font-weight: 500;
}
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 36rpx;
background: $color-primary;
border-radius: 0 4rpx 4rpx 0;
}
}
}
.category-text {
font-size: 26rpx;
color: $color-text-secondary;
line-height: 1.4;
}
.content {
flex: 1;
min-width: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding: 20rpx 24rpx;
background: $color-card;
}
.item-card {
padding: 28rpx 24rpx;
margin-bottom: 16rpx;
background: $color-bg-page;
border-radius: $radius-md;
&.active {
background: $color-primary-bg;
.item-name {
color: $color-primary;
}
}
&:active {
opacity: 0.85;
}
}
.item-name {
font-size: 28rpx;
color: $color-text;
line-height: 1.4;
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 120rpx 0;
gap: 20rpx;
}
.empty-text {
font-size: 26rpx;
color: $color-text-muted;
}
</style>