From 4eca31f8eb375113cf004ecfa96e707af4205aaa Mon Sep 17 00:00:00 2001
From: simonkoson <28867558@qq.com>
Date: Thu, 21 May 2026 19:47:21 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20SideNav=20=E6=8C=89=20role=20=E8=BF=87?=
=?UTF-8?q?=E6=BB=A4=E8=8F=9C=E5=8D=95=EF=BC=8C/users=20=E4=BB=85=20zhipia?=
=?UTF-8?q?nren=EF=BC=8C/editor-desk=20=E4=BB=85=20zhipianren+zebian?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/Layout/SideNav.jsx | 35 +++++++++++++++-------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/frontend/src/components/Layout/SideNav.jsx b/frontend/src/components/Layout/SideNav.jsx
index 1782193..c21b2d0 100644
--- a/frontend/src/components/Layout/SideNav.jsx
+++ b/frontend/src/components/Layout/SideNav.jsx
@@ -8,19 +8,34 @@ import {
UserOutlined,
TeamOutlined,
} from '@ant-design/icons'
-
-const menuItems = [
- { key: '/dashboard', icon: , label: '仪表盘' },
- { key: '/tps', icon: , label: 'TPS 选题策划' },
- { key: '/knowledge', icon: , label: '知识库' },
- { key: '/doco', icon: , label: '文稿对齐' },
- { key: '/editor-home', icon: , label: '个人首页' },
- { key: '/users', icon: , label: '用户管理' },
-]
+import useAuthStore from '../../stores/authStore'
function SideNav() {
const navigate = useNavigate()
const location = useLocation()
+ const { user } = useAuthStore()
+
+ const allMenuItems = [
+ { key: '/dashboard', icon: , label: '仪表盘' },
+ { key: '/editor-desk', icon: , label: '责编录入' },
+ { key: '/tps', icon: , label: 'TPS 选题策划' },
+ { key: '/knowledge', icon: , label: '知识库' },
+ { key: '/doco', icon: , label: '文稿对齐' },
+ { key: '/editor-home', icon: , label: '个人首页' },
+ { key: '/users', icon: , label: '用户管理' },
+ ]
+
+ // 按角色过滤菜单项
+ const visibleItems = allMenuItems.filter(item => {
+ // /dashboard 三角色都可见
+ if (item.key === '/dashboard') return true
+ // /users 仅 zhipianren
+ if (item.key === '/users') return user?.role === 'zhipianren'
+ // /editor-desk 仅 zhipianren + zebian
+ if (item.key === '/editor-desk') return user?.role === 'zhipianren' || user?.role === 'zebian'
+ // 其余三角色都可见(保留后期 Phase 入口)
+ return true
+ })
return (
@@ -31,7 +46,7 @@ function SideNav() {