fix: 移除currentContract持久化并清理调试日志和WebSocket状态

移除weChat模块中currentContract的持久化配置,避免登录和刷新时数据残留
清理ChatWindow组件中的调试日志
在登录时清空WebSocket连接状态
This commit is contained in:
超级老白兔
2025-09-03 16:49:45 +08:00
parent c27642bc12
commit 9cdfe552e0
3 changed files with 4 additions and 2 deletions

View File

@@ -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);

View File

@@ -84,7 +84,6 @@ const ChatWindow: React.FC<ChatWindowProps> = ({
// 更新上一次的消息状态
prevMessagesRef.current = currentMessages;
console.log("视频状态变化:", hasVideoStateChange, currentMessages);
}, [currentMessages]);
const scrollToBottom = () => {

View File

@@ -146,7 +146,7 @@ export const useWeChatStore = create<WeChatState>()(
{
name: "wechat-storage",
partialize: state => ({
currentContract: state.currentContract,
// currentContract 不做持久化,登录和页面刷新时直接清空
}),
},
),