From 8069e352ef7e11ed52212a0e8ca071feaf13397a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E9=98=B3?= <3311118881@qq.com> Date: Sun, 18 Aug 2024 01:04:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B2=E6=9F=93=E8=B7=AF=E7=94=B1=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 202 +++++++--------- src/components/Sidebar/index.tsx | 402 ++++++++++++++----------------- src/pages/Route/index.tsx | 16 ++ 3 files changed, 275 insertions(+), 345 deletions(-) create mode 100644 src/pages/Route/index.tsx diff --git a/src/App.tsx b/src/App.tsx index 083d2eb..59a2d79 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -15,6 +15,7 @@ import Setup from './pages/Setup'; import Rss from './pages/Rss'; import Stats from './pages/Stats'; import Iterative from './pages/Iterative'; +import Page from './pages/Route' import Login from './pages/Login'; import DefaultLayout from './layout/DefaultLayout'; @@ -38,6 +39,76 @@ function App() { const isLoginRoute = pathname === '/login'; + // 路由列表 + const routes = [ + { + path: "/", + title: "仪表盘", + component: + }, + { + path: "/create", + title: "发挥灵感", + component: + }, + { + path: "/cate", + title: "分类管理", + component: + }, + { + path: "/article", + title: "文章管理", + component:
+ }, + { + path: "/tag", + title: "标签管理", + component: + }, + { + path: "/comment", + title: "评论管理", + component: + }, + { + path: "/web", + title: "网站管理", + component: + }, + { + path: "/swiper", + title: "轮播图管理", + component: + }, + { + path: "/setup", + title: "项目配置", + component: + }, + { + path: "/page", + title: "路由配置", + component: + }, + { + path: "/rss", + title: "订阅中心", + component: + }, + { + path: "/stats", + title: "数据可视化", + component: + }, + { + path: "/iter", + title: "项目更新记录", + component: + } + ]; + + return loading ? ( ) : ( @@ -64,125 +135,18 @@ function App() { ) : ( - - - - - } - /> - - - - - - } - /> - - - - - - } - /> - - - -
- - } - /> - - - - - - } - /> - - - - - - } - /> - - - - - - } - /> - - - - - - } - /> - - - - - - } - /> - - - - - - } - /> - - - - - - } - /> - - - - - - } - /> + {routes.map(({ path, title, component }) => ( + + + {component} + + } + /> + ))} )} diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index b034cbf..fdefb87 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -84,11 +84,127 @@ const Sidebar = ({ sidebarOpen, setSidebarOpen }: SidebarProps) => { } + // 路由列表 + const routes = [ + { + group: "Menu", + list: [ + { + to: "/", + path: "dashboard", + icon: , + name: "仪表盘" + }, + { + to: "/create", + path: "create", + icon: , + name: "创作" + }, + { + to: "#", + path: "manage", + icon: , + name: "管理", + subMenu: [ + { + to: "/article", + path: "article", + name: "文章管理" + }, + { + to: "/tag", + path: "tag", + name: "标签管理" + }, + { + to: "/comment", + path: "comment", + name: "评论管理" + }, + { + to: "/cate", + path: "cate", + name: "分类管理" + }, + { + to: "/web", + path: "web", + name: "网站管理" + }, + { + to: "/swiper", + path: "swiper", + name: "轮播图管理" + }, + { + to: "/user", + path: "user", + name: "用户管理" + } + ] + }, + { + to: "#", + path: "rights", + icon: , + name: "权限", + subMenu: [ + { + to: "/route", + path: "route", + name: "路由管理" + }, + { + to: "/role", + path: "role", + name: "角色管理" + }, + ] + }, + { + to: "/setup", + path: "setup", + icon: , + name: "系统" + } + ] + }, + { + group: "New", + list: [ + { + to: "/rss", + path: "rss", + icon: , + name: "订阅中心" + }, + { + to: "/chart", + path: "chart", + icon: , + name: "文件系统" + }, + { + to: "/stats", + path: "stats", + icon: , + name: "数据可视化" + }, + { + to: "/iter", + path: "iter", + icon: , + name: "更新日志" + } + ] + } + ]; + return ( diff --git a/src/pages/Route/index.tsx b/src/pages/Route/index.tsx new file mode 100644 index 0000000..77c9e78 --- /dev/null +++ b/src/pages/Route/index.tsx @@ -0,0 +1,16 @@ +import Title from '@/components/Title'; +import { Card } from 'antd'; + +const Home = () => { + return ( + <> + + + <Card className='mt-2'> + + </Card> + </> + ); +}; + +export default Home;