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' }, lesson: { prefix: '/lesson', record: '/lesson/record/training', manage: '/lesson/manage/training' }, teach: { prefix: '/teach', detail: '/teach/detail', practical: '/teach/practical', pay: '/teach/pay' }, exam: { prefix: '/exam', detail: '/exam/detail', course: '/exam/course', examRuleManage: '/exam/examRule/manage', pay: '/exam/pay' }, demonstration: { prefix: '/demonstration', detail: '/demonstration/detail', pay: '/demonstration/pay' }, dp: { prefix: '/dp', detail: '/dp/detail', pay: '/dp/pay' }, plan: { prefix: '/plan', tool: '/plan/tool', detail: '/plan/detail', pay: '/plan/pay' }, replay: { prefix: '/replay' }, permission: { prefix: '/permission', permissionList: '/permission/manage', permissionDraft: '/permission/draft', permission: '/permission/restore' }, publish: { prefix: '/publish', map: '/publish/map', mapDraft: '/publish/map/draft', runPlanEveryDay: '/publish/runPlan/everyDay', runPlanTemplate: '/publish/runPlan/template', runPlanCommon: '/publish/runPlan/common', runPlanView: '/publish/runPlan/view' }, orderauthor: { prefix: '/orderauthor', commodityManage: '/orderauthor/commodity/manage', commodityDraft: '/orderauthor/commodity/draft', orderManage: '/orderauthor/order/manage', orderDraft: '/orderauthor/order/draft', authorMange: '/orderauthor/author/manage', authorDraft: '/orderauthor/author/draft', transferDetail: '/orderauthor/transfer/detail', trainferPackage: '/orderauthor/transfer/package' } }; /** * 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: '/dp/login', component: resolve => require(['@/views/login/loginNewScreen'], resolve), hidden: true }, // 密码登录 { path: '/dp/login1', component: resolve => require(['@/views/login/loginScreen'], resolve), hidden: true }, // 扫码登录 { path: '/plan/login', component: resolve => require(['@/views/login/loginNewPlan'], resolve), hidden: true }, // 密码登录 { path: '/plan/login1', component: resolve => require(['@/views/login/loginPlan'], resolve), hidden: true }, { path: '/jlmap3d/edit', component: resolve => require(['@/views/jlmap3d/jlmap3dedit'], resolve), 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' } }] }, { path: '*', redirect: '/404', hidden: true } ]; export const asyncRouter = [ { path: '/', component: Layout, redirect: '/dashboard', name: 'Dashboard', hidden: true, children: [ { path: 'dashboard', component: resolve => require(['@/views/dashboard/index.vue'], resolve) } ] }, { path: '/display/:mode', component: resolve => require(['@/views/display/index'], resolve), meta: { title: '实训视图' }, hidden: true }, { path: '/trainroom', component: resolve => require(['@/views/trainRoom/index'], resolve), meta: { title: '综合演练房间' }, hidden: true }, { path: '/jointTraining', name: '联合演练试图', component: resolve => require(['@/views/jointTraining/index'], resolve), hidden: true }, { path: '/jlmap3d', name: '三维test', component: resolve => require(['@/views/jlmap3d/index'], resolve), meta: { title: '三维test' }, hidden: true }, { path: '/map', name: '地图管理', meta: { title: '地图管理', roles: [admin, mapCreater] }, component: Layout, children: [ { 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: '产品编辑' } } ] }, { path: '/lesson', component: Layout, name: '课程管理', meta: { title: '课程管理', roles: [admin, lessonCreater] }, children: [ { path: 'record', redirect: '/lesson/record/training/0/null', component: resolve => require(['@/views/lesson/trainingrecord/index'], resolve), meta: { title: '实训录制' }, children: [ { path: 'training/:trainingId/:trainingName', component: resolve => require(['@/views/lesson/trainingrecord/manage/index'], resolve), meta: { title: '实训录制' }, hidden: true } ] }, { path: 'manage/taskmanage', name: '任务管理', component: resolve => require(['@/views/lesson/taskmanage/list'], resolve), meta: { title: '任务管理' } }, { path: 'manage/trainingRule', name: '操作定义', component: resolve => require(['@/views/lesson/trainingRule/list'], resolve), meta: { title: '操作定义' } }, { path: 'manage/trainingRule/detail', name: '操作定义明细', hidden: true, component: resolve => require(['@/views/lesson/trainingRule/detail/index'], resolve), meta: { title: '操作定义明细' } }, { path: 'manage/training', name: '实训管理', component: resolve => require(['@/views/lesson/trainingmanage/index'], resolve), meta: { title: '实训管理' } }, { path: 'edit', name: '课程编辑', component: resolve => require(['@/views/lesson/lessoncategory/index'], resolve), meta: { title: '课程编辑' } }, { path: 'manage/scriptmanage', name: '剧本管理', component: resolve => require(['@/views/lesson/scriptmanage/list'], resolve), meta: { title: '剧本管理' } } ] }, { path: '/teach', redirect: '/teach/home', name: '教学系统', component: resolve => require(['@/views/teach/index'], resolve), meta: { roles: [admin, userLesson, user] }, children: [ { path: 'home', component: resolve => require(['@/views/teach/home'], resolve), meta: { title: '教学系统' } }, { path: 'detail/:lessonId', name: '课程详情', component: resolve => require(['@/views/teach/detail/index'], resolve), meta: { title: '课程详情' }, hidden: true }, { path: 'practical/:trainingId/:lessonId', name: '实训详情', component: resolve => require(['@/views/teach/practical/index'], resolve), meta: { title: '实训详情' }, hidden: true }, { path: 'pay/:lessonId', component: resolve => require(['@/views/components/pay/index'], resolve), meta: { }, hidden: true } ] }, { path: '/exam', redirect: '/exam/home', component: resolve => require(['@/views/exam/index'], resolve), name: '考试系统', meta: { roles: [admin, userExam, user] }, children: [ { path: 'home', component: resolve => require(['@/views/exam/home'], resolve), meta: { title: '考试系统' } }, { path: 'detail/:examId', name: '试卷详情', component: resolve => require(['@/views/exam/detail/examDetail'], resolve), meta: { title: '试卷详情' }, hidden: true }, { path: 'course/:lessonId', component: resolve => require(['@/views/exam/detail/courseDetail'], resolve), meta: { }, hidden: true }, { path: 'examRule/manage', name: '试题设置', component: resolve => require(['@/views/publish/examRule/index'], resolve), meta: { title: '试题设置' }, hidden: true }, { path: 'examRule/draft/:mode/:ruleId/:lessonId', hidden: true, component: resolve => require(['@/views/publish/examRule/draft/index'], resolve), meta: { title: '添加订单' } }, { path: 'pay/:lessonId', component: resolve => require(['@/views/components/pay/index'], resolve), meta: { }, hidden: true }, { path: 'questionDetail/:examQuestionId', name: '开始考试', component: resolve => require(['@/views/exam/detail/questionDetail'], resolve), meta: { title: '开始考试' }, hidden: true }, { path: 'result/:userExamId', name: '考试结果', component: resolve => require(['@/views/exam/result'], resolve), meta: { title: '考试结果' }, hidden: true } ] }, { path: '/demonstration', redirect: '/demonstration/home', component: resolve => require(['@/views/demonstration/index'], resolve), name: '仿真系统', meta: { roles: [admin, userSimulation, user] }, children: [ { path: 'home', component: resolve => require(['@/views/demonstration/home'], resolve), meta: { title: '仿真系统' } }, { path: 'detail/:mapId', name: '地图详情', component: resolve => require(['@/views/demonstration/detail/index'], resolve), meta: { title: '地图详情' }, hidden: true }, { path: 'pay/:lessonId', component: resolve => require(['@/views/components/pay/index'], resolve), meta: { }, hidden: true } ] }, { path: '/dp', redirect: '/dp/home', component: resolve => require(['@/views/screenMonitor/index'], resolve), name: '大屏系统', meta: { roles: [admin, userScreen] }, children: [ { path: 'home', component: resolve => require(['@/views/screenMonitor/home'], resolve), meta: { title: '大屏系统' }, target: true }, { path: 'detail/:lessonId', component: resolve => require(['@/views/screenMonitor/detail/index'], resolve), meta: { }, hidden: true }, { path: 'pay/:lessonId', component: resolve => require(['@/views/components/pay/index'], resolve), meta: { }, hidden: true } ] }, { path: '/plan/tool', component: resolve => require(['@/views/planMonitor/editTool/index'], resolve), meta: { }, hidden: true }, { path: '/plan', redirect: '/plan/home', component: resolve => require(['@/views/planMonitor/index'], resolve), name: '琏计划', meta: { roles: [admin, user] }, children: [ { path: 'home', component: resolve => require(['@/views/planMonitor/home'], resolve), meta: { title: '琏计划' }, target: true }, { path: 'detail/:lessonId', component: resolve => require(['@/views/planMonitor/detail'], resolve), meta: { }, hidden: true }, { path: 'pay/:lessonId', component: resolve => require(['@/views/components/pay/index'], resolve), meta: { }, hidden: true } ] }, { path: '/replay', component: Layout, meta: { roles: [admin] }, children: [ { path: 'manage', component: resolve => require(['@/views/replay/index'], resolve), meta: { title: '回放管理' } } ] }, { path: '/permission', component: Layout, meta: { roles: [admin, user] }, children: [ { path: 'manage', component: resolve => require(['@/views/package/index'], resolve), meta: { title: '权限管理' } }, { path: 'draft', component: resolve => require(['@/views/package/draft/ruleForm'], resolve), meta: { }, hidden: true } ] }, { path: '/publish', name: '发布内容管理', component: Layout, meta: { title: '发布内容管理', roles: [admin] }, children: [ { path: 'map', name: '发布地图管理', component: resolve => require(['@/views/publish/publishMap/index'], resolve), meta: { title: '发布地图管理' } }, { path: 'product', name: '产品状态管理', component: resolve => require(['@/views/publish/productStatus/index'], resolve), meta: { title: '产品状态管理' } }, { path: 'lesson', name: '发布课程管理', component: resolve => require(['@/views/publish/publishLesson/index'], resolve), meta: { title: '发布课程管理' } }, // { // path: 'script', // name: '仿真脚本管理', // component: resolve => require(['@/views/publish/simulationScript/index'], resolve), // meta: { // title: '仿真脚本管理', // } // }, { path: 'runPlan/template', component: resolve => require(['@/views/publish/runPlanTemplate/index'], resolve), meta: { title: '运行图模板管理' } }, { path: 'runPlan/common', component: resolve => require(['@/views/publish/runPlanCommon/index'], resolve), meta: { title: '运行图通用管理' } }, { path: 'runPlan/everyDay', component: resolve => require(['@/views/publish/runPlanEveryDay/index'], resolve), meta: { title: '运行图每日管理' } }, { path: 'examRule/manage', name: '试题管理', component: resolve => require(['@/views/publish/examRule/index'], resolve), meta: { title: '试题管理' } }, { path: 'map/draft/:mode/:mapId', component: resolve => require(['@/views/publish/publishMap/draft'], resolve), meta: { }, hidden: true }, { path: 'examRule/draft/:mode/:ruleId/:lessonId', hidden: true, component: resolve => require(['@/views/publish/examRule/draft/index'], resolve), meta: { } }, { path: 'runPlan/common/:mode', component: resolve => require(['@/views/publish/runPlanCommon/draft'], resolve), meta: { }, hidden: true }, { path: 'runPlan/view/:mode', component: resolve => require(['@/views/map/runplan/chart'], resolve), meta: { }, hidden: true } ] }, { path: '/orderauthor', component: Layout, name: '订单权限管理', meta: { title: '订单权限管理', roles: [admin] }, children: [ { path: 'commodity/manage', name: '商品管理', component: resolve => require(['@/views/orderauthor/commodity/index'], resolve), meta: { title: '商品管理' } }, { path: 'order/manage', name: '订单管理', component: resolve => require(['@/views/orderauthor/order/list'], resolve), meta: { title: '订单管理' } }, { path: 'author/manage', name: '权限管理', component: resolve => require(['@/views/orderauthor/author/index'], resolve), meta: { title: '权限管理' } }, { path: 'transfer/manage', name: '权限分发管理', component: resolve => require(['@/views/orderauthor/permission/index'], resolve), meta: { title: '权限分发管理' } }, { path: 'commodity/draft/:mode/:commodityId', name: '添加商品', hidden: true, component: resolve => require(['@/views/orderauthor/commodity/draft'], resolve), meta: { title: '添加商品' } }, { path: 'order/draft/:mode/:orderId', name: '添加订单', hidden: true, component: resolve => require(['@/views/orderauthor/order/draft'], resolve), meta: { title: '添加订单' } }, { path: 'author/draft/:mode/:userId', name: '添加课程权限', hidden: true, component: resolve => require(['@/views/orderauthor/author/draft'], resolve), meta: { title: '添加课程权限' } }, { path: 'transfer/detail/:permissionId', component: resolve => require(['@/views/orderauthor/permission/detail'], resolve), meta: { }, hidden: true }, { path: 'transfer/package', component: resolve => require(['@/views/orderauthor/permission/draft/ruleForm'], resolve), meta: { }, hidden: true } ] }, { path: '/system', component: Layout, meta: { title: '系统管理', roles: [admin] }, children: [ { path: 'dictionary', name: 'Dictionary', component: resolve => require(['@/views/management/dictionary/index'], resolve), meta: { title: '数据字典' } }, { path: 'dictionary/detail', name: '数据字典明细', hidden: true, component: resolve => require(['@/views/management/dictionaryDetail/index'], resolve), meta: { title: '数据字典明细' } }, { path: 'userManage', name: '用户管理', component: resolve => require(['@/views/management/userControl/index'], resolve), meta: { title: '用户管理' } }, { path: 'userTrainingManage', name: '用户实训管理', component: resolve => require(['@/views/management/userTraining/index'], resolve), meta: { title: '用户实训管理' } }, { path: 'userExamManage', name: '用户考试管理', component: resolve => require(['@/views/management/userExam/index'], resolve), meta: { title: '用户考试管理' } }, { path: 'userSimulationManage', name: '用户仿真管理', component: resolve => require(['@/views/management/userSimulation/index'], resolve), meta: { title: '用户仿真管理' } }, { path: 'existingSimulation', name: '存在仿真管理', component: resolve => require(['@/views/management/existingSimulation/index'], resolve), meta: { title: '存在仿真管理' } } ] } ]; const createRouter = () => new Router({ mode: 'history', // require service support scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }); const router = createRouter(); export default router;