refactor: 重命名userId变量为Id并添加WebSocket错误日志
This commit is contained in:
parent
0a55354619
commit
e87cadb2f2
6
App.vue
6
App.vue
|
|
@ -172,9 +172,9 @@ export default {
|
||||||
buildWsUrl() {
|
buildWsUrl() {
|
||||||
const protocol =
|
const protocol =
|
||||||
window.location.protocol.indexOf("https") === 0 ? "wss" : "ws";
|
window.location.protocol.indexOf("https") === 0 ? "wss" : "ws";
|
||||||
const userId =
|
const Id =
|
||||||
(this.vuex_user && (this.vuex_user.id || this.vuex_user.Id)) || "";
|
(this.vuex_user && (this.vuex_user.id || this.vuex_user.Id)) || "";
|
||||||
return `${protocol}://120.55.234.65:8082/api/Dialogue/HandleConnection?Id=${userId}`; // &equipmentType=0
|
return `${protocol}://120.55.234.65:8082/api/Dialogue/HandleConnection?Id=${Id}`; // &equipmentType=0
|
||||||
},
|
},
|
||||||
// 初始化原生 WebSocket 连接
|
// 初始化原生 WebSocket 连接
|
||||||
initWebSocket() {
|
initWebSocket() {
|
||||||
|
|
@ -308,6 +308,8 @@ export default {
|
||||||
},
|
},
|
||||||
// 连接错误
|
// 连接错误
|
||||||
handleWsError(e) {
|
handleWsError(e) {
|
||||||
|
console.log("[WebSocket] 连接错误:", e);
|
||||||
|
|
||||||
this.lockReconnect = false;
|
this.lockReconnect = false;
|
||||||
this.reconnect();
|
this.reconnect();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue