123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- import Vue from 'vue';
- import VueRouter from 'vue-router';
- import store from '@/store/index';
- Vue.use(VueRouter);
- const routes = [
- {
- path: '/',
- name: 'frame',
- component: () => import('@/views/index.vue'),
- children: [
- {
- path: '/list',
- name: 'test_list',
- component: () => import('@/views/test/list.vue'),
- },
- {
- path: '/detail',
- name: 'test_detail',
- component: () => import('@/views/test/detail.vue'),
- },
- {
- path: '/itembank/detail',
- name: 'itembank_detail',
- meta: { title: '题库', sub: '详情' },
- component: () => import('@/views/Itembank/detail.vue'),
- },
- {
- path: '/itembank/index',
- name: 'itembank_index',
- meta: { title: '题库', sub: '管理' },
- component: () => import('@/views/Itembank/index.vue'),
- },
- // {
- // path: '/questionstate/detail',
- // name: 'questionstate_detail',
- // meta: { title: '问卷状态', sub: '详情' },
- // component: () => import('@/views/questionstate/detail.vue'),
- // },
- {
- path: '/questionstate/index',
- name: 'questionstate_index',
- meta: { title: '问卷状态', sub: '管理' },
- component: () => import('@/views/questionstate/index.vue'),
- },
- {
- path: '/certificaate/index',
- name: 'certificaate_index',
- meta: { title: '证书', sub: '管理' },
- component: () => import('@/views/certificaate/index.vue'),
- },
- {
- path: '/certificaate/detail',
- name: 'certificaate_detail',
- meta: { title: '证书', sub: '详情' },
- component: () => import('@/views/certificaate/detail.vue'),
- },
- {
- path: '/certificaate/look',
- name: 'certificaate_look',
- meta: { title: '证书', sub: '打印' },
- component: () => import('@/views/certificaate/look.vue'),
- },
- {
- path: '/questionnaire/index',
- name: 'questionnaire_index',
- meta: { title: '问卷', sub: '管理' },
- component: () => import('@/views/questionnaire/index.vue'),
- },
- {
- path: '/questionnaire/detail',
- name: 'questionnaire_detail',
- meta: { title: '问卷', sub: '详情' },
- component: () => import('@/views/questionnaire/detail.vue'),
- },
- {
- path: '/teacher/detail',
- name: 'teacher_detail',
- meta: { title: '教师', sub: '详情' },
- component: () => import('@/views/teacher/detail.vue'),
- },
- {
- path: '/teacher/index',
- name: 'teacher_index',
- meta: { title: '教师', sub: '管理' },
- component: () => import('@/views/teacher/index.vue'),
- },
- {
- path: '/teacher/means',
- name: 'teacher_means',
- component: () => import('@/views/teacher/means.vue'),
- },
- {
- path: '/teacher/verify',
- name: 'teacher_verify',
- meta: { title: '教师', sub: '审核页' },
- component: () => import('@/views/teacher/verify.vue'),
- },
- {
- path: '/work/detail',
- name: 'work_detail',
- meta: { title: '作业', sub: '详情' },
- component: () => import('@/views/work/detail.vue'),
- },
- {
- path: '/work/index',
- name: 'work_index',
- meta: { title: '作业', sub: '管理' },
- component: () => import('@/views/work/index.vue'),
- },
- {
- path: '/work/look',
- name: 'work_look',
- meta: { title: '作业题', sub: '管理' },
- component: () => import('@/views/work/look.vue'),
- },
- {
- path: '/subject/index',
- name: 'subject_index',
- meta: { title: '科目', sub: '管理' },
- component: () => import('@/views/subject/index.vue'),
- },
- {
- path: '/subject/detail',
- name: 'subject_detail',
- meta: { title: '科目', sub: '详情' },
- component: () => import('@/views/subject/detail.vue'),
- },
- {
- path: '/director/index',
- name: 'director_index',
- meta: { title: '班主任', sub: '管理' },
- component: () => import('@/views/director/index.vue'),
- },
- {
- path: '/director/detail',
- name: 'director_detail',
- meta: { title: '班主任', sub: '详情' },
- component: () => import('@/views/director/detail.vue'),
- },
- {
- path: '/dept/index',
- name: 'dept_index',
- meta: { title: '部门', sub: '管理' },
- component: () => import('@/views/dept/index.vue'),
- },
- {
- path: '/dept/detail',
- name: 'dept_detail',
- meta: { title: '部门', sub: '详情' },
- component: () => import('@/views/dept/detail.vue'),
- },
- {
- path: '/duty/index',
- name: 'duty_index',
- meta: { title: '职责', sub: '说明' },
- component: () => import('@/views/duty/index.vue'),
- },
- {
- path: '/location/index',
- name: 'location_index',
- meta: { title: '地点', sub: '管理' },
- component: () => import('@/views/location/index.vue'),
- },
- {
- path: '/location/detail',
- name: 'location_detail',
- meta: { title: '地点', sub: '详情' },
- component: () => import('@/views/location/detail.vue'),
- },
- {
- path: '/bedroom/index',
- name: 'bedroom_index',
- meta: { title: '寝室', sub: '管理' },
- component: () => import('@/views/bedroom/index.vue'),
- },
- {
- path: '/bedroom/detail',
- name: 'bedroom_detail',
- meta: { title: '寝室', sub: '详情' },
- component: () => import('@/views/bedroom/detail.vue'),
- },
- {
- path: '/classes/index',
- name: 'classes_index',
- meta: { title: '班级', sub: '管理' },
- component: () => import('@/views/classes/index.vue'),
- },
- {
- path: '/classes/detail',
- name: 'classes_detail',
- meta: { title: '班级', sub: '详情' },
- component: () => import('@/views/classes/detail.vue'),
- },
- {
- path: '/student/index',
- name: 'student_index',
- meta: { title: '学生', sub: '管理' },
- component: () => import('@/views/student/index.vue'),
- },
- {
- path: '/student/detail',
- name: 'student_detail',
- meta: { title: '学生', sub: '详情' },
- component: () => import('@/views/student/detail.vue'),
- },
- {
- path: '/plan/index',
- name: 'plan_index',
- meta: { title: '计划', sub: '管理' },
- component: () => import('@/views/plan/index.vue'),
- },
- {
- path: '/plan/detail',
- name: 'plan_detail',
- meta: { title: '计划', sub: '详情' },
- component: () => import('@/views/plan/detail.vue'),
- },
- {
- path: '/plan/classes',
- name: 'plan_classes',
- meta: { title: '安排', sub: '班级' },
- component: () => import('@/views/plan/classes.vue'),
- },
- {
- path: '/plan/lesson',
- name: 'plan_lesson',
- meta: { title: '安排', sub: '课程' },
- component: () => import('@/views/plan/lesson.vue'),
- },
- {
- path: '/plan/msg',
- name: 'plan_msg',
- meta: { title: '发送', sub: '通知' },
- component: () => import('@/views/plan/msg.vue'),
- },
- {
- path: '/plan/question',
- name: 'plan_question',
- meta: { title: '问卷', sub: '管理' },
- component: () => import('@/views/plan/question.vue'),
- },
- ],
- },
- {
- path: '/yearPlan/index',
- name: 'yearPlan_index',
- meta: { title: '全年计划', sub: '管理' },
- component: () => import('@/views/yearPlan/index.vue'),
- },
- ];
- const router = new VueRouter({
- mode: 'history',
- base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROOT_URL + 'center',
- routes,
- });
- router.beforeEach((to, form, next) => {
- store.commit('setUser');
- let user = store.state.user;
- if (user) {
- if (user.type == process.env.VUE_APP_USER_TYPE) {
- console.log('缓存登陆');
- next();
- } else {
- console.error('非当前端用户,需要重新登陆');
- // next('/login'); //TODO 跳转至登陆页
- }
- }
- //下面是没登录的情况,需要跳转页面到用户未登录页
- else next();
- });
- export default router;
|