examtest/test_client/src/router/index.js

405 lines
12 KiB
JavaScript

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 <keep-alive> (must set!!!)
* meta : {
perms: ['admin','editor'] control the page perms (you can set multiple perms)
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
}
*/
/**
* constantRoutes
* a base page that does not have permission requirements
* all perms can be accessed
*/
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/404'),
hidden: true
}
]
/**
* asyncRoutes
* the routes that need to be dynamically loaded based on user perms
*/
export const asyncRoutes = [
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [{
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard', perms:['admin'] }
}]
},
{
path: '/cms',
component: Layout,
redirect: '/cms/materials',
name: 'CMS',
meta: { title: '资料文章', icon: 'documentation', perms: ['news_view'] },
children: [
{
path: 'news',
name: 'NewsList',
component: () => import('@/views/news/news.vue'),
meta: { title: '文章列表', icon: 'documentation', perms: ['news_view'] }
},
{
path: 'materials',
name: 'MaterialList',
component: () => import('@/views/material/material.vue'),
meta: { title: '学习资料', icon: 'documentation', perms: ['material_view'] }
},
{
path: 'news/create',
name: 'NewsCreate',
component: () => import('@/views/news/newscreate.vue'),
meta: { title: '新建文章', noCache: true, icon: '', perms: ['news_create']},
hidden: true
},
{
path: 'news/update',
name: 'NewsUpdate',
component: () => import('@/views/news/newsupdate.vue'),
meta: { title: '编辑文章', noCache: true, icon: '', perms: ['news_update']},
hidden: true
},
]
},
{
path: '/vod',
component: Layout,
redirect: '/vod/index',
name: 'Vod',
meta: { title: '课程视频', icon: 'shopping', perms: ['vod'] },
children: [
{
path: 'index',
name: 'VodIndex',
component: () => import('@/views/vod/index.vue'),
meta: { title: '课程视频', icon: '', perms: ['vod'] }
},
]
},
{
path: '/crm',
component: Layout,
redirect: '/crm/consumer',
name: 'Crm',
meta: { title: '客户管理', icon: 'peoples', perms: ['consumer_view'] },
children: [
{
path: 'company',
name: 'Company',
component: () => import('@/views/crm/company.vue'),
meta: { title: '客户企业', icon: '', perms: ['company_view'] }
},
{
path: 'consumer',
name: 'Consumer',
component: () => import('@/views/crm/consumer.vue'),
meta: { title: '学员列表', icon: '', perms: ['consumer_view'] }
},
{
path: 'claim',
name: 'Claim',
component: () => import('@/views/crm/claim.vue'),
meta: { title: '认领学员', icon: '', perms: ['consumer_claim'] }
},
{
path: 'candidate',
name: 'Candidate',
component: () => import('@/views/analyse/candidate.vue'),
meta: { title: '报告单查询', icon: '', perms: ['candidate_search'] }
},
{
path: 'consumerrule',
name: 'ConsumerRule',
component: () => import('@/views/crm/consumerrole.vue'),
meta: { title: '客户角色', icon: '', perms: ['consumerrole_view'] }
},
]
},
{
path: '/Qmanage',
component: Layout,
redirect: '/Qmanage/question',
name: 'Qmanage',
meta: { title: '题库管理', icon: 'table'},
children: [
{
path: 'subject',
name: 'subject',
component: () => import('@/views/question/subject.vue'),
meta: { title: '学科分类', icon: '', perms: ['subject_manage'] }
},
{
path: 'questioncat',
name: 'questioncat',
component: () => import('@/views/question/questioncat.vue'),
meta: { title: '科目分类', icon: '', perms: ['questioncat_manage'] }
},
{
path: 'question',
name: 'question',
component: () => import('@/views/question/question.vue'),
meta: { title: '题目列表', icon: '', perms: ['question_view'] }
},
{
path: 'question/create',
name: 'CreateQuestion',
component: () => import('@/views/question/questioncreate.vue'),
meta: { title: '新建题目', noCache: true, icon: '', perms: ['question_create']},
hidden: true
},
{
path: 'question/update',
name: 'UpdateQuestion',
component: () => import('@/views/question/questionupdate.vue'),
meta: { title: '编辑题目', noCache: true, icon: '', perms: ['question_update']},
hidden: true
}
]
},
{
path: '/sjmanage',
component: Layout,
redirect: '/sjmanage/workscope',
name: 'Sjmanage',
meta: { title: '出卷管理', icon: 'component', perms: []},
children: [
{
path: 'testrule',
name: 'TestRule',
component: () => import('@/views/examtest/rule.vue'),
meta: { title: '试卷结构', icon: '', perms: ['testrule_manage'] },
},
{
path: 'workscope',
name: 'workscope',
component: () => import('@/views/examtest/workscope.vue'),
meta: { title: '工作类别', icon: '', perms: ['workscope_manage'] },
},
{
path: 'testpaper',
name: 'testpaper',
component: () => import('@/views/examtest/paper.vue'),
meta: { title: '押题试卷', icon: '', perms: ['paper_manage'] }
},
{
path: 'testrule/create',
name: 'CreateRule',
component: () => import('@/views/examtest/rulecreate.vue'),
meta: { title: '新建试卷结构', noCache: true, icon: '', perms: ['testrule_add']},
hidden: true
},
{
path: 'testrule/update',
name: 'UpdateRule',
component: () => import('@/views/examtest/ruleupdate.vue'),
meta: { title: '编辑试卷结构', noCache: true, icon: '', perms: ['testrule_update']},
hidden: true
},
{
path: 'workscope/create',
name: 'CreateWorkscope',
component: () => import('@/views/examtest/workscopecreate.vue'),
meta: { title: '新建工作类别', noCache: true, icon: '', perms: ['workscope_add']},
hidden: true
},
{
path: 'workscope/update',
name: 'UpdateWorkscope',
component: () => import('@/views/examtest/workscopeupdate.vue'),
meta: { title: '编辑工作类别', noCache: true, icon: '', perms: ['workscope_update']},
hidden: true
},
{
path: 'paper/create',
name: 'CreatePaper',
component: () => import('@/views/examtest/papercreate.vue'),
meta: { title: '新建押题试卷', noCache: true, icon: '', perms: ['paper_add']},
hidden: true
},
{
path: 'paper/update',
name: 'UpdatePaper',
component: () => import('@/views/examtest/paperupdate.vue'),
meta: { title: '编辑押题试卷', noCache: true, icon: '', perms: ['paper_update']},
hidden: true
},
]
},
{
path: '/exammanage',
component: Layout,
redirect: '/exammanage/index',
name: 'Exammanage',
meta: { title: '考证管理', icon: 'component'},
children: [
{
path: 'index',
name: 'exam',
component: () => import('@/views/exam/index.vue'),
meta: { title: '正式考试', perms: ['exam_view'] }
},
{
path: 'issue',
name: 'issue',
component: () => import('@/views/exam/issue.vue'),
meta: { title: '出证记录', perms: ['certificate_view'] }
},
]
},
{
path: '/analyse',
component: Layout,
redirect: '/analyse/examtest',
name: 'Analyse',
meta: { title: '统计分析', icon: 'chart', perms: ['examtest_view']},
children: [
{
path: 'examtest',
name: 'ExamTest',
component: () => import('@/views/analyse/examtest.vue'),
meta: { title: '模考答卷', icon: '', perms: ['examtest_view'] }
},
{
path: 'examtest2',
name: 'ExamTest2',
component: () => import('@/views/analyse/examtest2.vue'),
meta: { title: '正式考试答卷', icon: '', perms: ['examtest_view'] }
},
{
path: 'chart',
name: 'chart',
component: () => import('@/views/analyse/chart.vue'),
meta: { title: '图表分析', icon: '', perms: ['chart_manage'] }
},
]
},
// {
// path: '/qtest',
// component: Layout,
// redirect: '/qtest/consult',
// name: 'Qtest',
// meta: { title: '铅当量检测', icon: '', perms: ['qtest_view']},
// children: [
// {
// path: 'consult',
// name: 'Consult',
// component: () => import('@/views/qtest/consult.vue'),
// meta: { title: '铅当量检测', icon: 'eye-open', perms: ['qtest_view'] }
// },
// ]
// },
{
path: '/system',
component: Layout,
redirect: '/system/admin',
name: 'System',
meta: { title: '系统管理', icon: 'tree', perms:[] },
children: [
{
path: 'banner',
name: 'Banner',
component: () => import('@/views/system/banner.vue'),
meta: { title: '轮播图', icon: '', perms: ['banner_manage'] }
},
{
path: 'admin',
name: 'Admin',
component: () => import('@/views/system/admin.vue'),
meta: { title: '管理员', icon: '', perms: ['admin_manage'] }
},
{
path: 'role',
name: 'Role',
component: () => import('@/views/system/role'),
meta: { title: '管理员角色', icon: '', perms: ['role_manage'] }
},
{
path: 'msg',
name: 'Msg',
component: () => import('@/views/system/msg'),
meta: { title: '短信发送', icon: '', perms: ['msg_view'] }
},
// {
// path: 'user/password',
// name: 'ChangePassword',
// component: () => import('@/views/system/changepassword'),
// meta: { title: '修改密码', noCache: true, icon: ''},
// hidden: true
// },
]
},
{
path: '/changepassword',
component: Layout,
redirect: '/changepassword',
name: 'ChangePW',
meta: { title: '修改密码', icon: 'tree' },
hidden:true,
children: [
{
path: '',
name: 'ChangePassword',
component: () => import('@/views/system/changepassword'),
meta: { title: '修改密码', noCache: true, icon: ''},
hidden: true
},
]
},
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router