xx
This commit is contained in:
@@ -298,7 +298,6 @@ const RobotControlCenter = ({ setView }) => {
|
||||
if (res.data.code == 200) {
|
||||
setUrlInfo(res.data.data);
|
||||
}
|
||||
console.log(res, "获取")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
|
||||
if (!stationId) return;
|
||||
|
||||
try {
|
||||
console.log('开始请求设备数据,stationId:', userInfo);
|
||||
// 1. 同时发请求
|
||||
const [deviceRes, planeRes] = await Promise.all([
|
||||
getSiteDevice({ siteId: stationId, pageSize: 9999, pageNum: 1, orgId: userInfo.orgId }),
|
||||
|
||||
@@ -255,7 +255,6 @@ export default function DeviceStatusPage({
|
||||
if (device.gateway_sn && device.gateway_sn !== device.device_sn) {
|
||||
topics.push(`thing/product/${device.gateway_sn}/osd`);
|
||||
}
|
||||
console.log('DeviceStatusPage 订阅的MQTT主题:', topics);
|
||||
return topics;
|
||||
}, [isUAV, device]);
|
||||
|
||||
@@ -371,8 +370,9 @@ export default function DeviceStatusPage({
|
||||
controllerRef.current?.destroy();
|
||||
|
||||
controllerRef.current = null;
|
||||
|
||||
};
|
||||
}, [userInfo, messageApi]);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!device || !controllerRef.current || !device?.serialNumber || isUAV) return;
|
||||
|
||||
@@ -234,7 +234,6 @@ export default function RobotTaskPage() {
|
||||
});
|
||||
};
|
||||
const handleTaskexcuted = (route) => {
|
||||
console.log('执行任务,路线数据:', route);
|
||||
|
||||
// 检查路径点
|
||||
let hasPathPoints = false;
|
||||
@@ -272,7 +271,6 @@ export default function RobotTaskPage() {
|
||||
...(userInfo?.orgId ? { orgId: userInfo.orgId } : {}),
|
||||
};
|
||||
|
||||
console.log('执行任务参数:', params);
|
||||
const res = await excuetRoute(params);
|
||||
|
||||
if (res.code === 200) {
|
||||
|
||||
@@ -92,7 +92,6 @@ export default function WayLinePage({ onRefresh }) {
|
||||
|
||||
try {
|
||||
const parsedMessage = JSON.parse(message);
|
||||
//console.log('WayLinePage 解析后的消息:', parsedMessage);
|
||||
|
||||
if (parsedMessage.data && parsedMessage.data.host) {
|
||||
const { host } = parsedMessage.data;
|
||||
@@ -513,7 +512,6 @@ export default function WayLinePage({ onRefresh }) {
|
||||
const getBoardTask = async () => {
|
||||
if (!planedevices?.length) return;
|
||||
try {
|
||||
console.log('获取看板任务数据,当前筛选条件:')
|
||||
|
||||
const defaultStart = dayjs().startOf('day').unix();
|
||||
const defaultEnd = dayjs().endOf('day').unix();
|
||||
@@ -524,7 +522,6 @@ export default function WayLinePage({ onRefresh }) {
|
||||
|
||||
const sns = boardDrone ? [boardDrone.gateway_sn] : planedevices.map(item => item.gateway_sn);
|
||||
const res = await getsinglePlan({ sns, beginAt, endAt });
|
||||
console.log('看板任务数据接口返回:', res);
|
||||
if (res?.code === 200) {
|
||||
let combinedList = [];
|
||||
if (res.data) {
|
||||
|
||||
@@ -64,7 +64,10 @@ export default class DeviceController {
|
||||
// 切后台:关闭 WS
|
||||
if (document.visibilityState === 'hidden') {
|
||||
console.log('🔌 页面切后台,关闭 WebSocket');
|
||||
this.release();
|
||||
wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
|
||||
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
@@ -91,6 +94,22 @@ export default class DeviceController {
|
||||
}
|
||||
}, 8000);
|
||||
}
|
||||
release() {
|
||||
if (this.isControlled && this.connectedDeviceSn) {
|
||||
const data = {
|
||||
platform: "web",
|
||||
type: 1
|
||||
};
|
||||
const url = `${envConfig.baseURL}/forward/device/releaseControl`;
|
||||
|
||||
try {
|
||||
const blob = new Blob([JSON.stringify(data)], { type: 'application/json' });
|
||||
navigator.sendBeacon(url, blob);
|
||||
} catch (e) {
|
||||
console.error('Failed to send releaseControl beacon:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.clearControlTimeout();
|
||||
@@ -106,8 +125,11 @@ export default class DeviceController {
|
||||
|
||||
this.unSubMessage?.();
|
||||
this.unSubStatus?.();
|
||||
this.release();
|
||||
|
||||
wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
|
||||
}
|
||||
|
||||
handleWsStatus(status) {
|
||||
@@ -154,6 +176,7 @@ export default class DeviceController {
|
||||
wsManager.connect(sn, this.wsUrl);
|
||||
this.connectedDeviceSn = sn;
|
||||
|
||||
|
||||
await this.getControl(sn);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
@@ -223,6 +246,7 @@ export default class DeviceController {
|
||||
}
|
||||
|
||||
handleWsMessage(msg) {
|
||||
console.log('📨 收到消息:', msg);
|
||||
switch (msg.type) {
|
||||
case 'deviceInfo': {
|
||||
const data = {};
|
||||
|
||||
Reference in New Issue
Block a user