feat: 普通用户静态路由定义
This commit is contained in:
@@ -212,3 +212,77 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
/**自定义静态菜单 */
|
||||
export const customRoutes: GeneratedRoute[] = [
|
||||
{
|
||||
name: 'endpoint',
|
||||
path: '/endpoint',
|
||||
component: 'layout.base',
|
||||
meta: {
|
||||
title: '终端设备',
|
||||
i18nKey: 'view.endpoint',
|
||||
icon: 'icon-park-outline:all-application',
|
||||
order: 11,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'endpoint_access',
|
||||
path: '/endpoint/access',
|
||||
component: 'view.endpoint_access',
|
||||
meta: {
|
||||
title: '当前',
|
||||
i18nKey: 'view.endpoint_access',
|
||||
icon: 'material-symbols:filter-list-off',
|
||||
order: 1
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'endpoint_records',
|
||||
path: '/endpoint/records',
|
||||
component: 'view.endpoint_records',
|
||||
meta: {
|
||||
title: '历史',
|
||||
i18nKey: 'view.endpoint_records',
|
||||
icon: 'ic:round-supervisor-account',
|
||||
order: 3,
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'billing',
|
||||
path: '/billing',
|
||||
component: 'layout.base',
|
||||
meta: {
|
||||
title: '账单',
|
||||
i18nKey: 'view.billing',
|
||||
icon: 'icon-park-outline:all-application',
|
||||
order: 13,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'billing_histories',
|
||||
path: '/billing/histories',
|
||||
component: 'view.billing_histories',
|
||||
meta: {
|
||||
title: '历史查询',
|
||||
i18nKey: 'view.billing_histories',
|
||||
icon: 'material-symbols:filter-list-off',
|
||||
order: 2
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'set-meal',
|
||||
path: '/set-meal',
|
||||
component: 'layout.base$view.set-meal',
|
||||
meta: {
|
||||
title: '套餐',
|
||||
i18nKey: 'view.set-meal',
|
||||
icon: 'icon-park-outline:all-application',
|
||||
order: 15,
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type {ElegantConstRoute} from '@elegant-router/types';
|
||||
import {generatedRoutes} from '../elegant/routes';
|
||||
import {customRoutes, generatedRoutes} from '../elegant/routes';
|
||||
import {transformElegantRoutesToVueRoutes} from '../elegant/transform';
|
||||
|
||||
/** create routes when the auth route mode is static */
|
||||
@@ -8,7 +8,7 @@ export function createStaticRoutes() {
|
||||
|
||||
const authRoutes: any[] = [];
|
||||
|
||||
generatedRoutes.forEach(item => {
|
||||
[...generatedRoutes, ...customRoutes].forEach(item => {
|
||||
if (item.meta?.constant) {
|
||||
constantRoutes.push(item);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user