187 lines
4.2 KiB
TypeScript
187 lines
4.2 KiB
TypeScript
export interface UserInfo {
|
|
id: number;
|
|
password: string;
|
|
realName: string;
|
|
roles: string[];
|
|
username: string;
|
|
}
|
|
|
|
export const MOCK_USERS: UserInfo[] = [
|
|
{
|
|
id: 0,
|
|
password: '123456',
|
|
realName: 'Vben',
|
|
roles: ['super'],
|
|
username: 'vben',
|
|
},
|
|
{
|
|
id: 1,
|
|
password: '123456',
|
|
realName: 'Admin',
|
|
roles: ['admin'],
|
|
username: 'admin',
|
|
},
|
|
{
|
|
id: 2,
|
|
password: '123456',
|
|
realName: 'Jack',
|
|
roles: ['user'],
|
|
username: 'jack',
|
|
},
|
|
];
|
|
|
|
export const MOCK_CODES = [
|
|
// super
|
|
{
|
|
codes: ['AC_100100', 'AC_100110', 'AC_100120', 'AC_100010'],
|
|
username: 'vben',
|
|
},
|
|
{
|
|
// admin
|
|
codes: ['AC_100010', 'AC_100020', 'AC_100030'],
|
|
username: 'admin',
|
|
},
|
|
{
|
|
// user
|
|
codes: ['AC_1000001', 'AC_1000002'],
|
|
username: 'jack',
|
|
},
|
|
];
|
|
|
|
const dashboardMenus = [
|
|
{
|
|
component: 'BasicLayout',
|
|
meta: {
|
|
order: -1,
|
|
title: 'page.dashboard.title',
|
|
},
|
|
name: 'Dashboard',
|
|
path: '/',
|
|
redirect: '/analytics',
|
|
children: [
|
|
{
|
|
name: 'Analytics',
|
|
path: '/analytics',
|
|
component: '/dashboard/analytics/index',
|
|
meta: {
|
|
affixTab: true,
|
|
title: 'page.dashboard.analytics',
|
|
},
|
|
},
|
|
{
|
|
name: 'Workspace',
|
|
path: '/workspace',
|
|
component: '/dashboard/workspace/index',
|
|
meta: {
|
|
title: 'page.dashboard.workspace',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
const createDemosMenus = (role: 'admin' | 'super' | 'user') => {
|
|
const roleWithMenus = {
|
|
admin: {
|
|
component: '/demos/access/admin-visible',
|
|
meta: {
|
|
icon: 'mdi:button-cursor',
|
|
title: 'demos.access.adminVisible',
|
|
},
|
|
name: 'AccessAdminVisibleDemo',
|
|
path: '/demos/access/admin-visible',
|
|
},
|
|
super: {
|
|
component: '/demos/access/super-visible',
|
|
meta: {
|
|
icon: 'mdi:button-cursor',
|
|
title: 'demos.access.superVisible',
|
|
},
|
|
name: 'AccessSuperVisibleDemo',
|
|
path: '/demos/access/super-visible',
|
|
},
|
|
user: {
|
|
component: '/demos/access/user-visible',
|
|
meta: {
|
|
icon: 'mdi:button-cursor',
|
|
title: 'demos.access.userVisible',
|
|
},
|
|
name: 'AccessUserVisibleDemo',
|
|
path: '/demos/access/user-visible',
|
|
},
|
|
};
|
|
|
|
return [
|
|
{
|
|
component: 'BasicLayout',
|
|
meta: {
|
|
icon: 'ic:baseline-view-in-ar',
|
|
keepAlive: true,
|
|
order: 1000,
|
|
title: 'demos.title',
|
|
},
|
|
name: 'Demos',
|
|
path: '/demos',
|
|
redirect: '/demos/access',
|
|
children: [
|
|
{
|
|
name: 'AccessDemos',
|
|
path: '/demosaccess',
|
|
meta: {
|
|
icon: 'mdi:cloud-key-outline',
|
|
title: 'demos.access.backendPermissions',
|
|
},
|
|
redirect: '/demos/access/page-control',
|
|
children: [
|
|
{
|
|
name: 'AccessPageControlDemo',
|
|
path: '/demos/access/page-control',
|
|
component: '/demos/access/index',
|
|
meta: {
|
|
icon: 'mdi:page-previous-outline',
|
|
title: 'demos.access.pageAccess',
|
|
},
|
|
},
|
|
{
|
|
name: 'AccessButtonControlDemo',
|
|
path: '/demos/access/button-control',
|
|
component: '/demos/access/button-control',
|
|
meta: {
|
|
icon: 'mdi:button-cursor',
|
|
title: 'demos.access.buttonControl',
|
|
},
|
|
},
|
|
{
|
|
name: 'AccessMenuVisible403Demo',
|
|
path: '/demos/access/menu-visible-403',
|
|
component: '/demos/access/menu-visible-403',
|
|
meta: {
|
|
authority: ['no-body'],
|
|
icon: 'mdi:button-cursor',
|
|
menuVisibleWithForbidden: true,
|
|
title: 'demos.access.menuVisible403',
|
|
},
|
|
},
|
|
roleWithMenus[role],
|
|
],
|
|
},
|
|
],
|
|
},
|
|
];
|
|
};
|
|
|
|
export const MOCK_MENUS = [
|
|
{
|
|
menus: [...dashboardMenus, ...createDemosMenus('super')],
|
|
username: 'vben',
|
|
},
|
|
{
|
|
menus: [...dashboardMenus, ...createDemosMenus('admin')],
|
|
username: 'admin',
|
|
},
|
|
{
|
|
menus: [...dashboardMenus, ...createDemosMenus('user')],
|
|
username: 'jack',
|
|
},
|
|
];
|