From 1988d77f4df3c01a9137303e0c959b3442c14377 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期一, 30 九月 2024 22:10:30 +0800
Subject: [PATCH] 1

---
 src/utils/tool.js |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/utils/tool.js b/src/utils/tool.js
index 5313762..85cda09 100644
--- a/src/utils/tool.js
+++ b/src/utils/tool.js
@@ -1,8 +1,8 @@
 /*
  * @Descripttion: 宸ュ叿闆�
  * @version: 1.2
- * @LastEditors: sakuya
- * @LastEditTime: 2022骞�5鏈�24鏃�00:28:56
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-06-17 18:21:44
  */
 
 import CryptoJS from 'crypto-js';
@@ -10,6 +10,16 @@
 
 const tool = {}
 
+var currentLocation = window.location.href; // 鑾峰彇瀹屾暣鐨刄RL
+var protocol = window.location.protocol; // 鑾峰彇鍗忚锛堝http:鎴杊ttps:锛�
+var hostname = window.location.hostname; // 鑾峰彇涓绘満鍚�
+var port = window.location.port; // 鑾峰彇绔彛鍙�
+var pathname = window.location.pathname; // 鑾峰彇璺緞鍚�
+if (process.env.NODE_ENV=='development') {
+	var path = "120.46.212.231:84";
+} else {
+	var path = hostname+":"+port;
+}
 /* localStorage */
 tool.data = {
 	set(key, data, datetime = 0) {
@@ -116,7 +126,7 @@
 
 /* socket */
 tool.socket = {
-	url:'ws://116.63.155.153:83/ws/info',
+	url:'ws://'+path+'/ws/info',
 	websocket: null,
 	connectToWebSocket(token) {  //寤虹珛閾炬帴
     	this.websocket = new WebSocket(this.url + "?access_token=" + token);  

--
Gitblit v1.9.3