From 2b3b636c542fe5e78a7c7aae308c1e6d227667b0 Mon Sep 17 00:00:00 2001 From: richarjiang Date: Sat, 4 Apr 2026 10:46:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/app/src/components/ProfileMenu.vue | 69 ++++++- packages/app/src/components/StudioInfo.vue | 22 +-- packages/app/src/components/TrainingStats.vue | 84 -------- packages/app/src/components/UserCard.vue | 185 ++++++++++++++---- packages/app/src/pages/profile/index.vue | 74 ++++--- 5 files changed, 258 insertions(+), 176 deletions(-) delete mode 100644 packages/app/src/components/TrainingStats.vue diff --git a/packages/app/src/components/ProfileMenu.vue b/packages/app/src/components/ProfileMenu.vue index 9e596b0..8ac9960 100644 --- a/packages/app/src/components/ProfileMenu.vue +++ b/packages/app/src/components/ProfileMenu.vue @@ -11,7 +11,7 @@ :class="{ 'profile-menu__item--admin': item.isAdmin }" hover-class="profile-menu__item--hover" hover-stay-time="150" - @tap="navigate(item.path!)" + @tap="handleTap(item)" > {{ item.icon }} @@ -19,6 +19,7 @@ {{ item.title }} + {{ item.badge }} @@ -35,10 +36,20 @@ interface MenuItem { title?: string path?: string isAdmin?: boolean + badge?: string + action?: 'clear' | 'about' + requireAuth?: boolean } const props = defineProps<{ isAdmin: boolean + requireAuth?: boolean +}>() + +const emit = defineEmits<{ + (e: 'clear-cache'): void + (e: 'about'): void + (e: 'require-login'): void }>() const menuItems = computed(() => { @@ -49,6 +60,7 @@ const menuItems = computed(() => { icon: '💳', title: '我的会员卡', path: '/pages/profile/membership', + requireAuth: true, }, { key: 'bookings', @@ -56,6 +68,7 @@ const menuItems = computed(() => { icon: '📅', title: '我的预约', path: '/pages/profile/bookings', + requireAuth: true, }, { key: 'info', @@ -63,11 +76,30 @@ const menuItems = computed(() => { icon: '👤', title: '个人信息', path: '/pages/profile/info', + requireAuth: true, + }, + { + key: 'sep1', + type: 'separator', + }, + { + key: 'clear', + type: 'item', + icon: '🗑️', + title: '清除缓存', + action: 'clear', + }, + { + key: 'about', + type: 'item', + icon: 'ℹ️', + title: '关于我们', + action: 'about', }, ] if (props.isAdmin) { - items.push({ key: 'sep', type: 'separator' }) + items.push({ key: 'sep2', type: 'separator' }) items.push({ key: 'admin', type: 'item', @@ -75,14 +107,25 @@ const menuItems = computed(() => { title: '管理中心', path: '/pages/admin/index', isAdmin: true, + requireAuth: true, }) } return items }) -function navigate(path: string) { - uni.navigateTo({ url: path }) +function handleTap(item: MenuItem) { + if (item.requireAuth && !props.requireAuth) { + emit('require-login') + return + } + if (item.action === 'clear') { + emit('clear-cache') + } else if (item.action === 'about') { + emit('about') + } else if (item.path) { + uni.navigateTo({ url: item.path }) + } } @@ -90,7 +133,7 @@ function navigate(path: string) { .profile-menu { background: $bg-card; border-radius: $radius-lg; - margin: $spacing-md $spacing-lg 0; + margin: $spacing-lg $spacing-lg 0; overflow: hidden; &__separator { @@ -111,11 +154,11 @@ function navigate(path: string) { } &--hover { - background: #f9f9f9; + background: #f5f5f5; } &--admin { - // Admin row gets a subtle accent tint + background: rgba($accent-color, 0.04); } } @@ -123,7 +166,7 @@ function navigate(path: string) { width: 64rpx; height: 64rpx; border-radius: $radius-sm; - background: rgba($brand-color, 0.06); + background: rgba($brand-color, 0.08); display: flex; align-items: center; justify-content: center; @@ -144,7 +187,6 @@ function navigate(path: string) { flex: 1; font-size: 30rpx; color: $text-primary; - font-weight: 400; &--admin { color: $accent-color; @@ -152,6 +194,15 @@ function navigate(path: string) { } } + &__badge { + font-size: 22rpx; + color: #ffffff; + background: $error-color; + border-radius: 20rpx; + padding: 2rpx 12rpx; + margin-right: $spacing-sm; + } + &__arrow { font-size: 36rpx; color: $text-hint; diff --git a/packages/app/src/components/StudioInfo.vue b/packages/app/src/components/StudioInfo.vue index 086186e..7b1111f 100644 --- a/packages/app/src/components/StudioInfo.vue +++ b/packages/app/src/components/StudioInfo.vue @@ -1,21 +1,10 @@