diff --git a/src/pages/shells/index.vue b/src/pages/shells/index.vue index 706eb2b..252630b 100644 --- a/src/pages/shells/index.vue +++ b/src/pages/shells/index.vue @@ -221,20 +221,25 @@ export default { this.websocket.onmessage = (event) => { try { const res = JSON.parse(event.data) - if (!res.rcsConnected && !res.vehicleConnected) { + if (!res.data.rcsConnected && !res.data.vehicleConnected) { this.showConnectionError(this.$t('Dispatchvehiclenotconnected')) - } else if (!res.rcsConnected && res.vehicleConnected) { - this.showConnectionError(this.$t('Dispatchnotconnected')) - } else if (!res.vehicleConnected && res.rcsConnected) { - this.showConnectionError(this.$t('Vehiclenotconnected')) - } else { - this.hideConnectionError() + return } - if (res.rcsConnected && res.vehicleConnected) { + if (!res.data.rcsConnected && res.data.vehicleConnected) { + this.showConnectionError(this.$t('Dispatchnotconnected')) + return + } + if (!res.data.vehicleConnected && res.data.rcsConnected) { + this.showConnectionError(this.$t('Vehiclenotconnected')) + return + } + if (res.data.rcsConnected && res.data.vehicleConnected) { this.loading.close() this.hideConnectionError() + this.handleWebSocketMessage(res) + return } - this.handleWebSocketMessage(res) + this.hideConnectionError() } catch (error) { console.error('WebSocket消息解析失败:', error) }