航线任务 无人机实时轨迹优化显示 优化websocket优化 设备状态界面显示
This commit is contained in:
@@ -56,7 +56,7 @@ export default class DeviceController {
|
||||
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
||||
|
||||
// ========== 【集成】后台保活定时 ==========
|
||||
this.startKeepAlive();
|
||||
//this.startKeepAlive();
|
||||
}
|
||||
|
||||
// ========== 【集成】页面切前台重连 ==========
|
||||
@@ -165,16 +165,17 @@ export default class DeviceController {
|
||||
token: this.userInfo.token,
|
||||
});
|
||||
|
||||
this.hasControlRight = res?.code === 200;
|
||||
this.hasControlRight = res?.code === 200 && res.data == true;
|
||||
this.onHasControlRightChange?.(this.hasControlRight);
|
||||
|
||||
wsManager.connect(sn, this.wsUrl);
|
||||
this.connectedDeviceSn = sn;
|
||||
|
||||
if (!this.hasControlRight) {
|
||||
this.messageApi.warning('其他端正在控制');
|
||||
return;
|
||||
}
|
||||
|
||||
wsManager.connect(sn, this.wsUrl);
|
||||
this.connectedDeviceSn = sn;
|
||||
|
||||
|
||||
await this.getControl(sn);
|
||||
@@ -225,7 +226,7 @@ export default class DeviceController {
|
||||
this.onRequestControlStatusChange?.(false);
|
||||
this.messageApi.destroy('control');
|
||||
this.messageApi.error('控制请求超时');
|
||||
}, 10000);
|
||||
}, 20000);
|
||||
}
|
||||
|
||||
clearControlTimeout() {
|
||||
@@ -266,17 +267,18 @@ export default class DeviceController {
|
||||
}
|
||||
|
||||
case 'switchResult': {
|
||||
console.log('🔌 控制结果111111111111111:', msg);
|
||||
|
||||
this.clearControlTimeout();
|
||||
this.isRequestControl = false;
|
||||
this.onRequestControlStatusChange?.(false);
|
||||
|
||||
if (msg.success === false || msg.switchResult === false) {
|
||||
if (msg.success === false || msg?.respond?.switchResult === false) {
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
this.messageApi.error({ key: 'control', content: msg.message || '控制失败' });
|
||||
return;
|
||||
}
|
||||
|
||||
this.isControlled = true;
|
||||
this.onControlStatusChange?.(true);
|
||||
this.messageApi.success({ key: 'control', content: '控制成功' });
|
||||
@@ -284,8 +286,9 @@ export default class DeviceController {
|
||||
}
|
||||
|
||||
case 'switchPermission': {
|
||||
console.log('🔌 控制结果111111111111111222222222:', msg);
|
||||
const platform = (msg.platform || '').toLowerCase();
|
||||
if (!platform || platform === 'web' || platform === 'null') return;
|
||||
if (!platform || platform === 'null') return;
|
||||
|
||||
this.requestDeviceId = msg.deviceId;
|
||||
this.onPermissionRequest?.({
|
||||
|
||||
Reference in New Issue
Block a user