rt-sim-training-client/src/router/index.js

176 lines
4.6 KiB
JavaScript
Raw Normal View History

2019-07-04 10:59:40 +08:00
import Vue from 'vue';
import Router from 'vue-router';
2019-07-02 16:29:52 +08:00
2019-07-04 10:59:40 +08:00
Vue.use(Router);
2019-07-02 16:29:52 +08:00
/* Layout */
2019-07-04 10:59:40 +08:00
import Layout from '@/layout';
2019-07-02 16:29:52 +08:00
/**
* Note: sub-menu only appear when route children.length >= 1
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
*
* hidden: true if set true, item will not show in the sidebar(default is false)
* alwaysShow: true if set true, will always show the root menu
* if not set alwaysShow, when item has more than one children route,
* it will becomes nested mode, otherwise not show the root menu
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
* name:'router-name' the name is used by <keep-alive> (must set!!!)
* meta : {
roles: ['admin','editor'] control the page roles (you can set multiple roles)
title: 'title' the name show in sidebar and breadcrumb (recommend set)
icon: 'svg-name' the icon show in the sidebar
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
}
*/
export const user = '01'; // 普通用户
export const mapCreater = '02'; // 地图创建权限
export const lessonCreater = '03'; // 课程创建权限
export const admin = '04'; // 管理员
export const superAdmin = '05'; // 超级管理员
2019-07-04 10:59:40 +08:00
export const userExam = '011'; // 考试系统
export const userLesson = '012'; // 教学系统
2019-07-02 16:29:52 +08:00
export const userSimulation = '013'; // 仿真系统
2019-07-04 10:59:40 +08:00
export const userScreen = '014'; // 大屏系统
export const userPlan = '015'; // 计划系统
2019-07-02 16:29:52 +08:00
export const UrlConfig = {
display: '/display',
examRuleDraft: '/examRule/draft',
examRuleManage: '/examRule/manage'
};
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/loginNew'),
hidden: true
},
{
path: '/login1',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error-page/401'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/error-page/404'),
hidden: true
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [{
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard' }
}]
}
2019-07-04 10:59:40 +08:00
];
2019-07-02 16:29:52 +08:00
export const asyncRouter = [
2019-07-03 14:29:09 +08:00
{
path: '/map',
2019-07-25 10:30:30 +08:00
name: '地图管理',
2019-07-03 14:29:09 +08:00
meta: {
2019-07-25 10:30:30 +08:00
title: '地图管理',
2019-07-03 14:29:09 +08:00
roles: [admin]
},
2019-07-25 10:30:30 +08:00
component: Layout,
2019-07-03 14:29:09 +08:00
children: [
{
path: 'manage',
name: '地图管理',
2019-07-25 10:30:30 +08:00
component: () => import('@/views/jmapTest/index'),
2019-07-03 14:29:09 +08:00
meta: { title: '地图管理', icon: 'map-mange' }
2019-07-25 10:30:30 +08:00
},
// {
// path: 'skinStyle',
// name: '皮肤管理',
// component: resolve => require(['@/views/map/skinStyle/index'], resolve),
// meta: {
// title: '皮肤管理'
// }
// },
// {
// path: 'skinStyle/draft/:mode/:skinStyleId',
// name: '操作权限',
// hidden: true,
// component: resolve => require(['@/views/map/skinStyle/draft'], resolve),
// meta: {
// title: '操作权限'
// }
// },
{
path: 'draw',
redirect: '/map/draw/0/draft',
component: resolve => require(['@/views/map/mapdraft/index'], resolve),
meta: {
title: '地图绘制'
},
children: [
{
path: ':mapId/:view',
component: resolve => require(['@/views/map/mapdraft/mapedit/index'], resolve),
meta: {
title: '地图绘制'
},
hidden: true
}
]
2019-07-03 14:29:09 +08:00
}
2019-07-25 10:30:30 +08:00
// {
// path: 'runPlan',
// redirect: '/map/runPlan/view/draft',
// name: '运行图管理',
// component: resolve => require(['@/views/map/runplan/index'], resolve),
// meta: {
// title: '运行图管理'
// },
// children: [{
// path: 'view/:mode',
// component: resolve => require(['@/views/map/runplan/chart'], resolve),
// hidden: true
// }]
// }
// {
// path: 'product',
// name: '产品编辑',
// component: resolve => require(['@/views/lesson/trainingcategory/index'], resolve),
// meta: {
// title: '产品编辑'
// }
// }
2019-07-03 14:29:09 +08:00
]
},
2019-07-02 16:29:52 +08:00
{ path: '*', redirect: '/404', hidden: true }
2019-07-04 10:59:40 +08:00
];
2019-07-02 16:29:52 +08:00
const createRouter = () => new Router({
mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
2019-07-04 10:59:40 +08:00
});
2019-07-02 16:29:52 +08:00
2019-07-04 10:59:40 +08:00
const router = createRouter();
2019-07-02 16:29:52 +08:00
2019-07-04 10:59:40 +08:00
export default router;