diff --git a/src/pages/shells/index.vue b/src/pages/shells/index.vue index 3687353..a44ed70 100644 --- a/src/pages/shells/index.vue +++ b/src/pages/shells/index.vue @@ -53,6 +53,7 @@ :wsConnected="isConnected" :vehicleConnected="vehicleConnected" :rcsConnected="rcsConnected" + @configModalHandle="configModalHandle" /> @@ -208,8 +209,22 @@ export default { clearTimeout(this.reconnectTimer) this.reconnectTimer = null } + + this.isInitializing = false + this.isConnecting = true + this.isConnected = false + this.vehicleConnected = false + this.rcsConnected = false + + this.topInfo = {} + this.taskSeq = [] + this.currentStep = null + this.closeWebSocket() - this.initWebSocket() + + setTimeout(() => { + this.initWebSocket() + }, 300) }, // 滚动区域 checkTextOverflow () { @@ -247,10 +262,15 @@ export default { this.isInitializing = true this.isConnecting = true - if (this.reconnectTimer) clearTimeout(this.reconnectTimer) + if (this.reconnectTimer) { + clearTimeout(this.reconnectTimer) + this.reconnectTimer = null + } + const wsHost = this.serverUrl.replace(/^https?:\/\//, '') const lang = this.$i18n.locale.slice(0, 2) const wsUrl = `ws://${wsHost}/webSocket/VehicleInfo/${this.userRole}?lang=${lang}` + this.closeWebSocket() try { @@ -319,8 +339,12 @@ export default { }, closeWebSocket () { if (this.websocket) { - this.websocket.onclose = null - this.websocket.close(1000, '正常关闭') + try { + this.websocket.onclose = null + this.websocket.close(1000, 'Switching connection') + } catch (e) { + console.log(e) + } this.websocket = null } }, diff --git a/src/pages/shells/websocket-status.vue b/src/pages/shells/websocket-status.vue index 6ef8784..ac82c43 100644 --- a/src/pages/shells/websocket-status.vue +++ b/src/pages/shells/websocket-status.vue @@ -1,5 +1,8 @@