From 2ca5f13b4686dd63153f8f679468ecac43963732 Mon Sep 17 00:00:00 2001 From: hajimi Date: Mon, 3 Aug 2026 02:57:00 +0800 Subject: [PATCH] feat: redesign user center page --- uniapp/src/pages/user/user.vue | 850 +++++++++++++++++---------------- 1 file changed, 448 insertions(+), 402 deletions(-) diff --git a/uniapp/src/pages/user/user.vue b/uniapp/src/pages/user/user.vue index 76131ee..de68e3f 100644 --- a/uniapp/src/pages/user/user.vue +++ b/uniapp/src/pages/user/user.vue @@ -1,115 +1,133 @@ @@ -132,7 +149,6 @@ import { getToken } from '@/utils/auth' import { getDecorate } from '@/api/shop' import request from '@/utils/request' import { useAppStore } from '@/stores/app' -import VipCard from '@/components/vip-card/vip-card.vue' const userStore = useUserStore() const appStore = useAppStore() @@ -154,6 +170,34 @@ const stats = reactive({ chat_unread_count: 0 }) +const contentMenus = [ + { key: 'posts', label: '我的帖子', icon: 'file-text', url: '/pages/my_posts/my_posts' }, + { key: 'comments', label: '我的评论', icon: 'chat', toast: '我的评论功能即将上线' }, + { key: 'collection', label: '我的收藏', icon: 'star', url: '/pages/collection/collection' }, + { key: 'notice', label: '消息通知', icon: 'bell', toast: '消息通知功能即将上线' }, + { key: 'assistant', label: '世博头条 AI 助手', icon: 'robot', url: '/pages/ai_assistant/ai_assistant' }, + { key: 'chat', label: '私聊消息', icon: 'chat' } +] + +const accountMenus = [ + { key: 'wallet', label: '钱包与订单', icon: 'wallet', url: '/packages/pages/user_wallet/user_wallet' }, + { key: 'invite', label: '邀请记录', icon: 'account', url: '/pages/distribution/distribution' }, + { key: 'lottery', label: 'AI 彩票分析', icon: 'file-text', url: '/pages/lottery_analysis/lottery_analysis' }, + { key: 'customer', label: '帮助与客服', icon: 'kefu-ermai', url: '/pages/customer_service/customer_service' }, + { key: 'about', label: '关于我们', icon: 'info-circle', toast: '关于我们页面即将上线' }, + { key: 'setting', label: '设置', icon: 'setting', url: '/pages/user_set/user_set' } +] + +const userLevelText = computed(() => { + const level = userInfo.value?.user_level || userInfo.value?.level || userInfo.value?.vip_info?.vip_level || 1 + return `Lv.${level}` +}) + +const userLevelName = computed(() => userInfo.value?.level_name || userInfo.value?.user_level_name || '资深球迷') +const memberStatusText = computed(() => userInfo.value?.vip_info?.is_vip + ? (userInfo.value.vip_info.vip_level_name || '尊享会员') + : '普通会员') + const serviceMenu = reactive({ enabled: false, style: 1, @@ -268,6 +312,14 @@ const openPointsBuy = () => { uni.navigateTo({ url: '/packages/pages/points_center/points_center' }) } +const goVip = () => { + if (!isLogin.value) { + uni.navigateTo({ url: '/pages/login/login' }) + return + } + uni.navigateTo({ url: '/pages/vip/vip' }) +} + const openChatList = () => { if (!isLogin.value) { uni.navigateTo({ url: '/pages/login/login' }) @@ -280,6 +332,24 @@ const goPage = (url: string) => { uni.navigateTo({ url }) } +const openProfile = () => { + goPage(isLogin.value ? '/pages/user_data/user_data' : '/pages/login/login') +} + +const handleMenuTap = (item: any) => { + if (item.key === 'chat') { + openChatList() + return + } + if (item.url) { + goPage(item.url) + return + } + if (item.toast) { + uni.showToast({ title: item.toast, icon: 'none' }) + } +} + const goLink = (link: any) => { if (!link?.path) return uni.navigateTo({ url: link.path }) @@ -289,386 +359,362 @@ const goLink = (link: any) => {