import Vue from 'vue'; import Router from 'vue-router'; Vue.use(Router); /* Layout */ import Layout from '@/layout'; /** * 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 (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'; // 超级管理员 export const userExam = '011'; // 考试系统 export const userLesson = '012'; // 教学系统 export const userSimulation = '013'; // 仿真系统 export const userScreen = '014'; // 大屏系统 export const userPlan = '015'; // 计划系统 export const UrlConfig = { display: '/display', examRuleDraft: '/examRule/draft', examRuleManage: '/examRule/manage', map: { prefix: '/map', draft: '/map/draw', skinStyle: '/map/skinStyle', skinStyleDraft: '/map/skinStyle/draft', runPlan: '/map/runPlan', runPlanView: '/map/runPlan/view', product: '/map/product', productDraft: '/map/product/draft' } }; /** * 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' } }] } ]; export function getUrlByPath(path, router) { } export const routerMap = { path: '/map', name: '地图管理', meta: { title: '地图管理', roles: [admin] }, component: Layout, children: [ { path: 'manage', name: '地图管理', component: () => import('@/views/jmapTest/index'), meta: { title: '地图管理', icon: 'map-mange' } }, // { // 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 } ] } // { // 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: '产品编辑' // } // } ] }; export const router404 = { path: '*', redirect: '/404', hidden: true }; export const asyncRouter = [ routerMap, router404 ]; const createRouter = () => new Router({ mode: 'history', // require service support scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }); const router = createRouter(); export default router;