From db4bc8651da57901cff6b7cef04c323fd75d7964 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: Fri, 29 Aug 2025 15:40:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AE=A2=E6=9C=8D=E8=81=8A=E5=A4=A9):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E5=AE=A2=E6=9C=8D=E7=94=A8=E6=88=B7=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在CkChatState接口中添加kfSelectedUser方法用于获取当前选中的客服用户信息,并在聊天窗口组件中显示该信息 --- Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx | 3 +++ Cunkebao/src/store/module/ckchat.data.ts | 1 + Cunkebao/src/store/module/ckchat.ts | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx index a6e303e6..a1e94395 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx @@ -50,6 +50,7 @@ import { clearUnreadCount, getMessages } from "@/pages/pc/ckbox/api"; import styles from "./ChatWindow.module.scss"; import { useWebSocketStore, WebSocketMessage } from "@/store/module/websocket"; import { formatWechatTime } from "@/utils/common"; +import { useCkChatStore } from "@/store/module/ckchat"; const { Header, Content, Footer, Sider } = Layout; const { TextArea } = Input; @@ -78,6 +79,7 @@ const ChatWindow: React.FC = ({ const [remarkValue, setRemarkValue] = useState(contract.conRemark || ""); const messagesEndRef = useRef(null); + const kfSelectedUser = useCkChatStore(state => state.kfSelectedUser()); useEffect(() => { clearUnreadCount([contract.id]).then(() => { setLoading(true); @@ -1063,6 +1065,7 @@ const ChatWindow: React.FC = ({
+ {JSON.stringify(kfSelectedUser)} {isEditingRemark ? (
KfUserListData | undefined; newContractList: { groupName: string; contacts: any[] }[]; asyncKfSelected: (data: number) => void; getkfUserList: () => KfUserListData[]; diff --git a/Cunkebao/src/store/module/ckchat.ts b/Cunkebao/src/store/module/ckchat.ts index efe8dc57..591a2bf1 100644 --- a/Cunkebao/src/store/module/ckchat.ts +++ b/Cunkebao/src/store/module/ckchat.ts @@ -16,6 +16,10 @@ export const useCkChatStore = createPersistStore( kfUserList: [], //客服列表 kfSelected: 0, newContractList: [], //联系人分组 + kfSelectedUser: () => { + const state = useCkChatStore.getState(); + return state.kfUserList.find(item => item.id === state.kfSelected); + }, asyncKfSelected: (data: number) => { set({ kfSelected: data }); },