From bb15106796a4a521554785dba7861764c25a9eec Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 17 Mar 2025 11:09:26 +0800
Subject: [PATCH] wss换地址
---
.env.development | 3 +++
.env.production | 2 ++
src/websocket/util/config.js | 2 +-
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/.env.development b/.env.development
index 46b2f03..6892bca 100644
--- a/.env.development
+++ b/.env.development
@@ -10,3 +10,6 @@
# 服务地址
VITE_APP_URL = https://wrj.shuixiongit.com/api
+# 域名
+VUE_APP_AREA_NAME = https://wrj.shuixiongit.com
+
diff --git a/.env.production b/.env.production
index bc33584..85fe3ed 100644
--- a/.env.production
+++ b/.env.production
@@ -14,3 +14,5 @@
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
+# 域名
+VUE_APP_AREA_NAME = https://drone.shuixiongit.com
diff --git a/src/websocket/util/config.js b/src/websocket/util/config.js
index 2329fa4..5b3f585 100644
--- a/src/websocket/util/config.js
+++ b/src/websocket/util/config.js
@@ -14,6 +14,6 @@
export function getWebsocketUrl() {
const token = getToken();
// const url = CURRENT_CONFIG.websocketURL
- const url = 'wss://wrj.shuixiongit.com/drone-wss/api/v1/ws?x-auth-token=' + encodeURI(token);
+ const url = `wss://${process.env.VUE_APP_AREA_NAME}/drone-wss/api/v1/ws?x-auth-token=${encodeURI(token)}`;
return url;
}
--
Gitblit v1.9.3