添加个人中心及按角色展示内容
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user