mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 16:46:19 +08:00
Compact main branch (#2255)
* init * init * fix: 修改外联路由打包bug * fix: sime * wip(lock): remove * fix: LOCK * fix: lock * init * feat: remove lock * chore: remove semi * chore: chore * chore: chore * chore: chore * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { resultSuccess, resultError, getRequestToken, requestParams } from '../_util';
|
||||
import { MockMethod } from 'vite-plugin-mock';
|
||||
import { createFakeUserList } from './user';
|
||||
import { resultSuccess, resultError, getRequestToken, requestParams } from '../_util'
|
||||
import { MockMethod } from 'vite-plugin-mock'
|
||||
import { createFakeUserList } from './user'
|
||||
|
||||
// single
|
||||
const dashboardRoute = {
|
||||
@@ -39,7 +39,7 @@ const dashboardRoute = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const backRoute = {
|
||||
path: 'back',
|
||||
@@ -66,7 +66,7 @@ const backRoute = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const authRoute = {
|
||||
path: '/permission',
|
||||
@@ -78,7 +78,7 @@ const authRoute = {
|
||||
title: 'routes.demo.permission.permission',
|
||||
},
|
||||
children: [backRoute],
|
||||
};
|
||||
}
|
||||
|
||||
const levelRoute = {
|
||||
path: '/level',
|
||||
@@ -134,7 +134,7 @@ const levelRoute = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const sysRoute = {
|
||||
path: '/system',
|
||||
@@ -176,16 +176,6 @@ const sysRoute = {
|
||||
},
|
||||
component: '/demo/system/role/index',
|
||||
},
|
||||
|
||||
{
|
||||
path: 'menu',
|
||||
name: 'MenuManagement',
|
||||
meta: {
|
||||
title: 'routes.demo.system.menu',
|
||||
ignoreKeepAlive: true,
|
||||
},
|
||||
component: '/demo/system/menu/index',
|
||||
},
|
||||
{
|
||||
path: 'dept',
|
||||
name: 'DeptManagement',
|
||||
@@ -205,7 +195,7 @@ const sysRoute = {
|
||||
component: '/demo/system/password/index',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const linkRoute = {
|
||||
path: '/link',
|
||||
@@ -233,7 +223,7 @@ const linkRoute = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default [
|
||||
{
|
||||
@@ -241,30 +231,30 @@ export default [
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: (request: requestParams) => {
|
||||
const token = getRequestToken(request);
|
||||
const token = getRequestToken(request)
|
||||
if (!token) {
|
||||
return resultError('Invalid token!');
|
||||
return resultError('Invalid token!')
|
||||
}
|
||||
const checkUser = createFakeUserList().find((item) => item.token === token);
|
||||
const checkUser = createFakeUserList().find((item) => item.token === token)
|
||||
if (!checkUser) {
|
||||
return resultError('Invalid user token!');
|
||||
return resultError('Invalid user token!')
|
||||
}
|
||||
const id = checkUser.userId;
|
||||
let menu: Object[];
|
||||
const id = checkUser.userId
|
||||
let menu: Object[]
|
||||
switch (id) {
|
||||
case '1':
|
||||
dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[0].path;
|
||||
menu = [dashboardRoute, authRoute, levelRoute, sysRoute, linkRoute];
|
||||
break;
|
||||
dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[0].path
|
||||
menu = [dashboardRoute, authRoute, levelRoute, sysRoute, linkRoute]
|
||||
break
|
||||
case '2':
|
||||
dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[1].path;
|
||||
menu = [dashboardRoute, authRoute, levelRoute, linkRoute];
|
||||
break;
|
||||
dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[1].path
|
||||
menu = [dashboardRoute, authRoute, levelRoute, linkRoute]
|
||||
break
|
||||
default:
|
||||
menu = [];
|
||||
menu = []
|
||||
}
|
||||
|
||||
return resultSuccess(menu);
|
||||
return resultSuccess(menu)
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
] as MockMethod[]
|
||||
|
Reference in New Issue
Block a user