hookehuyr

docs: 消息详情页查看后刷新未读消息数

- 消息详情页获取详情后调用 userStore.fetchUserInfo(true)
- 刷新用户信息以更新 unreadMsgCount
- 从而使 TabBar 红点状态同步更新

修改文件:
- src/pages/message-detail/index.vue: 添加 useUserStore 导入和刷新调用
- src/api/news.js: 修复注释格式(全角分号)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
...@@ -7,7 +7,7 @@ const Api = { ...@@ -7,7 +7,7 @@ const Api = {
7 7
8 /** 8 /**
9 * @description 消息详情 9 * @description 消息详情
10 - * @remark 10 + * @remark
11 * @param {Object} params 请求参数 11 * @param {Object} params 请求参数
12 * @param {string} params.i 消息ID 12 * @param {string} params.i 消息ID
13 * @returns {Promise<{ 13 * @returns {Promise<{
...@@ -26,10 +26,10 @@ export const detailAPI = (params) => fn(fetch.get(Api.Detail, params)); ...@@ -26,10 +26,10 @@ export const detailAPI = (params) => fn(fetch.get(Api.Detail, params));
26 26
27 /** 27 /**
28 * @description 我的消息列表 28 * @description 我的消息列表
29 - * @remark 29 + * @remark
30 * @param {Object} params 请求参数 30 * @param {Object} params 请求参数
31 - * @param {string} params.page 31 + * @param {string} params.page
32 - * @param {string} params.limit 32 + * @param {string} params.limit
33 * @returns {Promise<{ 33 * @returns {Promise<{
34 * code: number; // 状态码 34 * code: number; // 状态码
35 * msg: string; // 消息 35 * msg: string; // 消息
...@@ -41,7 +41,7 @@ export const detailAPI = (params) => fn(fetch.get(Api.Detail, params)); ...@@ -41,7 +41,7 @@ export const detailAPI = (params) => fn(fetch.get(Api.Detail, params));
41 status: string; // send=以发送未读取,read=已读取 41 status: string; // send=以发送未读取,read=已读取
42 pk_id: integer; // 计划书订单ID 42 pk_id: integer; // 计划书订单ID
43 }>; 43 }>;
44 - total: integer; // 44 + total: integer; //
45 * }; 45 * };
46 * }>} 46 * }>}
47 */ 47 */
......
...@@ -51,6 +51,7 @@ import { ref, computed } from 'vue' ...@@ -51,6 +51,7 @@ import { ref, computed } from 'vue'
51 import { useLoad } from '@tarojs/taro' 51 import { useLoad } from '@tarojs/taro'
52 import NavHeader from '@/components/navigation/NavHeader.vue' 52 import NavHeader from '@/components/navigation/NavHeader.vue'
53 import { detailAPI } from '@/api/news' 53 import { detailAPI } from '@/api/news'
54 +import { useUserStore } from '@/stores/user'
54 55
55 const detail = ref(null) 56 const detail = ref(null)
56 const loading = ref(true) 57 const loading = ref(true)
...@@ -86,6 +87,10 @@ const fetchDetail = async (id) => { ...@@ -86,6 +87,10 @@ const fetchDetail = async (id) => {
86 ...res.data, 87 ...res.data,
87 title: res.data.title || mockTitle 88 title: res.data.title || mockTitle
88 } 89 }
90 +
91 + // 查看消息后刷新用户信息,更新未读消息数
92 + const userStore = useUserStore()
93 + await userStore.fetchUserInfo(true)
89 } 94 }
90 } catch (err) { 95 } catch (err) {
91 console.error('获取消息详情失败:', err) 96 console.error('获取消息详情失败:', err)
......