From 8bd4cffec1bbe3a230db1f4c41222900e6222acb Mon Sep 17 00:00:00 2001 From: dushixiang Date: Sat, 24 Jan 2026 22:03:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Antd=20App=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E6=A0=BC=E6=BB=9A=E5=8A=A8=E6=9D=A1?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/App.css | 7 + web/src/admin/pages/AdminLayout/index.tsx | 312 +++++++++++----------- web/src/router/index.tsx | 2 +- 3 files changed, 165 insertions(+), 156 deletions(-) diff --git a/web/src/App.css b/web/src/App.css index 3db142d..afb03bb 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -1,6 +1,13 @@ +/* 亮色模式(默认) */ .ant-table-container .ant-table-body, .ant-table-container .ant-table-content { scrollbar-width: thin; scrollbar-color: #eaeaea transparent; scrollbar-gutter: stable; +} + +/* 暗黑模式 */ +.dark .ant-table-container .ant-table-body, +.dark .ant-table-container .ant-table-content { + scrollbar-color: #444 transparent; } \ No newline at end of file diff --git a/web/src/admin/pages/AdminLayout/index.tsx b/web/src/admin/pages/AdminLayout/index.tsx index ce692cf..13cb79c 100644 --- a/web/src/admin/pages/AdminLayout/index.tsx +++ b/web/src/admin/pages/AdminLayout/index.tsx @@ -1,7 +1,7 @@ import {type JSX, useEffect, useMemo, useRef, useState} from 'react'; import {Outlet, useLocation, useNavigate} from 'react-router-dom'; import type {MenuProps} from 'antd'; -import {App, Avatar, Button, ConfigProvider, Dropdown, Space, theme} from 'antd'; +import {App as AntApp, Avatar, Button, ConfigProvider, Dropdown, Space, theme} from 'antd'; import { Activity, AlertTriangle, @@ -36,7 +36,7 @@ const HEADER_HEIGHT = 56; const AdminLayout = () => { const navigate = useNavigate(); const location = useLocation(); - const {message: messageApi, modal} = App.useApp(); + const {message: messageApi, modal} = AntApp.useApp(); const [userInfo, setUserInfo] = useState(null); const [version, setVersion] = useState(); const [isDarkMode, setIsDarkMode] = useState(false); @@ -210,106 +210,107 @@ const AdminLayout = () => { algorithm: isDarkMode ? theme.darkAlgorithm : theme.defaultAlgorithm, }} > -
- {/* 顶部导航栏 */} -
-
-
-
- Logo { - e.currentTarget.src = '/logo.png'; - }} - /> -
-
-

{window.SystemConfig?.SystemNameZh}

-

控制台

-
-
- - - - - - - + + + + - - -
-
- - {/* 侧边栏 */} - - - {/* 主内容区 */} -
- {/* 内容区域 */} -
-
- + )}
-
-
+ - {/* 移动端底部导航栏 */} - -
+ {item.label} + + ); + })} + + + + ); }; diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx index 90f91b7..2cb7ff7 100644 --- a/web/src/router/index.tsx +++ b/web/src/router/index.tsx @@ -74,7 +74,7 @@ const router = createBrowserRouter([ path: '/admin', element: ( - {lazyLoad(AdminLayout)} + ), children: [