hejianhao
2026-03-15 97613d9bb4e9ca810ac7a9952eab73a6233b417a
fix(robotaxi): 修复地图定位和热修状态判断逻辑

- 修复热修状态判断逻辑,从响应中正确获取 hotfixStatus
- 优化地图定位逻辑,当有用户位置时使用 moveToLocation 而非 includePoints
- 添加 latitude 和 longitude 到 useEffect 依赖项,确保定位更新
1个文件已修改
26 ■■■■■ 已修改文件
src/pages/robotaxi/home/index.tsx 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/index.tsx
@@ -279,13 +279,10 @@
  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 {
@@ -383,12 +380,19 @@
            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]
                });
              }
            }
          }
        }
@@ -432,7 +436,7 @@
        });
      }
    });
  }, [selectedCity.code, selectedCity.name, isLocationAuthDenied]);
  }, [selectedCity.code, selectedCity.name, isLocationAuthDenied, latitude, longitude]);
  const calculateBoxHeight = () => {
    // 延迟计算,确保 DOM 渲染完成