From df44a959f55dc1230d79277b69ae1c37c68fc2c0 Mon Sep 17 00:00:00 2001
From: 12451 <12451@example.com>
Date: Thu, 2 Jul 2026 18:40:56 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20BrowserRouter=E6=B7=BB=E5=8A=A0basename?=
=?UTF-8?q?=3D/pms=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=97=A0=E9=99=90=E5=BE=AA?=
=?UTF-8?q?=E7=8E=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
software/web/src/App.tsx | 8 ++++----
software/web/src/layouts/AdminLayout.tsx | 2 +-
software/web/src/pages/Login.tsx | 2 +-
software/web/src/pages/devices/cabinet.tsx | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
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() {
}
- onClick={() => navigate('devices')}
+ onClick={() => navigate('/devices')}
>
返回