fix: 路由地址增加问号导致websocket报错

This commit is contained in:
fit2cloud-chenyw 2024-08-29 15:14:44 +08:00
parent b7286db7b4
commit fffe3471bf

View File

@ -36,12 +36,15 @@ export default {
if (window.DataEaseBi?.baseUrl) {
prefix = window.DataEaseBi.baseUrl
} else {
const href = window.location.href
prefix = href.substring(0, href.indexOf('#'))
// const href = window.location.href
prefix = location.origin + location.pathname
if (env.MODE === 'dev') {
prefix = dev.server.proxy[basePath].target + '/'
}
}
if (!prefix.endsWith('/')) {
prefix += '/'
}
const socket = new SockJS(prefix + 'websocket?userId=' + wsCache.get('user.uid'))
stompClient = Stomp.over(socket)
const heads = {