2020-09-28 20:19:10 +08:00
|
|
|
import { resultSuccess } from '../_util';
|
|
|
|
import { MockMethod } from 'vite-plugin-mock';
|
|
|
|
|
2020-12-03 21:49:32 +08:00
|
|
|
// single
|
2020-09-28 20:19:10 +08:00
|
|
|
const dashboardRoute = {
|
2020-12-03 21:49:32 +08:00
|
|
|
path: '/home',
|
|
|
|
name: 'Home',
|
|
|
|
component: '/dashboard/welcome/index',
|
2020-11-09 01:08:43 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.dashboard.welcome',
|
|
|
|
affix: true,
|
2020-11-09 01:08:43 +08:00
|
|
|
icon: 'ant-design:home-outlined',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const frontRoute = {
|
2020-12-03 21:49:32 +08:00
|
|
|
path: 'front',
|
2020-09-28 20:19:10 +08:00
|
|
|
name: 'PermissionFrontDemo',
|
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.front',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'page',
|
2020-12-01 21:33:32 +08:00
|
|
|
name: 'FrontPageAuth',
|
2020-11-08 23:13:47 +08:00
|
|
|
component: '/demo/permission/front/index',
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.frontPage',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'btn',
|
2020-12-01 21:33:32 +08:00
|
|
|
name: 'FrontBtnAuth',
|
2020-11-08 23:13:47 +08:00
|
|
|
component: '/demo/permission/front/Btn',
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.frontBtn',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'auth-pageA',
|
2020-12-01 21:33:32 +08:00
|
|
|
name: 'FrontAuthPageA',
|
2020-11-08 23:13:47 +08:00
|
|
|
component: '/demo/permission/front/AuthPageA',
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.frontTestA',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'auth-pageB',
|
2020-12-01 21:33:32 +08:00
|
|
|
name: 'FrontAuthPageB',
|
2020-11-08 23:13:47 +08:00
|
|
|
component: '/demo/permission/front/AuthPageB',
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.frontTestB',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
const backRoute = {
|
2020-12-03 21:49:32 +08:00
|
|
|
path: 'back',
|
2020-09-28 20:19:10 +08:00
|
|
|
name: 'PermissionBackDemo',
|
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.back',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
2020-12-03 21:49:32 +08:00
|
|
|
|
2020-09-28 20:19:10 +08:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'page',
|
2020-12-01 21:33:32 +08:00
|
|
|
name: 'BackAuthPage',
|
2020-11-08 23:13:47 +08:00
|
|
|
component: '/demo/permission/back/index',
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.backPage',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'btn',
|
2020-12-01 21:33:32 +08:00
|
|
|
name: 'BackAuthBtn',
|
2020-11-08 23:13:47 +08:00
|
|
|
component: '/demo/permission/back/Btn',
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
title: 'routes.demo.permission.backBtn',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
const authRoute = {
|
2020-11-09 01:08:43 +08:00
|
|
|
path: '/permission',
|
|
|
|
name: 'Permission',
|
2020-12-03 21:49:32 +08:00
|
|
|
component: 'LAYOUT',
|
2020-11-09 01:08:43 +08:00
|
|
|
redirect: '/permission/front/page',
|
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
icon: 'carbon:user-role',
|
|
|
|
title: 'routes.demo.permission.permission',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
2020-11-09 01:08:43 +08:00
|
|
|
children: [frontRoute, backRoute],
|
2020-09-28 20:19:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const authRoute1 = {
|
2020-11-09 01:08:43 +08:00
|
|
|
path: '/permission',
|
|
|
|
name: 'Permission',
|
2020-12-03 21:49:32 +08:00
|
|
|
component: 'LAYOUT',
|
2020-11-09 01:08:43 +08:00
|
|
|
redirect: '/permission/front/page',
|
|
|
|
meta: {
|
2020-12-03 21:49:32 +08:00
|
|
|
icon: 'carbon:user-role',
|
|
|
|
title: 'routes.demo.permission.permission',
|
2020-09-28 20:19:10 +08:00
|
|
|
},
|
2020-11-09 01:08:43 +08:00
|
|
|
children: [backRoute],
|
2020-09-28 20:19:10 +08:00
|
|
|
};
|
2020-12-03 21:49:32 +08:00
|
|
|
|
|
|
|
const levelRoute = {
|
|
|
|
path: '/level',
|
|
|
|
name: 'Level',
|
|
|
|
component: 'LAYOUT',
|
|
|
|
redirect: '/level/menu1/menu1-1',
|
|
|
|
meta: {
|
|
|
|
icon: 'carbon:user-role',
|
|
|
|
title: 'routes.demo.level.level',
|
|
|
|
},
|
|
|
|
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'menu1',
|
|
|
|
name: 'Menu1Demo',
|
|
|
|
meta: {
|
|
|
|
title: 'Menu1',
|
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'menu1-1',
|
|
|
|
name: 'Menu11Demo',
|
|
|
|
meta: {
|
|
|
|
title: 'Menu1-1',
|
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'menu1-1-1',
|
|
|
|
name: 'Menu111Demo',
|
|
|
|
component: '/demo/level/Menu111',
|
|
|
|
meta: {
|
|
|
|
title: 'Menu111',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'menu1-2',
|
|
|
|
name: 'Menu12Demo',
|
|
|
|
component: '/demo/level/Menu12',
|
|
|
|
meta: {
|
|
|
|
title: 'Menu1-2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'menu2',
|
|
|
|
name: 'Menu2Demo',
|
|
|
|
component: '/demo/level/Menu2',
|
|
|
|
meta: {
|
|
|
|
title: 'Menu2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2020-09-28 20:19:10 +08:00
|
|
|
export default [
|
|
|
|
{
|
|
|
|
url: '/api/getMenuListById',
|
|
|
|
timeout: 1000,
|
|
|
|
method: 'get',
|
|
|
|
response: ({ query }) => {
|
|
|
|
const { id } = query;
|
|
|
|
if (!id || id === '1') {
|
2020-12-03 21:49:32 +08:00
|
|
|
return resultSuccess([dashboardRoute, authRoute, levelRoute]);
|
2020-09-28 20:19:10 +08:00
|
|
|
}
|
|
|
|
if (id === '2') {
|
2020-12-03 21:49:32 +08:00
|
|
|
return resultSuccess([dashboardRoute, authRoute1, levelRoute]);
|
2020-09-28 20:19:10 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
] as MockMethod[];
|