hejianhao
2026-04-20 c967fe84364feffa9652b26e66bfbdedd6355074
fix(begin-route): 修复路线绘制逻辑并优化等待状态处理

修复 use-route-manager 中路线渲染条件,确保仅在 shouldShowRoute 为 true 时绘制路线,避免不必要的渲染。
在 use-trip-runtime 中,当行程状态为 4 或 5 时,重置步行路线并清理计时器,以正确处理等待状态。
2个文件已修改
19 ■■■■■ 已修改文件
src/robotaxi/pages/begin-route/hooks/use-route-manager.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/hooks/use-trip-runtime.ts 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/hooks/use-route-manager.ts
@@ -550,7 +550,7 @@
    const lines: any[] = [];
    
    // 如果有多条路线且在未发单状态或修改目的地状态(allowSelectableRoutes === true),渲染所有路线
    if (deps.allowSelectableRoutes && allRoutePoints.length > 1) {
    if (deps.shouldShowRoute && deps.allowSelectableRoutes && allRoutePoints.length > 1) {
      allRoutePoints.forEach((points, index) => {
        if (!points || points.length === 0) return;
        
@@ -582,7 +582,7 @@
          arrowLine: true,
        });
      }
    } else if (displayRoutePoints.length > 0) {
    } else if (deps.shouldShowRoute && displayRoutePoints.length > 0) {
      // 只有一条路线或非 tripStatus=1 的情况
      lines.push({
        id: 2001,
@@ -613,7 +613,9 @@
    const nextKey = buildPolylineKey(displayRoutePoints);
    if (nextKey === polylineKeyRef.current) return;
    polylineKeyRef.current = nextKey;
    const shouldDraw = deps.shouldShowRoute && (displayRoutePoints.length > 0 || (deps.statusRule.showWalking && walkingPoints.length > 0));
    const shouldDrawRoute = deps.shouldShowRoute && displayRoutePoints.length > 0;
    const shouldDrawWalking = deps.statusRule.showWalking && walkingPoints.length > 0;
    const shouldDraw = shouldDrawRoute || shouldDrawWalking;
    if (shouldDraw) {
      setPolyline(buildPolylineLines(displayRoutePoints));
      lastPolylineUpdateAtRef.current = Date.now();
src/robotaxi/pages/begin-route/hooks/use-trip-runtime.ts
@@ -289,6 +289,17 @@
      deps.setWalkingPoints([]);
      deps.setWalkingTime(0);
      timer = startWaitingTimer();
    } else if ([4, 5].includes(deps.tripStatus)) {
      deps.requoteTriggeredRef.current = false;
      const cachedStartSite = Taro.getStorageSync('startSite') || {};
      if (cachedStartSite?.latitude && cachedStartSite?.longitude) {
        deps.routeUpdateWalkingRouteForStart(cachedStartSite);
      } else {
        deps.setWalkingPoints([]);
        deps.setWalkingTime(0);
      }
      deps.setElapsedSeconds(0);
      clearWaitingTimerStorage();
    } else if (deps.tripStatus == 7) {
      deps.requoteTriggeredRef.current = false;
      deps.setWalkingPoints([]);