websocket bug

This commit is contained in:
2026-01-28 10:16:59 +08:00
parent 4dd2a44842
commit b9705e9ae2

View File

@@ -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)
}