websocket bug
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user