feat(platform): frame navigation around vehicle monitoring

This commit is contained in:
lingniu
2026-07-06 04:40:17 +08:00
parent aefd34bc59
commit 77c5730e77
2 changed files with 25 additions and 6 deletions

View File

@@ -29,11 +29,11 @@ export type CustomerView = {
const navGroups = [ const navGroups = [
{ {
title: '实时运营', title: '车辆监控',
audience: '客户', audience: '客户',
description: '地图看车、在线监控、异常优先', description: '地图看车、实时状态、异常优先',
items: [ items: [
{ itemKey: 'dashboard', text: '运营总览', icon: <IconHome /> }, { itemKey: 'dashboard', text: '车辆总览', icon: <IconHome /> },
{ itemKey: 'map', text: '实时地图', icon: <IconMapPin /> }, { itemKey: 'map', text: '实时地图', icon: <IconMapPin /> },
{ itemKey: 'realtime', text: '实时监控', icon: <IconActivity /> } { itemKey: 'realtime', text: '实时监控', icon: <IconActivity /> }
] ]

View File

@@ -52,8 +52,8 @@ test('renders vehicle platform shell', () => {
expect(screen.getByRole('button', { name: '客户主线 统计查询' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户主线 统计查询' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户主线 数据导出' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户主线 数据导出' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户主线 告警通知' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户主线 告警通知' })).toBeInTheDocument();
expect(screen.getByText('实时运营')).toBeInTheDocument(); expect(screen.getByText('车辆监控')).toBeInTheDocument();
expect(screen.getByText('地图看车、在线监控、异常优先')).toBeInTheDocument(); expect(screen.getByText('地图看车、实时状态、异常优先')).toBeInTheDocument();
expect(screen.getAllByText('车辆服务').length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText('车辆服务').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('按 VIN、车牌、手机号管理车辆')).toBeInTheDocument(); expect(screen.getByText('按 VIN、车牌、手机号管理车辆')).toBeInTheDocument();
expect(screen.getAllByText('轨迹统计').length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText('轨迹统计').length).toBeGreaterThanOrEqual(1);
@@ -67,10 +67,29 @@ test('renders vehicle platform shell', () => {
expect(screen.getByText('运维证据只在客户问题需要解释时展开,不作为客户默认入口。')).toBeInTheDocument(); expect(screen.getByText('运维证据只在客户问题需要解释时展开,不作为客户默认入口。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '展开内部证据区' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '展开内部证据区' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '内部证据区 运维质量' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '内部证据区 运维质量' })).toBeInTheDocument();
expect(screen.getAllByText('运营总览').length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText('车辆总览').length).toBeGreaterThanOrEqual(1);
expect(getComputedStyle(document.body).minWidth).not.toBe('1280px'); expect(getComputedStyle(document.body).minWidth).not.toBe('1280px');
}); });
test('sidebar frames the first navigation group as vehicle monitoring for customers', () => {
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
ok: true,
json: async () => ({
data: { items: [], total: 0, limit: 20, offset: 0, linkHealth: [], runtime: { requestTimeoutMs: 5000 } },
traceId: 'trace-test',
timestamp: 1783094400000
})
}) as Response);
render(<App />);
expect(screen.getByText('车辆监控')).toBeInTheDocument();
expect(screen.getByText('地图看车、实时状态、异常优先')).toBeInTheDocument();
expect(screen.getAllByText('车辆总览').length).toBeGreaterThanOrEqual(1);
expect(screen.queryByText('实时运营')).not.toBeInTheDocument();
expect(screen.queryByText('运营总览')).not.toBeInTheDocument();
});
test('dashboard opens with a customer vehicle service path instead of protocol entry points', async () => { test('dashboard opens with a customer vehicle service path instead of protocol entry points', async () => {
window.history.replaceState(null, '', '/#/dashboard'); window.history.replaceState(null, '', '/#/dashboard');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => { vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {