From c61bfab2ba72a2da33ade7f00da42749e8a79187 Mon Sep 17 00:00:00 2001 From: Gavan <994259213@qq.com> Date: Wed, 23 Jul 2025 18:22:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A8=A1=E5=9E=8B=E6=9C=AA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE,=E6=B7=BB=E5=8A=A0=E7=A6=81=E7=94=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD,=20=E4=BF=AE=E5=A4=8D=E5=AF=B9=E8=AF=9D=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=BB=9A=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/sidebar/index.tsx | 24 ++++- ui/src/context/index.tsx | 15 ++- ui/src/main.tsx | 91 ++++++++++++++---- ui/src/pages/chat/index.tsx | 22 ++++- ui/src/pages/dashboard/index.tsx | 1 + ui/src/pages/model/components/modelCard.tsx | 101 ++++++++++---------- ui/src/pages/model/index.tsx | 42 +++++++- ui/src/pages/user-management/index.tsx | 3 +- ui/src/pages/user/dashboard/index.tsx | 1 + 9 files changed, 223 insertions(+), 77 deletions(-) diff --git a/ui/src/components/sidebar/index.tsx b/ui/src/components/sidebar/index.tsx index afe9148..384d1cb 100644 --- a/ui/src/components/sidebar/index.tsx +++ b/ui/src/components/sidebar/index.tsx @@ -6,6 +6,7 @@ import { Modal } from '@c-x/ui'; import { useMemo, useState } from 'react'; import Qrcode from '@/assets/images/qrcode.png'; import Version from './version'; +import { useCommonContext } from '@/hooks/context'; const ADMIN_MENUS = [ { @@ -14,6 +15,7 @@ const ADMIN_MENUS = [ pathname: 'dashboard', icon: 'icon-yibiaopan', show: true, + disabled: false, }, { label: '对话记录', @@ -21,6 +23,7 @@ const ADMIN_MENUS = [ pathname: 'chat', icon: 'icon-duihuajilu1', show: true, + disabled: false, }, { label: '补全记录', @@ -28,6 +31,7 @@ const ADMIN_MENUS = [ pathname: 'completion', icon: 'icon-buquanjilu', show: true, + disabled: false, }, { label: '代码安全', @@ -35,6 +39,7 @@ const ADMIN_MENUS = [ pathname: 'code-security', icon: 'icon-daimaanquan1', show: true, + disabled: false, }, { label: '模型管理', @@ -42,6 +47,7 @@ const ADMIN_MENUS = [ pathname: 'model', icon: 'icon-moxingguanli', show: true, + disabled: false, }, { label: '成员管理', @@ -49,6 +55,7 @@ const ADMIN_MENUS = [ pathname: 'user-management', icon: 'icon-yonghuguanli1', show: true, + disabled: false, }, { label: '管理员', @@ -56,6 +63,7 @@ const ADMIN_MENUS = [ pathname: 'admin', icon: 'icon-guanliyuan1', show: true, + disabled: false, }, ]; @@ -66,6 +74,7 @@ const USER_MENUS = [ pathname: '/user/dashboard', icon: 'icon-yibiaopan', show: true, + disabled: false, }, { label: '对话记录', @@ -73,6 +82,7 @@ const USER_MENUS = [ pathname: '/user/chat', icon: 'icon-duihuajilu1', show: true, + disabled: false, }, { label: '补全记录', @@ -80,6 +90,7 @@ const USER_MENUS = [ pathname: '/user/completion', icon: 'icon-buquanjilu', show: true, + disabled: false, }, // { // label: '设置', @@ -111,12 +122,15 @@ const Sidebar = () => { const { pathname } = useLocation(); const theme = useTheme(); const [showQrcode, setShowQrcode] = useState(false); + const { isConfigModel } = useCommonContext(); const menus = useMemo(() => { if (pathname.startsWith('/user/')) { return USER_MENUS; } - return ADMIN_MENUS; - }, [pathname]); + return isConfigModel + ? ADMIN_MENUS.map((item) => ({ ...item, disabled: false })) + : ADMIN_MENUS.map((item) => ({ ...item, disabled: true })); + }, [pathname, isConfigModel]); return ( { zIndex: isActive ? 2 : 1, color: isActive ? '#FFFFFF' : 'text.primary', }} + onClick={(e) => { + if (it.disabled) { + e.preventDefault(); + } + }} >