diff --git a/Cunkebao/src/store/module/ckchat/ckchat.ts b/Cunkebao/src/store/module/ckchat/ckchat.ts index 686ee2f9b..d0a16103b 100644 --- a/Cunkebao/src/store/module/ckchat/ckchat.ts +++ b/Cunkebao/src/store/module/ckchat/ckchat.ts @@ -9,7 +9,6 @@ import { } from "@/pages/pc/ckbox/data"; import { kfUserService, weChatGroupService, contractService } from "@/utils/db"; import { createContractList } from "@/store/module/ckchat/api"; -import { deepCopy } from "@/utils/common"; export const useCkChatStore = createPersistStore( set => ({ @@ -363,6 +362,7 @@ export const useCkChatStore = createPersistStore( })(), // 添加聊天会话 addChatSession: (session: ContractData | weChatGroup) => { + session.unreadCount = 0; set(state => { // 检查是否已存在相同id的会话 const exists = state.chatSessions.some(item => item.id === session.id); diff --git a/Cunkebao/src/store/module/weChat/weChat.ts b/Cunkebao/src/store/module/weChat/weChat.ts index 182fa937c..30d65ead1 100644 --- a/Cunkebao/src/store/module/weChat/weChat.ts +++ b/Cunkebao/src/store/module/weChat/weChat.ts @@ -24,7 +24,6 @@ export const useWeChatStore = create()( // 切换联系人时清空当前消息,等待重新加载 set({ currentMessages: [] }); clearUnreadCount([contract.id]).then(() => { - contract.unreadCount = 0; addChatSession(contract); set({ currentContract: contract }); updateConfig({