From a67ca442a0af9984753838834a5e95d1ef57e700 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: Tue, 2 Sep 2025 11:23:18 +0800 Subject: [PATCH] =?UTF-8?q?FEAT=20=3D>=20=E6=9C=AC=E6=AC=A1=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=A1=B9=E7=9B=AE=E4=B8=BA=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cunkebao/src/pages/pc/ckbox/main.ts | 2 +- Cunkebao/src/store/module/websocket/sendMessages.ts | 0 Cunkebao/src/store/module/websocket/websocket.ts | 9 --------- 3 files changed, 1 insertion(+), 10 deletions(-) create mode 100644 Cunkebao/src/store/module/websocket/sendMessages.ts diff --git a/Cunkebao/src/pages/pc/ckbox/main.ts b/Cunkebao/src/pages/pc/ckbox/main.ts index 578f81a7..ddf98dce 100644 --- a/Cunkebao/src/pages/pc/ckbox/main.ts +++ b/Cunkebao/src/pages/pc/ckbox/main.ts @@ -99,7 +99,7 @@ export const initSocket = () => { const { status } = useWebSocketStore.getState(); // 如果已经连接或正在连接,则不重复连接 - if (status === "connected" || status === "connecting") { + if (["connected", "connecting"].includes(status)) { console.log("WebSocket已连接或正在连接,跳过重复连接", { status }); return; } diff --git a/Cunkebao/src/store/module/websocket/sendMessages.ts b/Cunkebao/src/store/module/websocket/sendMessages.ts new file mode 100644 index 00000000..e69de29b diff --git a/Cunkebao/src/store/module/websocket/websocket.ts b/Cunkebao/src/store/module/websocket/websocket.ts index 08feb6db..34e39846 100644 --- a/Cunkebao/src/store/module/websocket/websocket.ts +++ b/Cunkebao/src/store/module/websocket/websocket.ts @@ -137,16 +137,7 @@ export const useWebSocketStore = createPersistStore( t: Date.now().toString(), }); - // 调试信息:输出配置和环境变量 - // console.log("WebSocket配置信息:", { - // configUrl: fullConfig.url, - // envUrl: (import.meta as any).env?.VITE_API_WS_URL, - // fullConfig, - // params: params.toString(), - // }); - const wsUrl = fullConfig.url + "?" + params; - // console.log("最终WebSocket URL:", wsUrl); // 检查URL是否为localhost,如果是则不连接 if (wsUrl.includes("localhost") || wsUrl.includes("127.0.0.1")) {