feat(platform): route vehicle searches to detail

This commit is contained in:
lingniu
2026-07-03 21:37:32 +08:00
parent d4bd70fdf4
commit 92d7020b36
4 changed files with 56 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
import { Badge, Button, Input, Nav, Space, Tag, Typography } from '@douyinfe/semi-ui';
import { Badge, Button, Input, Nav, Space, Tag, Toast, Typography } from '@douyinfe/semi-ui';
import {
IconActivity,
IconBarChartHStroked,
@@ -10,6 +10,7 @@ import {
IconSetting
} from '@douyinfe/semi-icons';
import type { ReactNode } from 'react';
import { useState } from 'react';
export type PageKey = 'dashboard' | 'vehicles' | 'realtime' | 'detail' | 'history' | 'mileage' | 'quality';
@@ -26,12 +27,25 @@ const navItems = [
export function AppShell({
activePage,
onChange,
onVehicleSearch,
children
}: {
activePage: PageKey;
onChange: (page: PageKey) => void;
onVehicleSearch: (keyword: string) => void;
children: ReactNode;
}) {
const [keyword, setKeyword] = useState('');
const search = () => {
const value = keyword.trim();
if (!value) {
Toast.warning('请输入 VIN / 车牌 / 手机号');
return;
}
onVehicleSearch(value);
};
return (
<div className="vp-app">
<div className="vp-shell">
@@ -50,8 +64,15 @@ export function AppShell({
<main className="vp-main">
<header className="vp-topbar">
<Space spacing={12}>
<Input prefix={<IconSearch />} placeholder="搜索 VIN / 车牌 / 手机号" style={{ width: 320 }} />
<Button theme="solid" type="primary"></Button>
<Input
prefix={<IconSearch />}
placeholder="搜索 VIN / 车牌 / 手机号"
value={keyword}
onChange={setKeyword}
onEnterPress={search}
style={{ width: 320 }}
/>
<Button theme="solid" type="primary" onClick={search}></Button>
</Space>
<Space spacing={12}>
<Tag color="blue"></Tag>