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',
|
|
|
|
component: Layout,
|
|
|
|
meta: {
|
|
|
|
roles: [admin]
|
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'manage',
|
|
|
|
name: '地图管理',
|
|
|
|
component: () => import('@/views/jmap/index'),
|
|
|
|
meta: { title: '地图管理', icon: 'map-mange' }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
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;
|