From 7091adb6a071da6b078af3e0631282aa6d977cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Wed, 15 Oct 2025 10:49:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20weChatGroup=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E6=96=B0=E5=A2=9E=20top=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=B8=BA=E5=8F=AF=E9=80=89=E9=A1=B9=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=20unreadCount=20=E5=AD=97=E6=AE=B5=E4=B8=BA=E5=8F=AF=E9=80=89?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E6=94=B9=20getNewContractList=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B=E4=B8=BA=20Promis?= =?UTF-8?q?e=EF=BC=9B=E6=96=B0=E5=A2=9E=20addCtrlUser=20=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BB=A5=E6=8E=A7=E5=88=B6=E7=BB=88=E7=AB=AF=E7=94=A8=E6=88=B7?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E5=A4=8D=20deleteChatSession=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B=E4=B8=BA=20number?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Touchkebao/src/pages/pc/ckbox/data.ts | 3 ++- Touchkebao/src/pages/pc/ckbox/weChat/data.ts | 2 +- Touchkebao/src/store/module/ckchat/ckchat.data.ts | 2 +- Touchkebao/src/store/module/ckchat/ckchat.ts | 14 ++++++++++---- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Touchkebao/src/pages/pc/ckbox/data.ts b/Touchkebao/src/pages/pc/ckbox/data.ts index b0861eeb..367a8ee6 100644 --- a/Touchkebao/src/pages/pc/ckbox/data.ts +++ b/Touchkebao/src/pages/pc/ckbox/data.ts @@ -115,8 +115,9 @@ export interface weChatGroup { chatroomAvatar: string; groupId: number; config?: { + top?: false; chat?: boolean; - unreadCount: number; + unreadCount?: number; }; labels?: string[]; notice: string; diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/data.ts b/Touchkebao/src/pages/pc/ckbox/weChat/data.ts index 4fb95faa..52605792 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/data.ts +++ b/Touchkebao/src/pages/pc/ckbox/weChat/data.ts @@ -113,11 +113,11 @@ export interface weChatGroup { chatroomAvatar: string; groupId: number; config?: { + top?: false; chat?: boolean; unreadCount: number; }; labels?: string[]; - notice: string; selfDisplyName: string; wechatChatroomId: number; diff --git a/Touchkebao/src/store/module/ckchat/ckchat.data.ts b/Touchkebao/src/store/module/ckchat/ckchat.data.ts index 9eeebffa..d406fbe7 100644 --- a/Touchkebao/src/store/module/ckchat/ckchat.data.ts +++ b/Touchkebao/src/store/module/ckchat/ckchat.data.ts @@ -46,7 +46,7 @@ export interface CkChatState { newContractList: ContactGroupByLabel[]; getContractList: () => ContractData[]; getSomeContractList: (kfSelected: number) => ContractData[]; - getNewContractList: () => ContactGroupByLabel[]; + getNewContractList: () => Promise; setSearchKeyword: (keyword: string) => void; clearSearchKeyword: () => void; asyncKfSelected: (data: number) => void; diff --git a/Touchkebao/src/store/module/ckchat/ckchat.ts b/Touchkebao/src/store/module/ckchat/ckchat.ts index 73e9c2ad..8f8840b3 100644 --- a/Touchkebao/src/store/module/ckchat/ckchat.ts +++ b/Touchkebao/src/store/module/ckchat/ckchat.ts @@ -37,7 +37,7 @@ export const useCkChatStore = createPersistStore( set({ kfUserList: data }); }, // 获取客服列表 - getkfUserList: async () => { + getkfUserList: () => { const state = useCkChatStore.getState(); return state.kfUserList; }, @@ -330,6 +330,12 @@ export const useCkChatStore = createPersistStore( clearkfUserList: () => { set({ kfUserList: [] }); }, + // 添加控制终端用户 + addCtrlUser: (user: KfUserListData) => { + set(state => ({ + kfUserList: [...state.kfUserList, user], + })); + }, // 获取聊天会话 - 使用缓存避免无限循环 getChatSessions: (() => { let cachedResult: any = null; @@ -492,8 +498,8 @@ export const useCkChatStore = createPersistStore( isLoggedIn: state.isLoggedIn, kfUserList: state.kfUserList, }), - onRehydrateStorage: () => state => { - // console.log("CkChat store hydrated:", state); + onRehydrateStorage: () => () => { + // console.log("CkChat store hydrated"); }, }, ); @@ -510,7 +516,7 @@ export const addChatSession = (session: ContractData | weChatGroup) => useCkChatStore.getState().addChatSession(session); export const updateChatSession = (session: ContractData | weChatGroup) => useCkChatStore.getState().updateChatSession(session); -export const deleteChatSession = (sessionId: string) => +export const deleteChatSession = (sessionId: number) => useCkChatStore.getState().deleteChatSession(sessionId); export const getkfUserList = () => useCkChatStore.getState().kfUserList; export const addCtrlUser = (user: KfUserListData) =>