From 9d589cdcc8ecedc6f3e98ba18daaa5c34dca782e Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 29 May 2024 11:54:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/websocket/index.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/core/core-frontend/src/websocket/index.ts b/core/core-frontend/src/websocket/index.ts index 10728ee861..fdeca8343c 100644 --- a/core/core-frontend/src/websocket/index.ts +++ b/core/core-frontend/src/websocket/index.ts @@ -5,6 +5,7 @@ import { useCache } from '@/hooks/web/useCache' const { wsCache } = useCache() let stompClient: Stomp.Client let timeInterval: NodeJS.Timer | null = null +const basePath = import.meta.env.VITE_API_BASEPATH export default { install() { @@ -14,14 +15,6 @@ export default { event: 'task-export-topic-call' } ] - let prefix = '/' - if (window.DataEaseBi?.baseUrl) { - prefix = window.DataEaseBi.baseUrl - } else { - const href = window.location.href - prefix = href.substring(0, href.indexOf('#')) - } - function isLoginStatus() { return wsCache.get('user.token') } @@ -33,7 +26,7 @@ export default { if (stompClient !== null && stompClient != undefined && stompClient.connected) { return } - const socket = new SockJS(prefix + 'websocket?userId=' + wsCache.get('user.uid')) + const socket = new SockJS(basePath + '/websocket?userId=' + wsCache.get('user.uid')) stompClient = Stomp.over(socket) const heads = { userId: wsCache.get('user.uid')