diff --git a/env.js b/env.js index cac3477..0590a48 100644 --- a/env.js +++ b/env.js @@ -9,11 +9,11 @@ const currentEnv = import.meta.env?.MODE || process.env.NODE_ENV; // 环境配置映射 const envConfig = { [ENV.DEV]: { - baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081 - //baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081 - WS_URL: 'ws://192.168.2.59:9002/ws/', - mqtt_url: "ws://1.95.137.212:8083/mqtt", - geoserver_url: "http://192.168.2.59:7000/geoserver" + //baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081 + ////baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081 + //WS_URL: 'ws://192.168.2.59:9002/ws/', + //mqtt_url: "ws://1.95.137.212:8083/mqtt", + //geoserver_url: "http://192.168.2.59:7000/geoserver" //baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081 ////baseURL: 'https://serviceri.satabot.com', @@ -21,11 +21,11 @@ const envConfig = { //mqtt_url: "ws://1.95.137.212:8083/mqtt", //geoserver_url: "http://1.95.137.212:59018/geoserver" - //baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081 - ////baseURL: 'https://serviceri.satabot.com', - //WS_URL: 'ws://1.95.137.212:59017/ws/', - //mqtt_url: "ws://1.95.137.212:59021/mqtt", - //geoserver_url: "http://1.95.137.212:59018/geoserver" + baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081 + //baseURL: 'https://serviceri.satabot.com', + WS_URL: 'ws://1.95.137.212:59017/ws/', + mqtt_url: "ws://1.95.137.212:59021/mqtt", + geoserver_url: "http://1.95.137.212:59018/geoserver" }, [ENV.PROD]: { //baseURL: 'https://pvcloudservice.satabot.com', diff --git a/src/components/Map.jsx b/src/components/Map.jsx index c70471d..2fe1d97 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -1592,6 +1592,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine, // 如果有航向角,设置旋转 let rotation = 0; + console.log('realtimePosition.heading:', realtimePosition.heading); + if (realtimePosition?.heading !== undefined && !isNaN(Number(realtimePosition.heading))) { let headingDeg = Number(realtimePosition.heading); diff --git a/src/components/devices/DeviceStatusPage.tsx b/src/components/devices/DeviceStatusPage.tsx index 917a024..7cd8744 100644 --- a/src/components/devices/DeviceStatusPage.tsx +++ b/src/components/devices/DeviceStatusPage.tsx @@ -383,7 +383,7 @@ export default function DeviceStatusPage({ return { lon: robotLon, lat: robotLat, - //heading: 0 + //heading: -98 heading: runningStatus.yaw || wsDeviceInfo.yaw || 0, }; } diff --git a/src/components/devices/mowerAllView.jsx b/src/components/devices/mowerAllView.jsx index 7ab78eb..4f533dd 100644 --- a/src/components/devices/mowerAllView.jsx +++ b/src/components/devices/mowerAllView.jsx @@ -67,30 +67,35 @@ export function MowerAllView({ serialNumber, robotVideo, error, ready, statusDat const [panelSize, setPanelSize] = useState(null); const [initialPositions, setInitialPositions] = useState(null); const [containerBounds, setContainerBounds] = useState(null); - const [initialized, setInitialized] = useState(false); - // 初始化尺寸和位置 + // 初始化尺寸、窗口缩放重新计算面板尺寸 useEffect(() => { - if (!containerRef.current || initialized) return; + const calcSize = () => { + if (!containerRef.current) return; + const rect = containerRef.current.getBoundingClientRect(); + if (rect.width === 0 || rect.height === 0) return; - const rect = containerRef.current.getBoundingClientRect(); + const w = rect.width * 0.30; + const h = Math.floor(rect.height * 0.35); - // 统一三个面板的尺寸 - const w = Math.max(200, Math.floor(rect.width * 0.25)); - const h = Math.max(150, Math.floor(rect.height * 0.3)); + setPanelSize({ width: w, height: h }); + setContainerBounds({ width: rect.width, height: rect.height }); + setInitialPositions({ + left: { x: 8, y: 8 }, + right: { x: rect.width - w - 8, y: 8 }, + back: { x: (rect.width - w) / 2, y: rect.height - h - 8 } + }); + }; - setPanelSize({ width: w, height: h }); - setContainerBounds({ width: rect.width, height: rect.height }); + calcSize(); + const timer = setTimeout(calcSize, 100); + window.addEventListener('resize', calcSize); - // 设置初始位置 - setInitialPositions({ - left: { x: 8, y: 8 }, - right: { x: rect.width - w - 8, y: 8 }, - back: { x: (rect.width - w) / 2, y: rect.height - h - 8 } - }); - - setInitialized(true); - }, [initialized]); + return () => { + clearTimeout(timer); + window.removeEventListener('resize', calcSize); + }; + }, []); return (
-
{/* 三个可拖拽子面板 */} - {initialized && panelSize && initialPositions && containerBounds && ( + {panelSize && initialPositions && containerBounds && ( <> - {/* 左视 */} - - {/* 右视 */} - - {/* 后视 */}