hejianhao
2026-06-10 9f1e8f5fa5c671e46dfbe0d29b399b89410740ba
refactor(robotaxi): 移除站点选择页面的搜索关键字传递逻辑

移除所有与搜索关键字传递相关的冗余代码,简化页面逻辑
3个文件已修改
35 ■■■■■ 已修改文件
src/robotaxi/pages/begin-route/hooks/use-modify-destination-flow.ts 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/hooks/use-page-actions.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/site-search/index.tsx 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/hooks/use-modify-destination-flow.ts
@@ -14,7 +14,7 @@
  orderId: string;
  endSite: any;
  setEndSite: (site: any) => void;
  toSelectSite: (pageType: 'start' | 'end', keyword?: string) => void;
  toSelectSite: (pageType: 'start' | 'end') => void;
  onModifySuccess?: (restoredRoutePoints?: any[]) => void;
  onCancelReview?: (payload: {
    previousEndSite: any;
@@ -322,7 +322,7 @@
    safeSetStorageSync(MODIFY_DESTINATION_ROUTE_POINTS_KEY, Array.isArray(routePoints) ? routePoints : []);
    safeRemoveStorageSync(MODIFY_DESTINATION_CANDIDATE_KEY);
    setFlowState(FLOW_STATES.SELECTING);
    deps.toSelectSite('end', currentEndSiteName);
    deps.toSelectSite('end');
  };
  /**
src/robotaxi/pages/begin-route/hooks/use-page-actions.ts
@@ -114,10 +114,9 @@
  /**
   * 跳转选点页。
   */
  const toSelectSite = (pageType: 'start' | 'end', keyword?: string) => {
    const searchKeyword = encodeURIComponent(String(keyword || ''));
  const toSelectSite = (pageType: 'start' | 'end') => {
    Taro.navigateTo({
      url: `/robotaxi/pages/site-search/index?pageType=${pageType}&longitude=${deps.startSite.longitude}&latitude=${deps.startSite.latitude}&electronicAreaId=${deps.startSite.electronicAreaId}&keyword=${searchKeyword}`
      url: `/robotaxi/pages/site-search/index?pageType=${pageType}&longitude=${deps.startSite.longitude}&latitude=${deps.startSite.latitude}&electronicAreaId=${deps.startSite.electronicAreaId}`
    });
  };
src/robotaxi/pages/site-search/index.tsx
@@ -51,21 +51,6 @@
} from '../../constants/confirm-ride-report';
import { withRobotaxiWhitelist } from '../../../utils/whitelist';
/**
 * 安全解析路由关键字,兼容已编码和未编码两种入参。
 */
const decodeRouteKeyword = (keyword: unknown) => {
  const normalizedKeyword = String(keyword || '').trim();
  if (!normalizedKeyword) {
    return '';
  }
  try {
    return decodeURIComponent(normalizedKeyword);
  } catch (error) {
    return normalizedKeyword;
  }
};
function SiteSearchPage() {
  const [searchValue, setSearchValue] = useState('') //搜索值
  const [showAllHistory, setShowAllHistory] = useState(false) // 是否展示全部历史记录
@@ -74,7 +59,6 @@
  const [showTipPopup, setShowTipPopup] = useState(false)
  const [tipType, setTipType] = useState('')
  const [showFavoritePopup, setShowFavoritePopup] = useState(false)
  const hasAppliedInitialKeyword = useRef(false) // 是否已应用初始搜索关键字
  const hasReportedPickupPageView = useRef(false) // 上车点页页面浏览埋点是否已上报
  const hasReportedDropoffPageView = useRef(false) // 下车点页页面浏览埋点是否已上报
@@ -82,7 +66,6 @@
  const MAX_EXPANDED_COUNT = 10
  const router = Taro.useRouter();
  const initialKeyword = decodeRouteKeyword(router.params?.keyword);
  const {
    pageType,
    siteList,
@@ -117,15 +100,6 @@
      }
    }).catch(() => { });
  }, []);
  useEffect(() => {
    if (!initialKeyword || hasAppliedInitialKeyword.current) {
      return;
    }
    hasAppliedInitialKeyword.current = true;
    setSearchValue(initialKeyword);
    confirmSearch(initialKeyword);
  }, [initialKeyword, confirmSearch]);
  // 处理终点选择后的业务校验与跳转
  const handleEndSiteSelection = async (