Merge branch 'PingChuan' into shiy-login

# Conflicts:
#	app/config/api-config.ts
fix: 1. 修复无法加载数据的问题:没有从入口页中进来会缺少数据。
2. 加强后端接口关于token的校验错误和权限校验错误的管理。

feat: 1. 对接后端的数据看板的接口。
2. 将系统设置单独抽出来作为管理员的固定一个入口。
This commit is contained in:
2025-11-22 15:57:22 +08:00
27 changed files with 1972 additions and 643 deletions
+31 -8
View File
@@ -90,12 +90,16 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
fetchUserRoutes();
}, [userRole, frontendJWT, navigate]);
// 从 sessionStorage 读取当前选中的模块名称和图片路径
// 🔑 检查是否处于系统设置模式
const [isSettingsMode, setIsSettingsMode] = useState<boolean>(false);
// 从 sessionStorage 读取当前选中的模块名称和图片路径,以及系统设置模式标志
useEffect(() => {
if (typeof window !== 'undefined') {
try {
const moduleName = sessionStorage.getItem('selectedModuleName');
const modulePicPath = sessionStorage.getItem('selectedModulePicPath');
const settingsMode = sessionStorage.getItem('settingsMode');
if (moduleName) {
setSelectedModuleName(moduleName);
@@ -106,6 +110,14 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
setSelectedModulePicPath(modulePicPath);
console.log('🖼️ [Sidebar] 模块图片路径:', modulePicPath);
}
// 🔑 检查是否处于系统设置模式
if (settingsMode === 'true') {
setIsSettingsMode(true);
console.log('⚙️ [Sidebar] 进入系统设置模式');
} else {
setIsSettingsMode(false);
}
} catch (error) {
console.error('❌ [Sidebar] 读取 sessionStorage 失败:', error);
}
@@ -154,19 +166,30 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
// console.log('子菜单点击:', child.title, '路径:', child.path);
};
const isPort51707 = typeof window !== 'undefined' && window.location.port === '51707'
// const isPort51707 = typeof window !== 'undefined' && window.location.port === '51707'
// 处理菜单项:清理子菜单结构
const processedMenuItems: MenuItem[] = menuItems.filter(item =>{
// console.log('菜单项:', item.title, 'Icon:', item.icon)
// 如果是省局访问
if(isPort51707){
if (selectedModuleName === '智慧法务大模型'){
return item.path && item.path.startsWith('/chat-with-llm')
}
return item.path && item.path.startsWith('/cross-checking')
// 🔑 优先检查:如果处于系统设置模式,只显示 /settings 及其子路由
if (isSettingsMode) {
return item.path === '/settings' || item.path?.startsWith('/settings/');
}
// 🔑 重要:非系统设置模式下,隐藏所有 /settings 相关菜单
if (item.path === '/settings' || item.path?.startsWith('/settings/')) {
return false;
}
// 如果是省局访问
// if(isPort51707){
// if (selectedModuleName === '智慧法务大模型'){
// return item.path && item.path.startsWith('/chat-with-llm')
// }
// return item.path && item.path.startsWith('/cross-checking')
// }
// 🔑 如果选择了"智慧法务大模型",只显示 /chat-with-llm 相关菜单
if (selectedModuleName === '智慧法务大模型') {
return item.path === '/chat-with-llm' || item.path?.startsWith('/chat-with-llm/');