diff --git a/frontend/js/app.js b/frontend/js/app.js index a77e6d6..9b0bb61 100755 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -106,6 +106,16 @@ planMenu.style.display = 'none'; } } + + // 财务管理菜单(仅超级管理员) + const financeMenu = document.querySelector('[data-menu="finance"]'); + if (financeMenu) { + if (user && user.role === 'superadmin') { + financeMenu.style.display = ''; + } else { + financeMenu.style.display = 'none'; + } + } } // 高亮当前活动的导航项 @@ -179,10 +189,14 @@ try { currentUser = await API.me().catch(() => null); if (!currentUser || !currentUser.username) { - // 未登录,重定向到独立登录页面 window.location.href = './login.html'; return; } + // 财务管理仅超级管理员可访问 + if ((path === '#/finance' || path === '/finance') && currentUser.role !== 'superadmin') { + window.location.hash = '#/'; + return; + } } catch(e) {} });