feat: 恢复服务监控菜单入口

This commit is contained in:
zhanjunhao
2026-11-19 10:59:02 +08:00
parent 074c4422f9
commit f88a404fab
6 changed files with 219 additions and 54 deletions
+9 -4
View File
@@ -37,6 +37,8 @@ import {
Receipt,
} from 'lucide-react';
import { StatusContext } from '../../context/Status';
import { UserContext } from '../../context/User';
import { isSidebarModuleVisible } from '../../helpers/navigationVisibility';
import { useMarquee } from '../../hooks/common/useMarquee';
import PageBackground from '../../components/common/PageBackground';
import UserCenterSidebar from './UserCenterSidebar';
@@ -61,6 +63,8 @@ const MobileBottomNav = ({ sidebarConfig }) => {
const { t } = useTranslation();
const location = useLocation();
const navigate = useNavigate();
const [userState] = useContext(UserContext);
const userGroup = userState?.user?.group;
const navItems = [
{
@@ -116,8 +120,7 @@ const MobileBottomNav = ({ sidebarConfig }) => {
const inMiniProgram = isMiniProgramWebView();
const visibleNavItems = navItems.filter(
(item) =>
sidebarConfig?.enabled !== false &&
sidebarConfig?.[item.key] !== false &&
isSidebarModuleVisible(sidebarConfig, item.key, userGroup) &&
!(inMiniProgram && isMiniProgramPaymentPath(item.path)),
);
@@ -155,6 +158,8 @@ const MobileBottomNav = ({ sidebarConfig }) => {
const UserCenter = ({ keyManagementMode = false }) => {
const [statusState] = useContext(StatusContext);
const [userState] = useContext(UserContext);
const userGroup = userState?.user?.group;
// 仅用于页面外壳的样式标识(看板与子页面底色不同),不参与路由判断
const ucRoute = useLocation().pathname.split('/')[2] || 'dashboard';
@@ -192,7 +197,7 @@ const UserCenter = ({ keyManagementMode = false }) => {
: routePathMap[
userCenterRoutes.find(
(key) =>
userCenterConfig[key] !== false &&
isSidebarModuleVisible(userCenterConfig, key, userGroup) &&
!(
inMiniProgram &&
isMiniProgramPaymentPath(`/user-center/${routePathMap[key]}`)
@@ -203,7 +208,7 @@ const UserCenter = ({ keyManagementMode = false }) => {
? `/user-center/${firstVisiblePath}`
: '/';
const guardUserCenterRoute = (key, element) => {
if (userCenterConfig.enabled === false || userCenterConfig[key] === false) {
if (!isSidebarModuleVisible(userCenterConfig, key, userGroup)) {
return <Navigate to={firstVisibleRoute} replace />;
}
return element;