diff --git a/pages/consultation/index.vue b/pages/consultation/index.vue index f9592f8..3b0247e 100644 --- a/pages/consultation/index.vue +++ b/pages/consultation/index.vue @@ -240,6 +240,10 @@ export default { this.chatList = this.normalizeDialogueList(list); // 同步到全局会话列表,便于后续实时合并 this.$store.commit("set_UserMsgList", this.chatList); + this.$store.commit("upsert_DialogueTypeMap", { + list: this.chatList, + type: 1, + }); this.totalCount = res?.data?.item2 || list.length; } catch (error) { console.error("[在线咨询] 获取会话列表失败", error); diff --git a/store/index.js b/store/index.js index 58cf0d5..60ed024 100644 --- a/store/index.js +++ b/store/index.js @@ -51,6 +51,8 @@ const store = new Vuex.Store({ vuex_msgUser: lifeData.vuex_msgUser ? lifeData.vuex_msgUser : {}, // 消息窗口滚动位置 vuex_msgScrollTop: 0, + // 记录会话ID与在线咨询类型的映射,区分在线咨询/人工转接 + vuex_dialogueTypeMap: {}, // 自定义tabbar数据 vuex_iPhone: lifeData.vuex_iPhone ? lifeData.vuex_iPhone : false, // tabbar相关配置 @@ -271,6 +273,21 @@ const store = new Vuex.Store({ saveLifeData("vuex_teacherInfo", state.vuex_teacherInfo); saveLifeData("vuex_user", state.vuex_user); }, + // 合并会话类型映射(在线咨询类型) + upsert_DialogueTypeMap(state, { list = [], type }) { + if (!type) return; + const next = { ...(state.vuex_dialogueTypeMap || {}) }; + list.forEach((item) => { + const id = + item?.dialogueManagementId || + item?.DialogueManagementId || + item?.dialogueId || + item?.friendId || + item?.id; + if (id) next[id] = type; + }); + state.vuex_dialogueTypeMap = next; + }, }, actions: { // 获取聊天列表(最近联系人)