diff --git a/pages/chat/ChatMainList.vue b/pages/chat/ChatMainList.vue index 5818c94..d598929 100644 --- a/pages/chat/ChatMainList.vue +++ b/pages/chat/ChatMainList.vue @@ -287,6 +287,11 @@ const handleReply = (text) => { // 是发送指令 const handleReplyInstruct = (item) => { + if (!appStore.hasToken) { + console.log("没有token,跳转到登录页"); + goLogin(); + return; + } if (item.type === "MyOrder") { // 订单 uni.navigateTo({ @@ -480,11 +485,14 @@ const initWebSocket = () => { }); // 初始化连接 - webSocketManager.connect().then(() => { - webSocketConnectStatus = true; - }).catch((error) => { - console.error("WebSocket连接失败:", error); - }); + webSocketManager + .connect() + .then(() => { + webSocketConnectStatus = true; + }) + .catch((error) => { + console.error("WebSocket连接失败:", error); + }); }; // 处理WebSocket消息