fix(robotaxi): 修复地图定位和热修状态判断逻辑
- 修复热修状态判断逻辑,从响应中正确获取 hotfixStatus
- 优化地图定位逻辑,当有用户位置时使用 moveToLocation 而非 includePoints
- 添加 latitude 和 longitude 到 useEffect 依赖项,确保定位更新
| | |
| | | |
| | | useEffect(() => { |
| | | let timer: any = null; |
| | | const parseTime = (s: string) => { |
| | | if (!s) return NaN; |
| | | return new Date(s.replace(/-/g, '/')).getTime(); |
| | | }; |
| | | const check = () => { |
| | | getHotFixInfo().then((res: any) => { |
| | | if (status === 1 ) { |
| | | const status = Number(res?.hotfixStatus); |
| | | if (status === 1) { |
| | | setIsMaintain(true); |
| | | setHotfixEndText(res?.hotfixEndTime); |
| | | } else { |
| | |
| | | skipFenceIncludePointsRef.current = false; |
| | | } else { |
| | | const mapCtx = Taro.createMapContext('map'); |
| | | const points = extractPointsFromPolygons(newPolygons); |
| | | if (!isLocationAuthDenied) { |
| | | mapCtx.includePoints({ |
| | | points: points, |
| | | padding: [100, 100, 100, 100] |
| | | if (!isLocationAuthDenied && typeof latitude === 'number' && typeof longitude === 'number') { |
| | | mapCtx.moveToLocation({ |
| | | latitude, |
| | | longitude, |
| | | }); |
| | | } else { |
| | | const points = extractPointsFromPolygons(newPolygons); |
| | | if (!isLocationAuthDenied) { |
| | | mapCtx.includePoints({ |
| | | points: points, |
| | | padding: [100, 100, 100, 100] |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | }); |
| | | } |
| | | }); |
| | | }, [selectedCity.code, selectedCity.name, isLocationAuthDenied]); |
| | | }, [selectedCity.code, selectedCity.name, isLocationAuthDenied, latitude, longitude]); |
| | | |
| | | const calculateBoxHeight = () => { |
| | | // 延迟计算,确保 DOM 渲染完成 |