diff --git a/uniapp/src/pages/private_chat/list.vue b/uniapp/src/pages/private_chat/list.vue index 8882b0fe..fa39023f 100644 --- a/uniapp/src/pages/private_chat/list.vue +++ b/uniapp/src/pages/private_chat/list.vue @@ -4,7 +4,7 @@ - 私聊消息 + 消息通知 diff --git a/uniapp/src/pages/user/user.vue b/uniapp/src/pages/user/user.vue index 1aeb0d34..227a0f53 100644 --- a/uniapp/src/pages/user/user.vue +++ b/uniapp/src/pages/user/user.vue @@ -82,7 +82,12 @@ - + + + + {{ stats.chat_unread_count > 99 ? '99+' : stats.chat_unread_count }} + + {{ item.label }} @@ -130,14 +135,15 @@ const stats = reactive({ follow_count: 0, fans_count: 0, collect_count: 0, - user_points: 0 + user_points: 0, + chat_unread_count: 0 }) const contentMenus = [ { key: 'posts', label: '我的帖子', icon: 'file-text', url: '/pages/my_posts/my_posts' }, { key: 'comments', label: '我的评论', icon: 'chat', url: '/pages/my_comments/my_comments' }, { key: 'collection', label: '我的收藏', icon: 'star', url: '/pages/collection/collection' }, - { key: 'notice', label: '消息通知', icon: 'bell', toast: '消息通知功能即将上线' } + { key: 'notice', label: '消息通知', icon: 'bell', url: '/pages/private_chat/list' } ] const accountMenus = [ @@ -207,6 +213,7 @@ const fetchStats = async () => { stats.fans_count = res.data.fans_count || 0 stats.collect_count = res.data.collect_count || 0 stats.user_points = res.data.user_points || 0 + stats.chat_unread_count = Number(res.data.chat_unread_count) || 0 } } catch (e) { // 静默处理 @@ -238,6 +245,10 @@ const openProfile = () => { } const handleMenuTap = (item: any) => { + if (item.key === 'notice' && !isLogin.value) { + goPage('/pages/login/login') + return + } if (item.url) { goPage(item.url) return @@ -551,12 +562,35 @@ const handleMenuTap = (item: any) => { } &__icon { + position: relative; width: 36rpx; display: flex; justify-content: center; flex-shrink: 0; } + &__badge { + position: absolute; + top: -8rpx; + right: -18rpx; + min-width: 26rpx; + height: 26rpx; + padding: 0 6rpx; + display: flex; + align-items: center; + justify-content: center; + border: 2rpx solid #fff; + border-radius: 16rpx; + background: #ef4444; + box-sizing: border-box; + + text { + color: #fff; + font-size: 16rpx; + line-height: 1; + } + } + &__label { flex: 1; min-width: 0;