添加个人中心及按角色展示内容

This commit is contained in:
2026-03-11 16:12:00 +08:00
parent 4df88ea502
commit 2056f69c3e
45 changed files with 1108 additions and 23 deletions

View File

@@ -29,6 +29,8 @@ export type RouteRecord = {
/**
* 菜单分组类型
*/
import { hasAdminModuleAccess } from '@/layouts/admin/utils/role.uts'
export type MenuGroup = {
id: string
title: string
@@ -232,8 +234,17 @@ export const routes: RouteRecord[] = [
},
// ========== 用户模块 ==========
{
id: 'user_statistic',
// ========== 个人中心 ==========
{
id: 'home_user_center',
title: '个人中心',
path: '/pages/mall/admin/userCenter/index',
componentKey: 'UserCenter',
order: 100
},
{
id: 'user_statistic',
title: '用户统计',
path: '/pages/mall/admin/user/statistics/index',
componentKey: 'UserStatistic',
@@ -1175,7 +1186,10 @@ export const routes: RouteRecord[] = [
* 获取所有一级菜单
*/
export function getTopMenus(): TopMenu[] {
return topMenus.sort((a, b) => a.order - b.order)
// 基于 role 的模块过滤
return topMenus
.filter(m => hasAdminModuleAccess(m.id))
.sort((a, b) => a.order - b.order)
}
/**