2026-04-17 17:20:41 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
import { createBrowserRouter } from 'react-router-dom';
|
|
|
|
|
import Layout from '../components/Layout';
|
|
|
|
|
import ProtectedRoute from '../components/ProtectedRoute';
|
|
|
|
|
import Login from '../pages/Login';
|
|
|
|
|
import Home from '../pages/Home';
|
|
|
|
|
import Devices from '../pages/Devices';
|
|
|
|
|
import VideoControl from '../pages/Video';
|
|
|
|
|
import Alerts from '../pages/Alerts';
|
|
|
|
|
import Downloads from '../pages/Downloads';
|
|
|
|
|
import Roles from '../pages/Roles';
|
|
|
|
|
import Users from '../pages/Users';
|
2026-04-21 08:51:57 +08:00
|
|
|
import SerialNumGenerate from '../pages/SerialNumGenerate';
|
2026-04-22 09:43:55 +08:00
|
|
|
import MenuList from '../pages/MenuList';
|
2026-04-17 17:20:41 +08:00
|
|
|
|
|
|
|
|
export const router = createBrowserRouter([
|
2026-04-21 08:51:57 +08:00
|
|
|
{
|
|
|
|
|
path: '/login',
|
|
|
|
|
element: <Login />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
element: <ProtectedRoute />,
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '/',
|
|
|
|
|
element: <Layout />,
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
index: true,
|
|
|
|
|
element: <Home />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'devices',
|
|
|
|
|
element: <Devices />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'video',
|
|
|
|
|
element: <VideoControl />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'alerts',
|
|
|
|
|
element: <Alerts />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'downloads',
|
|
|
|
|
element: <Downloads />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'roles',
|
|
|
|
|
element: <Roles />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'users',
|
|
|
|
|
element: <Users />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'serialNumGenerate',
|
|
|
|
|
element: <SerialNumGenerate />,
|
|
|
|
|
},
|
2026-04-22 09:43:55 +08:00
|
|
|
{
|
|
|
|
|
path: 'menuList',
|
|
|
|
|
element: <MenuList />,
|
|
|
|
|
},
|
2026-04-21 08:51:57 +08:00
|
|
|
{
|
|
|
|
|
path: '*',
|
|
|
|
|
element: <div className="p-10 text-center font-bold text-gray-400">模块开发中...</div>,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-04-17 17:20:41 +08:00
|
|
|
]);
|