feat(platform-web): preserve protocol in vehicle links

This commit is contained in:
lingniu
2026-07-04 01:15:39 +08:00
parent 8e5cb5b8c7
commit 657674f233
4 changed files with 41 additions and 15 deletions

View File

@@ -21,14 +21,18 @@ const sourceCapabilities: Array<{ key: keyof Pick<VehicleSourceStatus, 'hasRealt
export function VehicleDetail({
vin,
protocol,
onOpenHistory,
onOpenMileage
onOpenMileage,
onQueryChange
}: {
vin: string;
protocol?: string;
onOpenHistory: (vin: string) => void;
onOpenMileage: (vin: string) => void;
onQueryChange?: (keyword: string, protocol?: string) => void;
}) {
const [query, setQuery] = useState<VehicleQuery>({ keyword: vin });
const [query, setQuery] = useState<VehicleQuery>({ keyword: vin, protocol });
const [detail, setDetail] = useState<VehicleDetailData | null>(null);
const [loading, setLoading] = useState(false);
const requestSeq = useRef(0);
@@ -65,10 +69,10 @@ export function VehicleDetail({
};
useEffect(() => {
const nextQuery = { keyword: vin };
const nextQuery = { keyword: vin, protocol };
setQuery(nextQuery);
load(nextQuery);
}, [vin]);
}, [vin, protocol]);
const identity = detail?.identity;
const summary = detail?.realtimeSummary;
@@ -107,6 +111,7 @@ export function VehicleDetail({
<Form key={formKey} initValues={query} layout="horizontal" onSubmit={(values) => {
const nextQuery = { keyword: String(values.keyword ?? ''), protocol: String(values.protocol ?? '') };
setQuery(nextQuery);
onQueryChange?.(nextQuery.keyword, nextQuery.protocol);
load(nextQuery);
}}>
<Form.Input field="keyword" label="车辆关键词" placeholder="VIN / 车牌 / 手机号" style={{ width: 280 }} />