From 9cdfe552e0b051411f7e1d4a7a6a78470830e007 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, 3 Sep 2025 16:49:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4currentContract?= =?UTF-8?q?=E6=8C=81=E4=B9=85=E5=8C=96=E5=B9=B6=E6=B8=85=E7=90=86=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97=E5=92=8CWebSocket=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除weChat模块中currentContract的持久化配置,避免登录和刷新时数据残留 清理ChatWindow组件中的调试日志 在登录时清空WebSocket连接状态 --- Cunkebao/src/pages/login/Login.tsx | 3 +++ Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx | 1 - Cunkebao/src/store/module/weChat/weChat.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cunkebao/src/pages/login/Login.tsx b/Cunkebao/src/pages/login/Login.tsx index d375422a..972710b2 100644 --- a/Cunkebao/src/pages/login/Login.tsx +++ b/Cunkebao/src/pages/login/Login.tsx @@ -7,6 +7,7 @@ import { UserOutline, } from "antd-mobile-icons"; import { useUserStore } from "@/store/module/user"; +import { useWebSocketStore } from "@/store/module/websocket/websocket"; import { loginWithPassword, loginWithCode, sendVerificationCode } from "./api"; import style from "./login.module.scss"; @@ -75,6 +76,8 @@ const Login: React.FC = () => { response.then(res => { const { member, kefuData, deviceTotal } = res; + // 清空WebSocket连接状态 + useWebSocketStore.getState().clearConnectionState(); login(res.token, member, deviceTotal); const { self, token } = kefuData; login2(token.access_token); diff --git a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx index 72c88cb7..edff2cd2 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx @@ -84,7 +84,6 @@ const ChatWindow: React.FC = ({ // 更新上一次的消息状态 prevMessagesRef.current = currentMessages; - console.log("视频状态变化:", hasVideoStateChange, currentMessages); }, [currentMessages]); const scrollToBottom = () => { diff --git a/Cunkebao/src/store/module/weChat/weChat.ts b/Cunkebao/src/store/module/weChat/weChat.ts index 30d02e14..fd547121 100644 --- a/Cunkebao/src/store/module/weChat/weChat.ts +++ b/Cunkebao/src/store/module/weChat/weChat.ts @@ -146,7 +146,7 @@ export const useWeChatStore = create()( { name: "wechat-storage", partialize: state => ({ - currentContract: state.currentContract, + // currentContract 不做持久化,登录和页面刷新时直接清空 }), }, ),