36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
|
|
|
|
import AppLayout from "./components/layout/AppLayout";
|
|
import ScanPage from "./pages/ScanPage";
|
|
import MyTasksPage from "./pages/MyTasksPage";
|
|
import NotificationsPage from "./pages/NotificationsPage";
|
|
import ProfilePage from "./pages/ProfilePage";
|
|
|
|
import AdminLayout from "./components/layout/AdminLayout";
|
|
import AdminDashboard from "./pages/admin/AdminDashboard";
|
|
import AdminProductsPage from "./pages/admin/AdminProductsPage";
|
|
|
|
export default function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<Routes>
|
|
{/* 移动端 */}
|
|
<Route path="/" element={<Navigate to="/scan" replace />} />
|
|
<Route element={<AppLayout />}>
|
|
<Route path="/scan" element={<ScanPage />} />
|
|
<Route path="/tasks" element={<MyTasksPage />} />
|
|
<Route path="/notifications" element={<NotificationsPage />} />
|
|
<Route path="/profile" element={<ProfilePage />} />
|
|
</Route>
|
|
|
|
{/* PC 管理端 */}
|
|
<Route path="/admin" element={<Navigate to="/admin/dashboard" replace />} />
|
|
<Route element={<AdminLayout />}>
|
|
<Route path="/admin/dashboard" element={<AdminDashboard />} />
|
|
<Route path="/admin/products" element={<AdminProductsPage />} />
|
|
</Route>
|
|
</Routes>
|
|
</BrowserRouter>
|
|
);
|
|
}
|