diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 66cf558..3fc0b60 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -189,9 +189,10 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints = } return; } - + console.log(points, "4324345") const validPoints = points.filter(p => { - const lon = Number(p.lon); + + const lon = Number(p.lng); const lat = Number(p.lat); return ( !isNaN(lon) && @@ -207,7 +208,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints = const positions = validPoints.map(point => Cesium.Cartesian3.fromDegrees( - Number(point.lon), + Number(point.lng), Number(point.lat) ) ); @@ -235,8 +236,8 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints = let minLat = 90, maxLat = -90; validPoints.forEach(p => { - minLon = Math.min(minLon, p.lon); - maxLon = Math.max(maxLon, p.lon); + minLon = Math.min(minLon, p.lng); + maxLon = Math.max(maxLon, p.lng); minLat = Math.min(minLat, p.lat); maxLat = Math.max(maxLat, p.lat); }); @@ -251,7 +252,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints = viewer.scene.requestRender(); viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees( - p.lon, + p.lng, p.lat, 800 ), diff --git a/src/components/devices/DeviceStatusPage.tsx b/src/components/devices/DeviceStatusPage.tsx index dc97503..29d9241 100644 --- a/src/components/devices/DeviceStatusPage.tsx +++ b/src/components/devices/DeviceStatusPage.tsx @@ -479,7 +479,6 @@ export default function DeviceStatusPage({ : 'robot', }; }, [device, isUAV, runningStatus, uavState, currentDroneData]); - console.log('DeviceStatusPage mapDevices:', mapDevices); const realtimeDevice = useMemo(() => { if (!device) return null; return { diff --git a/src/components/devices/DroneVideoPlayer.tsx b/src/components/devices/DroneVideoPlayer.tsx index db1fe60..80500dd 100644 --- a/src/components/devices/DroneVideoPlayer.tsx +++ b/src/components/devices/DroneVideoPlayer.tsx @@ -65,7 +65,7 @@ const DroneVideoPlayer: React.FC = ({ cameraIndex, cameraPosition, qualityType: "adaptive", - videoExpire: 7200, + videoExpire: 720000000, }); if (res.code == 200) setStationStreamData(res.data); @@ -100,7 +100,7 @@ const DroneVideoPlayer: React.FC = ({ lensType, cameraIndex, qualityType: "adaptive", - videoExpire: 7200, + videoExpire: 720000000, }); if (res.code === 200) setDroneStreamData(res.data); diff --git a/src/components/devices/WayLinePage.tsx b/src/components/devices/WayLinePage.tsx index 1ebc317..443c60e 100644 --- a/src/components/devices/WayLinePage.tsx +++ b/src/components/devices/WayLinePage.tsx @@ -597,7 +597,7 @@ export default function WayLinePage({ onRefresh }) { const res = await getsinglePlanTrack(record); if (res.code === 0 && res.data.track?.points?.length) { const points = res.data.track.points.map(item => ({ - lon: item.longitude || item.lon, + lng: item.longitude || item.lon, lat: item.latitude || item.lat })); setPoints(points); diff --git a/src/components/devices/deviceController.js b/src/components/devices/deviceController.js index 43177b2..2ad0ddc 100644 --- a/src/components/devices/deviceController.js +++ b/src/components/devices/deviceController.js @@ -61,6 +61,14 @@ export default class DeviceController { // ========== 【集成】页面切前台重连 ========== handleVisibilityChange() { + // 切后台:关闭 WS + if (document.visibilityState === 'hidden') { + console.log('🔌 页面切后台,关闭 WebSocket'); + wsManager.close(); + + this.isControlled = false; + this.onControlStatusChange?.(false); + } if (document.visibilityState === 'visible' && this.currentDevice) { if (!this.currentDevice?.serialNumber) return; console.log('✅ 页面切回前台,自动重连 WebSocket');