123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- import { resultSuccess } from '../_util';
- import { MockMethod } from 'vite-plugin-mock';
- const dashboardRoute = {
- path: '/dashboard',
- name: 'Dashboard',
- component: 'PAGE_LAYOUT',
- redirect: '/dashboard/welcome',
- meta: {
- icon: 'ant-design:home-outlined',
- title: 'Dashboard',
- },
- children: [
- {
- path: '/welcome',
- name: 'Welcome',
- component: '/dashboard/welcome/index',
- meta: {
- title: '欢迎页',
- affix: true,
- },
- },
- ],
- };
- const frontRoute = {
- path: '/front',
- name: 'PermissionFrontDemo',
- meta: {
- title: '基于前端权限',
- },
- children: [
- {
- path: 'page',
- name: 'FrontPageAuth',
- component: '/demo/permission/front/index',
- meta: {
- title: '页面权限',
- },
- },
- {
- path: 'btn',
- name: 'FrontBtnAuth',
- component: '/demo/permission/front/Btn',
- meta: {
- title: '按钮权限',
- },
- },
- {
- path: 'auth-pageA',
- name: 'FrontAuthPageA',
- component: '/demo/permission/front/AuthPageA',
- meta: {
- title: '权限测试页A',
- },
- },
- {
- path: 'auth-pageB',
- name: 'FrontAuthPageB',
- component: '/demo/permission/front/AuthPageB',
- meta: {
- title: '权限测试页B',
- },
- },
- ],
- };
- const backRoute = {
- path: '/back',
- name: 'PermissionBackDemo',
- meta: {
- title: '基于后台权限',
- },
- children: [
- {
- path: 'page',
- name: 'BackAuthPage',
- component: '/demo/permission/back/index',
- meta: {
- title: '页面权限',
- },
- },
- {
- path: 'btn',
- name: 'BackAuthBtn',
- component: '/demo/permission/back/Btn',
- meta: {
- title: '按钮权限',
- },
- },
- ],
- };
- const authRoute = {
- path: '/permission',
- name: 'Permission',
- component: 'PAGE_LAYOUT',
- redirect: '/permission/front/page',
- meta: {
- icon: 'ant-design:home-outlined',
- title: '权限管理',
- },
- children: [frontRoute, backRoute],
- };
- const authRoute1 = {
- path: '/permission',
- name: 'Permission',
- component: 'PAGE_LAYOUT',
- redirect: '/permission/front/page',
- meta: {
- icon: 'ant-design:home-outlined',
- title: '权限管理',
- },
- children: [backRoute],
- };
- export default [
- {
- url: '/api/getMenuListById',
- timeout: 1000,
- method: 'get',
- response: ({ query }) => {
- const { id } = query;
- if (!id || id === '1') {
- return resultSuccess([dashboardRoute, authRoute]);
- }
- if (id === '2') {
- return resultSuccess([dashboardRoute, authRoute1]);
- }
- },
- },
- ] as MockMethod[];
|