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

1099 lines
36 KiB
JavaScript

import Vue from 'vue';
import Router from 'vue-router';
// import VueRouter from 'vue-router';
Vue.use(Router);
/* Layout */
const Layout = () => import('@/layout');
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 Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow');
const Jlmap3dStation = () => import('@/views/jlmap3d/station/jl3dstation');
const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice');
const Jlmap3dTrain = () => import('@/views/jlmap3d/devicetrain/jl3ddevicetrain');
const Jl3dMaintainer = () => import('@/views/jlmap3d/maintainer/jl3dmaintainer');
const Display = () => import('@/views/display/index');
const DisplayNew = () => import('@/views/newMap/displayNew/index');
const DesignDisplay = () => import('@/views/display/designIndex');
const DesignDisplayNew = () => import('@/views/newMap/displayNew/designIndex');
const TrainRoom = () => import('@/views/trainRoom/index');
const JointTraining = () => import('@/views/jointTraining/index');
const JointTrainingNew = () => import('@/views/newMap/jointTrainingNew/index');
const Error401 = () => import('@/views/error-page/401');
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 Mapedit = () => import('@/views/mapdraft/index');
const IscsSystem = () => import('@/views/iscs/iscsSystem/index');
const IscsDraw = () => import('@/views/iscs/iscsDraw/index');
const IscsDesign = () => import('@/views/iscs/iscsDesign/index');
const IscsConfig = () => import('@/views/iscs/iscsSystem/config/index');
const NewMapDraft = () => import('@/views/newMap/newMapdraft/index');
const NewDesignPlatformUser = () => import('@/views/newMap/newDesignUser/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 TrainingmanageOld = () => import('@/views/lesson/trainingmanage/oldMap');
const LessonEdit = () => import('@/views/lesson/lessoncategory/index');
const LessonHome = () => import('@/views/lesson/home');
const LessonDetail = () => import('@/views/lesson/details');
const ScriptmanageHome = () => import('@/views/scriptManage/home');
const ScriptDisplay = () => import('@/views/scriptManage/display/index');
const ScriptDisplayNew = () => import('@/views/scriptManage/display/indexNew');
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 BigScreen = () => import('@/views/designPlatform/bigScreen');
// const DesignPlatformUser = () => import('@/views/designUser/index');
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 LessonApproval = () => import('@/views/approval/lesson/index');
const ScriptApproval = () => import('@/views/approval/script/index');
const RunPlanApproval = () => import('@/views/approval/runPlan/index');
const DeviceManage = () => import('@/views/system/deviceManage/index');
const MapSort = () => import('@/views/publish/publishMap/mapSort');
const StudentManage = () => import('@/views/studentManage');
const RaceManage = () => import('@/views/competitionManage/index');
const CompetitionDetail = () => import('@/views/jsxt/competition/examDetail');
const CompetitionManage = () => import('@/views/jsxt/competition/index');
const CompetitionHome = () => import('@/views/jsxt/competition/home');
const Refereedetail = () => import('@/views/jsxt/competition/theory/quiz/index');
const JsxtApply = () => import('@/views/jsxt/apply/index');
// const theoryManage = () => import('@/views/jsxt/competition/theory/index');
const RefereeList = () => import('@/views/jsxt/refereeList/index');
const homeJsxt = () => import('@/views/jsxt/home/index');
const RecaList = () => import('@/views/jsxt/reca/list');
const JsxtExamResult = () => import('@/views/jsxt/competition/result');
import { GenerateRouteProjectList } 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 referee = '07'; // 裁判员
export const projectTrain = '011'; // 城市轨道项目
export const projectXian = '012'; // 西安地铁项目
export const projectXty = '013'; // 西铁院
export const projectGzzb = '014'; // 贵州装备
export const projectJsxt = '015'; // 竞赛系统
export const userTrainingPlatform = '016'; // 实训系统
// export const refereePlatform = '017'; // 裁判系统
export const constantRoutes = [
// 实训平台登录
{
path: '/login',
component: 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/passengerflow',
component: Jlmap3dPassFlow,
hidden: true
},
{
path: '/jlmap3d/jl3dstation',
component: Jlmap3dStation,
hidden: true
},
{
path: '/jlmap3d/devicemodel',
component: Jlmap3dModel,
hidden: true
},
{
path: '/gzzbxy/relay/:deviceid',
component: Jlmap3dTrain,
hidden: true
},
{
path: '/401',
component: Error401,
hidden: true
},
{ // 竞赛系统报名
path: '/jsxtApply',
component: JsxtApply,
meta: {
},
hidden: true
},
{
path: '/404',
component: Errpr404,
hidden: true
},
{ path: '*', redirect: '/404', hidden: true }
];
// 项目登录路径
GenerateRouteProjectList.forEach(item => {
constantRoutes.push({
path: `/${item}/login`,
component: Login,
hidden: true
});
constantRoutes.push({
path: `/${item}`,
redirect: `/${item}/login`,
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: '/design/displayNew/:mode',
component: DesignDisplayNew,
hidden: true
},
{ // 剧本编辑 战场图
path: '/scriptDisplay/:mode',
component: ScriptDisplay,
hidden: true
},
{ // 剧本编辑 战场图
path: '/scriptDisplayNew/:mode',
component: ScriptDisplayNew,
hidden: true
},
{
path: '/displayBigScreen/:mapId',
component: BigScreen,
hidden: true
},
{ // 综合演练室
path: '/trainroom',
component: TrainRoom,
hidden: true
},
{
path: '/jointTraining',
component: JointTraining,
hidden: true
},
{
path: '/jointTrainingNew',
component: JointTrainingNew,
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
}
]
}
];
// 城市轨道项目
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/TrainingmanageOld',
component: TrainingmanageOld,
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: '/apply',
component: Layout,
meta: {
i18n: 'router.releaseApplication',
roles: [admin]
},
children: [
{
path: 'lesson',
component: LessonApproval,
meta: {
i18n: 'router.courseApplication'
}
},
{
path: 'script',
component: ScriptApproval,
meta: {
i18n: 'router.scriptReleaseApplication'
}
},
{
path: 'runGraph',
component: RunPlanApproval,
meta: {
i18n: 'router.runGraphReleaseApplication'
}
}
]
},
{ // 新个人地图
path: '/design',
component: Layout,
meta: {
i18n: 'router.newDesignUserPage',
roles: [admin, user]
},
children: [
{
path: 'usermap',
redirect: '/design/usermap/home',
component: NewDesignPlatformUser,
meta: {
i18n: 'router.newDesignUserPage',
icon: 'design'
},
children: [
{
path: 'home',
component: DesignPlatformHome,
hidden: true,
meta: {
}
}
// { // 地图绘制
// path: 'map/draw/:mapId/:view',
// component: NewMapDraft,
// hidden: true
// }
]
},
{ // 新地图绘制
path: 'usermap/map/draw/:mapId/:view',
component: NewMapDraft,
hidden: true
},
{
path:'iscs/design',
redirect: '/iscs/design',
component: IscsDesign,
meta: {
i18n: 'router.iscsDraw',
roles: [admin]
},
children: [
{
path: 'edit/:id/:mode',
component: IscsDraw,
hidden: true
}
]
},
{
path: 'iscs/system',
redirect: '/iscs/system',
component: IscsSystem,
meta: {
i18n: 'router.iscsSystem',
roles: [admin]
},
children: [
{
path: 'config/:mode',
component: IscsConfig,
hidden: true
}
]
}
]
},
{ // iscs系统
path: '/iscs',
component: Layout,
hidden: true,
meta: {
i18n: 'router.iscsSystem',
roles: [admin]
},
children: [
{
path:'design',
component: IscsDesign,
meta: {
i18n: 'router.iscsDraw',
roles: [admin]
},
children: [
{
path: 'edit/:id/:mode',
component: IscsDraw,
hidden: true
}
]
},
{
path: 'system',
component: IscsSystem,
meta: {
i18n: 'router.iscsSystem',
roles: [admin, user]
},
children: [
{
path: 'config/:mode',
component: IscsConfig,
hidden: true
}
]
}
]
},
{
path: '/design/race',
redirect: '/design/race/manage',
component: Layout,
meta: {
i18n: 'route.raceManage',
roles: [admin]
},
children: [
{
path: 'manage',
component: RaceManage,
meta: {
i18n: 'router.raceManage',
icon: 'design'
}
}
]
}
];
export const projectRoute = {
designgzb: [
{
path: '/design/student',
redirect: '/design/student/home',
component: Layout,
meta: {
i18n: 'router.studentManage',
roles: [admin, lessonCreater]
},
children: [
{
path: 'home',
component: StudentManage,
meta: {
i18n: 'router.studentManage',
icon: 'design',
hidden: true
}
}
]
}
]
};
// 竞赛系统
export const JSXT = [
{
path: '/jsxt',
redirect: '/jsxt/home',
component: Layout,
meta: {
i18n: 'router.competitionManage',
roles: [user, admin, userTrainingPlatform]
},
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('jsxt') && !window.document.location.pathname.includes('jsxt') : !window.document.location.pathname.includes('jsxt'),
children: [
{
path: '',
redirect: '/jsxt/home',
component: CompetitionManage,
meta: {
i18n: 'router.competitionManage',
icon: 'design'
},
children: [
{
path: 'home',
component: CompetitionHome,
meta: {
hidden: true
}
},
// {
// path: 'theory/:id',
// component: theoryManage,
// meta: {
// hidden: true
// }
// },
{
path: 'examDetail',
component: CompetitionDetail,
meta: {
hidden: true
}
},
{ // 考试结果
path: 'result/:userExamId',
component: JsxtExamResult,
hidden: true
}
]
}
]
},
{
path: '/jsxt/theory/detail/:id',
component: Refereedetail,
meta: {
hidden: true
}
},
{
path: '/refereeJsxt',
component: Layout,
meta: {
i18n: 'router.homeJsxt',
roles: [user, admin]
},
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('refereeJsxt') && !window.document.location.pathname.includes('refereeJsxt') : !window.document.location.pathname.includes('refereeJsxt'),
children: [
{
path: 'preview',
component: homeJsxt,
meta: {
i18n: 'router.homeJsxt',
icon: 'design',
hidden: true
}
}
]
},
{
path: '/referee',
component: Layout,
meta: {
i18n: 'router.refereeJManage',
roles: [user, admin]
},
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('refereeJsxt') && !window.document.location.pathname.includes('refereeJsxt') : !window.document.location.pathname.includes('refereeJsxt'),
children: [
{
path: 'home',
component: RefereeList,
meta: {
i18n: 'router.refereeJManage',
icon: 'design',
hidden: true
}
}
]
},
{
path: '/referee',
component: Layout,
meta: {
i18n: 'router.recaList',
roles: [user, admin]
},
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('refereeJsxt') && !window.document.location.pathname.includes('refereeJsxt') : !window.document.location.pathname.includes('refereeJsxt'),
children: [
{
path: 'recaList',
component: RecaList,
meta: {
i18n: 'router.recaList',
icon: 'design',
hidden: true
}
}
]
}
];
const createRouter = () => new Router({
mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
});
const router = createRouter();
// 兼容 vue-router在3.1.0版本以上的路由跳转使用的是 promise 的方式
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
};
export default router;