rt-sim-training-client/src/router/index_HEB.js
2020-10-10 09:30:45 +08:00

785 lines
26 KiB
JavaScript

import Vue from 'vue';
import VueRouter from 'vue-router';
// import VueRouter from 'vue-router';
Vue.use(VueRouter);
/* Layout */
const Layout = () => import('@/layout');
// const Login = () => import('@/views/login/hydLogin');
const Login = () => import('@/views/login/index');
const Jlmap3dedit = () => import('@/views/jlmap3d/edit/jlmap3dedit');
const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice');
const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow');
const Jlmap3dTrain = () => import('@/views/jlmap3d/devicetrain/jl3ddevicetrain');
const Display = () => import('@/views/oldMap/display/index');
const DisplayNew = () => import('@/views/newMap/displayNew/index');
const DesignDisplay = () => import('@/views/oldMap/display/designIndex');
const TrainRoom = () => import('@/views/trainRoom/index');
const JointTraining = () => import('@/views/oldMap/jointTraining/index');
const JointTrainingNew = () => import('@/views/newMap/jointTrainingNew/index');
const Errpr404 = () => import('@/views/error-page/404');
const Dictionary = () => import('@/views/system/dictionary/index');
const DictionaryDetail = () => import('@/views/system/dictionaryDetail/index');
const UserControl = () => import('@/views/system/userControl/index');
const UserTraining = () => import('@/views/system/userTraining/index');
const UserExam = () => import('@/views/system/userExam/index');
const UserSimulation = () => import('@/views/system/userSimulation/index');
const ExistingSimulation = () => import('@/views/system/existingSimulation/index');
const CacheControl = () => import('@/views/system/cacheControl/index');
const SystemGenerate = () => import('@/views/system/systemGenerate/index');
const News = () => import('@/views/system/news/index');
const CommandDictionary = () => import('@/views/system/commandDictionary/index');
const CommandDictionaryDetail = () => import('@/views/system/commandDictionary/edit');
const configLine = () => import('@/views/system/configLine/index');
const IscsSystem = () => import('@/views/iscs/iscsSystem/index');
const IscsConfig = () => import('@/views/iscs/iscsSystem/config/index');
const Taskmanage = () => import('@/views/lesson/taskmanage/list');
const TrainingRuleList = () => import('@/views/lesson/trainingRule/list');
const TrainingRuleEdit = () => import('@/views/lesson/trainingRule/detail/index');
const Trainingmanage = () => import('@/views/lesson/trainingmanage/index');
const LessonEdit = () => import('@/views/lesson/lessoncategory/index');
const LessonHome = () => import('@/views/lesson/home');
const LessonDetail = () => import('@/views/lesson/details');
const BigScreen = () => import('@/views/designPlatform/bigScreen');
const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen');
const ScriptmanageHome = () => import('@/views/scriptManage/home');
const ScriptDisplay = () => import('@/views/oldMap/scriptManage/display/index');
const IbpHome = () => import('@/views/ibp/home');
const IbpDraw = () => import('@/views/ibp/ibpDraw/index');
const TeachDetail = () => import('@/views/teach/detail/index');
const TeachHome = () => import('@/views/teach/index');
const Pay = () => import('@/views/components/pay/index');
const ExamHome = () => import('@/views/exam/index');
const ExamResult = () => import('@/views/exam/result');
const ExamDetail = () => import('@/views/exam/detail/examDetail');
const ExamCourseDetail = () => import('@/views/exam/detail/courseDetail');
const DemonstrationDetail = () => import('@/views/demonstration/detail/index');
const PlanMonitorEditTool = () => import('@/views/planMonitor/editTool/index');
const PlanMonitorEditUserTool = () => import('@/views/planMonitor/editTool/userindex');
const PlanMonitorDetail = () => import('@/views/planMonitor/detail');
const DesignPlatformHome = () => import('@/views/designPlatform/home');
const DesignPlatform = () => import('@/views/designPlatform/index');
const MapPreview = () => import('@/views/designPlatform/mapPreview');
const MapPreviewNew = () => import('@/views/designPlatform/mapPreviewNew');
const Package = () => import('@/views/package/index');
const PublishMap = () => import('@/views/publish/publishMap/index');
const PublishMapDetail = () => import('@/views/publish/publishMap/list'); // 发布历史
const PublishLesson = () => import('@/views/publish/publishLesson/index');
const RunPlanTemplate = () => import('@/views/publish/runPlanTemplate/index');
const RunPlanCommon = () => import('@/views/publish/runPlanCommon/index');
const RunPlanCommonDraft = () => import('@/views/publish/runPlanCommon/draft');
const RunPlanEveryDay = () => import('@/views/publish/runPlanEveryDay/index');
const RunplanView = () => import('@/views/publish/runPlanEveryDay/runPlanView');
const PublishExamRule = () => import('@/views/publish/examRule/index');
const PublishExamRuleDraft = () => import('@/views/publish/examRule/draft/index');
const TrainingPlatform = () => import('@/views/trainingPlatform/index');
const Commodity = () => import('@/views/orderauthor/commodity/index');
const OrderList = () => import('@/views/orderauthor/order/list');
const OrderDraft = () => import('@/views/orderauthor/order/draft');
const Author = () => import('@/views/orderauthor/author/index');
const Permission = () => import('@/views/orderauthor/permission/index');
const PermissionDetail = () => import('@/views/orderauthor/permission/detail');
const PermissionCreate = () => import('@/views/orderauthor/permission/create/index');
const UserRules = () => import('@/views/orderauthor/rules/index');
const UserRulesDetail = () => import('@/views/orderauthor/rules/detail');
const DeviceManage = () => import('@/views/system/deviceManage/index');
const MapSort = () => import('@/views/publish/publishMap/mapSort');
const Approval = () => import('@/views/approval/index');
// import { loginInfo } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth';
/**
* 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'; // 超级管理员
export const projectTrain = '011'; // 城市轨道项目
export const projectXian = '012'; // 西安地铁项目
export const projectXty = '013'; // 西铁院
export const projectGzzb = '014'; // 贵州装备
export const projectJsxt = '015'; // 竞赛系统
export const projectJyd = '017'; // 竞业达
export const projectTky = '018'; // 铁科院
export const projectHeb = '019'; // 哈盈达
export const userTrainingPlatform = '016'; // 实训系统
// export const refereePlatform = '017'; // 裁判系统
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
// 实训平台登录
{
path: '/login',
component: Login,
hidden: true
},
// 设计平台登录
{
path: '/design',
redirect: '/design/login',
hidden: true
},
{
path: '/design/login',
component: Login,
hidden: true
},
{
path: '/design/jlmap3d/edit',
component: Jlmap3dedit,
hidden: true
},
{
path: '/jlmap3d/sandbox',
component: Jlmap3dSandbox,
hidden: true
},
{
path: '/jlmap3d/devicemodel',
component: Jlmap3dModel,
hidden: true
},
{
path: '/jlmap3d/passengerflow',
component: Jlmap3dPassFlow,
hidden: true
},
{
path: '/jlmap3d/devicetrain',
component: Jlmap3dTrain,
hidden: true
},
{
path: '/404',
component: Errpr404,
hidden: true
},
{ path: '*', redirect: '/404', hidden: true }
];
// 公共路由不需要过滤 直接可以访问
export const publicAsyncRoute = [
{ // 全屏战场图
path: '/display/:mode',
component: Display,
hidden: true
},
{
path: '/displayNew/:mode',
component: DisplayNew,
hidden: true
},
{
path: '/design/display/:mode',
component: DesignDisplay,
hidden: true
},
{ // 剧本编辑 战场图
path: '/scriptDisplay/:mode',
component: ScriptDisplay,
hidden: true
},
{ // 剧本编辑 战场图
path: '/scriptDisplayNew/:mode',
component: DisplayNew,
hidden: true
},
{ // 综合演练室
path: '/trainroom',
component: TrainRoom,
hidden: true
},
{
path: '/jointTraining',
component: JointTraining,
hidden: true
},
{
path: '/jointTrainingNew',
component: JointTrainingNew,
hidden: true
},
{
path: '/displayBigScreen/:mapId',
component: BigScreen,
hidden: true
},
{ // 大屏切分
path: '/bigSplitScreen/:mapId',
component: BigSplitScreen,
hidden: true
},
{
path: '/jlmap3d',
component: Jlmap3d,
hidden: true
},
{ // 运行图编辑
path: '/plan/usertool',
component: PlanMonitorEditUserTool,
hidden: true
},
{ // 运行图编辑
path: '/plan/tool',
component: PlanMonitorEditTool,
hidden: true
},
{
path: '/displayIscs/system',
component: IscsSystem,
hidden: true,
children: [
{
path: 'config/:mode',
component: IscsConfig,
hidden: true
}
]
},
{
path: '/device/teachDetail',
component: TeachDetail,
hidden: true
},
{
path: '/device/course',
component: ExamCourseDetail,
hidden: true
},
{
path: '/device/examRule/manage',
component: PublishExamRule,
hidden: true
},
{
path: '/device/examRule/draft/:mode/:ruleId/:lessonId',
component: PublishExamRuleDraft,
hidden: true
},
{ // 试卷详情
path: '/device/exam/:examId',
component: ExamDetail,
hidden: true
},
{ // 考试结果
path: '/device/result/:userExamId',
component: ExamResult,
hidden: true
}
];
export const asyncRouter = [
{ // 公共地图
path: '/design',
component: Layout,
redirect: '/design/home',
meta: {
roles: [admin, user]
},
children: [
{
path: '',
redirect: '/design/home',
component: DesignPlatform,
meta: {
i18n: 'router.designhomePage',
icon: 'design'
},
children: [
{
path: 'home',
component: DesignPlatformHome,
meta: {
}
},
{ // 运行图设计
path: 'runPlan/detail/:mapId',
component: PlanMonitorDetail,
hidden: true
},
{ // 剧本
path: 'script/home/:mapId',
component: ScriptmanageHome,
meta: {
i18n: 'router.scriptManage'
},
hidden: true
},
{ // 课程列表
path: 'lesson/home/:mapId',
component: LessonHome,
hidden: true
},
{ // 操作定义
path: 'lesson/trainingRule',
component: TrainingRuleList,
hidden: true
},
{ // 操作定义步骤
path: 'lesson/trainingRule/detail',
hidden: true,
component: TrainingRuleEdit
},
{ // 任务管理
path: 'lesson/taskManage',
component: Taskmanage,
hidden: true
},
{ // 实训管理
path: 'lesson/trainingManage',
component: Trainingmanage,
hidden: true
},
{ // 创建课程
path: 'lesson/edit/:type',
component: LessonEdit,
hidden: true
},
{ // 课程详情
path: 'lesson/details',
component: LessonDetail,
hidden: true,
children: [
{
path: 'edit/:type',
component: LessonEdit,
hidden: true
}
]
},
{ // 地图预览
path: 'mapPreview/:mapId',
component: MapPreview,
hidden: true
},
{ // 新版地图预览
path: 'mapPreviewNew/:mapId',
component: MapPreviewNew,
hidden: true
},
{
path: 'bigScreen/:mapId',
component: BigScreen,
hidden: true
},
{ // ibp列表
path: 'ibp/home/:mapId',
component: IbpHome,
hidden: true
},
{
path: 'ibp/edit',
component: IbpDraw,
hidden: true
}
]
}
]
},
{ // 实训平台
path: '/trainingPlatform',
component: Layout,
hidden: true,
meta: {
roles: [admin, user, userTrainingPlatform]
},
children: [
{
path: '',
component: TrainingPlatform,
meta: {
},
children: [
{ // 仿真详情
path: 'detail/:subSystem',
component: DemonstrationDetail,
hidden: true
},
{ // 教学系统 课程列表
path: 'teachHome/:subSystem',
component: TeachHome,
hidden: true
},
{ // 课程详情
path: 'teach/:subSystem',
component: TeachDetail,
hidden: true
},
{ // 试卷列表
path: 'course/:subSystem',
component: ExamCourseDetail,
hidden: true
},
{ // 考试系统 课程列表
path: 'examHome/:subSystem',
component: ExamHome,
hidden: true
},
{ // 试卷详情
path: 'exam/:examId',
component: ExamDetail,
hidden: true
},
{ // 试卷列表
path: 'examRule/manage',
component: PublishExamRule,
hidden: true
},
{ // 创建试卷
path: 'examRule/draft/:mode/:ruleId/:lessonId',
component: PublishExamRuleDraft,
hidden: true
},
{ // 购买
path: 'pay/:lessonId',
component: Pay,
hidden: true
},
{ // 考试结果
path: 'result/:userExamId',
component: ExamResult,
hidden: true
},
{ // 线路权限列表
path: 'permission/:mapId',
component: Package,
hidden: true
}
]
}
]
},
{ // 发布内容管理
path: '/publish',
component: Layout,
meta: {
i18n: 'router.pulishManage',
roles: [admin]
},
children: [
{ // 发布地图
path: 'map',
component: PublishMap,
meta: {
i18n: 'router.publishMapManage'
}
},
{
path: '/publish/mapSort',
component: MapSort,
hidden: true
},
{ // 发布历史
path: 'map/detail',
hidden: true,
component: PublishMapDetail
},
{ // 发布课程
path: 'lesson',
component: PublishLesson,
meta: {
i18n: 'router.publishLessonManage'
}
},
{ // 模板运行图
path: 'runPlan/template',
component: RunPlanTemplate,
meta: {
i18n: 'router.runPlanTemplateManage'
}
},
{ // 加载运行图管理
path: 'runPlan/common',
component: RunPlanCommon,
meta: {
i18n: 'router.runPlanCommonManage'
}
},
{ // 新增加载运行图
path: 'runPlan/common/:mode',
component: RunPlanCommonDraft,
hidden: true
},
{ // 运行图预览
path: 'runPlan/view/:mode',
component: RunplanView,
hidden: true
},
{ // 每日运行图
path: 'runPlan/everyDay',
component: RunPlanEveryDay,
meta: {
i18n: 'router.runPlanEveryDayManage'
}
},
{ // 考试规则列表
path: 'examRule/manage',
component: PublishExamRule,
meta: {
i18n: 'router.examRuleManage'
}
},
{
path: 'examRule/draft/:mode/:ruleId/:lessonId',
component: PublishExamRuleDraft,
hidden: true
}
]
},
{ // 订单权限管理
path: '/orderauthor',
component: Layout,
meta: {
i18n: 'router.orderAuthorityManage',
roles: [admin]
},
children: [
{
path: 'author/manage',
component: Author,
meta: {
i18n: 'router.authorityManage'
}
},
{
path: 'commodity/manage',
component: Commodity,
meta: {
i18n: 'router.commodityManage'
}
},
{
path: 'order/manage',
component: OrderList,
meta: {
i18n: 'router.orderManage'
}
},
{
path: 'transfer/manage',
component: Permission,
meta: {
i18n: 'router.authorityTransferManage'
}
},
{
path: 'rules/manage',
component: UserRules,
meta: {
i18n: 'router.userRulesManage'
}
},
{
path: 'rules/manage/detail/:id',
hidden: true,
component: UserRulesDetail,
meta: {
i18n: 'router.userRulesManage'
}
},
{
path: 'order/draft/:mode/:orderId',
hidden: true,
component: OrderDraft,
meta: {
i18n: 'router.addOrder'
}
},
{
path: 'transfer/detail/:permissionId',
component: PermissionDetail,
hidden: true
},
{
path: 'transfer/create',
component: PermissionCreate,
hidden: true
}
]
},
{ // 系统管理
path: '/system',
component: Layout,
meta: {
i18n: 'router.systemManage',
roles: [admin]
},
children: [
{
path: 'dictionary',
component: Dictionary,
meta: {
i18n: 'router.dataDictionary'
}
},
{
path: 'dictionary/detail',
hidden: true,
component: DictionaryDetail,
meta: {
i18n: 'router.dataDictionaryDetails'
}
},
{
// 用户管理
path: 'userManage',
component: UserControl,
meta: {
i18n: 'router.userManage'
}
},
{
// 缓存管理
path: 'cache',
component: CacheControl,
meta: {
i18n: 'router.cacheManage'
}
},
{
path: 'userTrainingManage',
component: UserTraining,
meta: {
i18n: 'router.userTrainingManage'
}
},
{
path: 'userExamManage',
component: UserExam,
meta: {
i18n: 'router.userExamManage'
}
},
{
path: 'userSimulationManage',
component: UserSimulation,
meta: {
i18n: 'router.userSimulationManage'
}
},
{
path: 'existingSimulation',
component: ExistingSimulation,
meta: {
i18n: 'router.existingSimulation'
}
},
{
// 子系统生成
path: 'systemGenerate',
component: SystemGenerate,
meta: {
i18n: 'router.subsystemGeneration'
}
},
{ // 消息公告
path: 'news',
component: News,
meta: {
i18n: 'router.newsBulletin'
}
},
{ // 命令管理
path: 'commands',
component: CommandDictionary,
meta: {
i18n: 'router.commandDictionary'
}
},
{
path: 'commands/Detail',
hidden: true,
component: CommandDictionaryDetail
},
{ // 线路管理
path: 'configLine',
component: configLine,
meta: {
i18n: 'router.configLine'
}
},
{
path: 'deviceManage',
component: DeviceManage,
meta: {
i18n: 'router.deviceManage'
}
},
{// 发布申请
path: 'approval',
component: Approval,
meta: {
i18n: 'router.releaseApplication'
}
}
]
}
];
const createRouter = () => new VueRouter({
mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
});
const router = createRouter();
// router.beforeEach((to, from, next) => {
// const project = getSessionStorage('project');
// document.title = loginInfo[project || 'login'].title;
// next();
// });
// 兼容 vue-router在3.1.0版本以上的路由跳转使用的是 promise 的方式
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
};
export default router;