diff --git a/software/web/src/App.tsx b/software/web/src/App.tsx index 259db39..0ad62f7 100644 --- a/software/web/src/App.tsx +++ b/software/web/src/App.tsx @@ -31,7 +31,7 @@ function RequireAuth({ children }: { children: React.ReactNode }) { return null; // 等待恢复完成 } if (!isAuthenticated) { - return ; + return ; } return <>{children}; } @@ -40,7 +40,7 @@ function RequireAuth({ children }: { children: React.ReactNode }) { function RedirectIfAuth({ children }: { children: React.ReactNode }) { const { isAuthenticated } = useAuthStore(); if (isAuthenticated) { - return ; + return ; } return <>{children}; } @@ -54,7 +54,7 @@ export default function App() { }, [restore]); return ( - + {/* 登录页 */} {/* 默认重定向到 Dashboard */} - } /> + } /> ); diff --git a/software/web/src/layouts/AdminLayout.tsx b/software/web/src/layouts/AdminLayout.tsx index 7c4fee9..6883816 100644 --- a/software/web/src/layouts/AdminLayout.tsx +++ b/software/web/src/layouts/AdminLayout.tsx @@ -81,7 +81,7 @@ export default function AdminLayout() { const handleLogout = () => { logout(); - navigate('login'); + navigate('/login'); }; const dropList = ( diff --git a/software/web/src/pages/Login.tsx b/software/web/src/pages/Login.tsx index 21b18f4..5490025 100644 --- a/software/web/src/pages/Login.tsx +++ b/software/web/src/pages/Login.tsx @@ -16,7 +16,7 @@ export default function Login() { try { await login(values); Message.success('登录成功'); - navigate('dashboard', { replace: true }); + navigate('/dashboard', { replace: true }); } catch { Message.error('手机号或密码错误'); } finally { diff --git a/software/web/src/pages/devices/cabinet.tsx b/software/web/src/pages/devices/cabinet.tsx index 402b386..68ff9e7 100644 --- a/software/web/src/pages/devices/cabinet.tsx +++ b/software/web/src/pages/devices/cabinet.tsx @@ -138,7 +138,7 @@ export default function CabinetDetail() {