index.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import store from '@/store/index';
  4. import { Notification } from 'element-ui';
  5. Vue.use(VueRouter);
  6. const system = [
  7. {
  8. path: '/train/batch/index',
  9. name: 'train_batch_index',
  10. meta: { title: '培训批次管理' },
  11. component: () => import('@/views/train-batch/index.vue'),
  12. },
  13. {
  14. path: '/dept/index',
  15. name: 'dept_index',
  16. meta: { title: '部门', sub: '管理' },
  17. component: () => import('@/views/dept/index.vue'),
  18. },
  19. {
  20. path: '/dept/detail',
  21. name: 'dept_detail',
  22. meta: { title: '部门', sub: '详情' },
  23. component: () => import('@/views/dept/detail.vue'),
  24. },
  25. {
  26. path: '/director/index',
  27. name: 'director_index',
  28. meta: { title: '班主任', sub: '管理' },
  29. component: () => import('@/views/director/index.vue'),
  30. },
  31. {
  32. path: '/director/detail',
  33. name: 'director_detail',
  34. meta: { title: '班主任', sub: '详情' },
  35. component: () => import('@/views/director/detail.vue'),
  36. },
  37. {
  38. path: '/director/shareInfo',
  39. name: 'director_shareInfo',
  40. meta: { title: '班主任', sub: '审核' },
  41. component: () => import('@/views/director/shareInfo.vue'),
  42. },
  43. {
  44. path: '/teacher/detail',
  45. name: 'teacher_detail',
  46. meta: { title: '教师', sub: '详情' },
  47. component: () => import('@/views/teacher/detail.vue'),
  48. },
  49. {
  50. path: '/teacher/index',
  51. name: 'teacher_index',
  52. meta: { title: '教师', sub: '管理' },
  53. component: () => import('@/views/teacher/index.vue'),
  54. },
  55. {
  56. path: '/teacher/printTea',
  57. meta: { title: '教师打印' },
  58. component: () => import('@/views/teacher/printTea.vue'),
  59. },
  60. {
  61. path: '/teacher/means',
  62. name: 'teacher_means',
  63. component: () => import('@/views/teacher/means.vue'),
  64. },
  65. {
  66. path: '/teacher/verify',
  67. name: 'teacher_verify',
  68. meta: { title: '教师', sub: '审核页' },
  69. component: () => import('@/views/teacher/verify.vue'),
  70. },
  71. {
  72. path: '/school/index',
  73. name: 'school_index',
  74. meta: { title: '学校管理', sub: '' },
  75. component: () => import('@/views/school/index.vue'),
  76. },
  77. {
  78. path: '/school/detail',
  79. name: 'school_detail',
  80. meta: { title: '学校信息', sub: '' },
  81. component: () => import('@/views/school/detail.vue'),
  82. },
  83. {
  84. path: '/class/type',
  85. name: 'class_type',
  86. meta: { title: '班级类型管理' },
  87. component: () => import('@/views/classes/type.vue'),
  88. },
  89. {
  90. path: '/location/index',
  91. name: 'location_index',
  92. meta: { title: '地点', sub: '管理' },
  93. component: () => import('@/views/location/index.vue'),
  94. },
  95. {
  96. path: '/location/detail',
  97. name: 'location_detail',
  98. meta: { title: '地点', sub: '详情' },
  99. component: () => import('@/views/location/detail.vue'),
  100. },
  101. {
  102. path: '/bedroom/index',
  103. name: 'bedroom_index',
  104. meta: { title: '寝室', sub: '管理' },
  105. component: () => import('@/views/bedroom/index.vue'),
  106. },
  107. {
  108. path: '/bedroom/detail',
  109. name: 'bedroom_detail',
  110. meta: { title: '寝室', sub: '详情' },
  111. component: () => import('@/views/bedroom/detail.vue'),
  112. },
  113. {
  114. path: '/subject/index',
  115. name: 'subject_index',
  116. meta: { title: '科目', sub: '管理' },
  117. component: () => import('@/views/subject/index.vue'),
  118. },
  119. {
  120. path: '/subject/detail',
  121. name: 'subject_detail',
  122. meta: { title: '科目', sub: '详情' },
  123. component: () => import('@/views/subject/detail.vue'),
  124. },
  125. {
  126. path: '/work/detail',
  127. name: 'work_detail',
  128. meta: { title: '作业', sub: '详情' },
  129. component: () => import('@/views/work/detail.vue'),
  130. },
  131. {
  132. path: '/work/index',
  133. name: 'work_index',
  134. meta: { title: '作业', sub: '管理' },
  135. component: () => import('@/views/work/index.vue'),
  136. },
  137. {
  138. path: '/work/look',
  139. name: 'work_look',
  140. meta: { title: '作业题', sub: '管理' },
  141. component: () => import('@/views/work/look.vue'),
  142. },
  143. {
  144. path: '/duty/index',
  145. name: 'duty_index',
  146. meta: { title: '职责', sub: '说明' },
  147. component: () => import('@/views/duty/index.vue'),
  148. },
  149. {
  150. path: '/lesson/index',
  151. name: 'lesson_index',
  152. meta: { title: '课程模板管理', sub: '' },
  153. component: () => import('@/views/lesson/index.vue'),
  154. },
  155. {
  156. path: '/lesson/detail',
  157. name: 'lesson_detail',
  158. meta: { title: '课程模板', sub: '' },
  159. component: () => import('@/views/lesson/detail.vue'),
  160. },
  161. {
  162. path: '/questionnaire/index',
  163. name: 'questionnaire_index',
  164. meta: { title: '问卷', sub: '管理' },
  165. component: () => import('@/views/questionnaire/index.vue'),
  166. },
  167. {
  168. path: '/questionnaire/export/setting',
  169. name: 'questionnaire_export_setting',
  170. meta: { title: '问卷导出设置' },
  171. component: () => import('@/views/questionnaire/export-setting.vue'),
  172. },
  173. {
  174. path: '/questionnaire/detail',
  175. name: 'questionnaire_detail',
  176. meta: { title: '问卷', sub: '详情' },
  177. component: () => import('@/views/questionnaire/detail.vue'),
  178. },
  179. {
  180. path: '/questionstate/index',
  181. name: 'questionstate_index',
  182. meta: { title: '问卷进度管理', sub: '' },
  183. component: () => import('@/views/questionstate/index.vue'),
  184. },
  185. {
  186. path: '/itembank/detail',
  187. name: 'itembank_detail',
  188. meta: { title: '题库', sub: '详情' },
  189. component: () => import('@/views/Itembank/detail.vue'),
  190. },
  191. {
  192. path: '/itembank/index',
  193. name: 'itembank_index',
  194. meta: { title: '题库', sub: '管理' },
  195. component: () => import('@/views/Itembank/index.vue'),
  196. },
  197. // {
  198. // path: '/classes/index',
  199. // name: 'classes_index',
  200. // meta: { title: '班级', sub: '管理' },
  201. // component: () => import('@/views/classes/index.vue'),
  202. // },
  203. // {
  204. // path: '/classes/detail',
  205. // name: 'classes_detail',
  206. // meta: { title: '班级', sub: '详情' },
  207. // component: () => import('@/views/classes/detail.vue'),
  208. // },
  209. {
  210. path: '/setting',
  211. name: 'setting',
  212. meta: { title: '系统邮箱设置' },
  213. component: () => import('@/views/setting/system-setting.vue'),
  214. },
  215. ];
  216. const newPlan = [
  217. {
  218. path: '/plan/index',
  219. name: 'newPlan_index',
  220. meta: { title: '年度计划管理' },
  221. component: () => import('@/views/new-plan/index.vue'),
  222. },
  223. {
  224. path: '/plan/template',
  225. name: 'newPlan_template',
  226. meta: { title: '计划模板' },
  227. component: () => import('@/views/new-plan/template.vue'),
  228. },
  229. {
  230. path: '/plan/arrange',
  231. name: 'newPlan_arrange',
  232. meta: { title: '培训计划安排' },
  233. component: () => import('@/views/new-plan/arrange/arrange.vue'),
  234. },
  235. {
  236. path: '/plan/director',
  237. name: 'newPlan_director',
  238. meta: { title: '班主任计划安排' },
  239. component: () => import('@/views/new-plan/arrange/director-arrange.vue'),
  240. },
  241. {
  242. path: '/plan/school/num',
  243. name: 'newPlan_school_num',
  244. meta: { title: '学校人数安排' },
  245. component: () => import('@/views/new-plan/arrange/school-num.vue'),
  246. },
  247. {
  248. path: '/plan/school/time',
  249. name: 'newPlan_school_time',
  250. meta: { title: '学校参培时间' },
  251. component: () => import('@/views/new-plan/arrange/school-time.vue'),
  252. },
  253. {
  254. path: '/plan/school/name/list',
  255. name: 'newPlan_school_name_list',
  256. meta: { title: '学校上报名单管理' },
  257. component: () => import('@/views/new-plan/deal-list.vue'),
  258. },
  259. {
  260. path: '/plan/school/stu/export',
  261. name: 'newPlan_school_name_list',
  262. meta: { title: '学生名单导出' },
  263. component: () => import('@/views/new-plan/stu-export.vue'),
  264. },
  265. {
  266. path: '/plan/school',
  267. name: 'newPlan_school',
  268. meta: { title: '学校计划安排' },
  269. component: () => import('@/views/new-plan/arrange/school-arrange.vue'),
  270. },
  271. {
  272. path: '/plan/classes/detail',
  273. name: 'newPlan_classes_detail',
  274. meta: { title: '班级安排' },
  275. component: () => import('@/views/new-plan/class/classes.vue'),
  276. },
  277. {
  278. path: '/plan/classes/lesson',
  279. name: 'newPlan_classes_lesson',
  280. meta: { title: '排课管理' },
  281. component: () => import('@/views/new-plan/class/lesson.vue'),
  282. },
  283. {
  284. path: '/plan/classes/setting',
  285. name: 'newPlan_classes_setting',
  286. meta: { title: '班级设置' },
  287. component: () => import('@/views/new-plan/class/setting.vue'),
  288. },
  289. {
  290. path: '/plan/classes/bedroom',
  291. name: 'newPlan_classes_bedroom',
  292. meta: { title: '分寝' },
  293. component: () => import('@/views/new-plan/class/bedroom.vue'),
  294. },
  295. {
  296. path: '/plan/classes/namelist',
  297. name: 'newPlan_classes_namelist',
  298. meta: { title: '班级人员' },
  299. component: () => import('@/views/new-plan/class/name-list.vue'),
  300. },
  301. {
  302. path: '/plan/teacher/lesson',
  303. name: 'newPlan_teacher_lesson',
  304. meta: { title: '初步课程表' },
  305. component: () => import('@/views/new-plan/teacher-lesson.vue'),
  306. },
  307. {
  308. path: '/plan/teacher/plan',
  309. name: 'newPlan_teacher_plan',
  310. meta: { title: '教师上报课程' },
  311. component: () => import('@/views/new-plan/teacher-plan.vue'),
  312. },
  313. ];
  314. const train = [
  315. //班级设置需要处理,通知
  316. {
  317. path: '/train/plan/classes',
  318. name: 'train_plan_classes',
  319. meta: { title: '学生分班' },
  320. component: () => import('@/views/train-plan/classes.vue'),
  321. },
  322. {
  323. path: '/train/plan/bedroom',
  324. name: 'train_plan_bedroom',
  325. meta: { title: '寝室管理' },
  326. component: () => import('@/views/train-plan/bedroom.vue'),
  327. },
  328. {
  329. path: '/train/plan/quest',
  330. name: 'train_plan_quest',
  331. meta: { title: '非常用问卷管理' },
  332. component: () => import('@/views/train-plan/quest.vue'),
  333. },
  334. // {
  335. // path: '/train/plan/lesson',
  336. // name: 'train_plan_lesson',
  337. // meta: { title: '课表管理管理' },
  338. // component: () => import('@/views/train-plan/lesson.vue'),
  339. // },
  340. {
  341. path: '/train/plan/term/lesson',
  342. name: 'train_plan_term_lesson',
  343. meta: { title: '期课表' },
  344. component: () => import('@/views/train-plan/term-lesson.vue'),
  345. },
  346. {
  347. path: '/train/plan/class/lesson',
  348. name: 'train_plan_class_lesson',
  349. meta: { title: '班课表' },
  350. component: () => import('@/views/train-plan/class-lesson.vue'),
  351. },
  352. {
  353. path: '/train/plan/remind',
  354. name: 'train_plan_remind',
  355. meta: { title: '通知' },
  356. component: () => import('@/views/train-plan/remind.vue'),
  357. },
  358. {
  359. path: '/train/plan/remind/detail',
  360. name: 'train_plan_remind_detail',
  361. meta: { title: '通知接收情况' },
  362. component: () => import('@/views/train-plan/remind-detail.vue'),
  363. },
  364. {
  365. path: '/student/index',
  366. name: 'student_index',
  367. meta: { title: '学生管理', sub: '' },
  368. component: () => import('@/views/student/index.vue'),
  369. },
  370. {
  371. path: '/student/detail',
  372. name: 'student_detail',
  373. meta: { title: '学生详情', sub: '' },
  374. component: () => import('@/views/student/detail.vue'),
  375. },
  376. //报表打印(部分)
  377. {
  378. path: '/train/plan/print',
  379. name: 'train_plan_print',
  380. meta: { title: '打印报表' },
  381. component: () => import('@/views/train-plan/print.vue'),
  382. },
  383. {
  384. path: '/certificaate/index',
  385. name: 'certificaate_index',
  386. meta: { title: '证书', sub: '管理' },
  387. component: () => import('@/views/certificaate/index.vue'),
  388. },
  389. {
  390. path: '/certificaate/detail',
  391. name: 'certificaate_detail',
  392. meta: { title: '证书', sub: '详情' },
  393. component: () => import('@/views/certificaate/detail.vue'),
  394. },
  395. {
  396. path: '/certificaate/look',
  397. name: 'certificaate_look',
  398. meta: { title: '证书', sub: '打印' },
  399. component: () => import('@/views/certificaate/look.vue'),
  400. },
  401. //报表打印结束
  402. {
  403. path: '/train/plan/leave',
  404. name: 'train_plan_leave',
  405. meta: { title: '请假管理' },
  406. component: () => import('@/views/train-plan/leave.vue'),
  407. },
  408. {
  409. path: '/train/plan/attendance',
  410. name: 'train_plan_attendance',
  411. meta: { title: '考勤管理' },
  412. component: () => import('@/views/train-plan/attendance.vue'),
  413. },
  414. // 07-20新增
  415. // 特殊班考勤管理
  416. {
  417. path: '/train/plan/tsbattendance',
  418. name: 'train_plan_tsbattendance',
  419. meta: { title: '特殊班考勤管理' },
  420. component: () => import('@/views/train-plan/tsbattendance.vue'),
  421. },
  422. // 特殊班学生分寝管理
  423. {
  424. path: '/train/plan/tsbbedroom',
  425. name: 'train_plan_tsbbedroom',
  426. meta: { title: '特殊班寝室管理' },
  427. component: () => import('@/views/train-plan/tsbbedroom.vue'),
  428. },
  429. {
  430. path: '/train/plan/score',
  431. name: 'train_plan_score',
  432. meta: { title: '学生成绩' },
  433. component: () => import('@/views/train-plan/score.vue'),
  434. },
  435. // 08-22
  436. // 课程培训
  437. {
  438. path: '/trainVidoe/index',
  439. name: 'trainVidoe_index',
  440. meta: { title: '课程培训' },
  441. component: () => import('@/views/trainVidoe/index.vue'),
  442. },
  443. {
  444. path: '/trainVidoe/detail',
  445. name: 'trainVidoe_detail',
  446. meta: { title: '课程培训' },
  447. component: () => import('@/views/trainVidoe/detail.vue'),
  448. },
  449. {
  450. path: '/trainVidoe/viewVideo',
  451. name: 'trainVidoe_viewVideo',
  452. meta: { title: '课程培训' },
  453. component: () => import('@/views/trainVidoe/viewVideo.vue'),
  454. },
  455. ];
  456. const statistics = [
  457. {
  458. path: '/statistics/question/index',
  459. name: 'statistics_question',
  460. meta: { title: '问卷统计' },
  461. component: () => import('@/views/statistics/index.vue'),
  462. },
  463. {
  464. path: '/statistics/question/detail',
  465. name: 'statistics_question_detail',
  466. meta: { title: '问卷统计' },
  467. component: () => import('@/views/statistics/detail.vue'),
  468. },
  469. {
  470. path: '/statistics/question/class',
  471. name: 'statistics_question_class',
  472. meta: { title: '问卷-按班级统计' },
  473. component: () => import('@/views/statistics/class-index.vue'),
  474. },
  475. {
  476. path: '/statistics/nostu',
  477. name: 'statistics_nostu',
  478. meta: { title: '问卷-未答学生统计' },
  479. component: () => import('@/views/statistics/nostu.vue'),
  480. },
  481. ];
  482. const routes = [
  483. {
  484. path: '',
  485. component: () => import('@/views/index.vue'),
  486. children: [
  487. {
  488. path: '/',
  489. name: 'home',
  490. component: () => import('@/views/home.vue'),
  491. },
  492. ...system,
  493. ...newPlan,
  494. ...train,
  495. ...statistics,
  496. {
  497. path: '/list',
  498. name: 'test_list',
  499. component: () => import('@/views/test/list.vue'),
  500. },
  501. {
  502. path: '/detail',
  503. name: 'test_detail',
  504. component: () => import('@/views/test/detail.vue'),
  505. },
  506. {
  507. path: '/receive/index',
  508. name: 'receive_index',
  509. meta: { title: '通知查看' },
  510. component: () => import('@/views/receive/index.vue'),
  511. },
  512. // 在线授课管理
  513. {
  514. path: '/centerTeaching/index',
  515. name: 'centerTeaching_index',
  516. meta: { title: '直播讲课' },
  517. component: () => import('@/views/centerTeaching/index.vue'),
  518. },
  519. {
  520. path: '/centerTeaching/afterClass',
  521. name: 'centerTeaching_afterClass',
  522. meta: { title: '课后答疑' },
  523. component: () => import('@/views/centerTeaching/afterClass.vue'),
  524. },
  525. // 积分榜
  526. {
  527. path: '/league/index',
  528. name: 'league_index',
  529. meta: { title: '课后答疑' },
  530. component: () => import('@/views/league/index.vue'),
  531. },
  532. // 09-24
  533. {
  534. path: '/newspaper/index',
  535. name: 'newspaper_index',
  536. meta: { title: '新人才报' },
  537. component: () => import('@/views/newspaper/index.vue'),
  538. },
  539. ],
  540. },
  541. {
  542. path: '/teacher/printTea',
  543. meta: { title: '教师打印预览' },
  544. component: () => import('@/views/teacher/printTea.vue'),
  545. },
  546. {
  547. path: '/yearPlan/index',
  548. name: 'yearPlan_index',
  549. meta: { title: '全年计划', sub: '管理' },
  550. component: () => import('@/views/yearPlan/index.vue'),
  551. },
  552. // {
  553. // path: '/student/name/card',
  554. // name: 'student_name_card',
  555. // meta: { title: '学生名签' },
  556. // component: () => import('@/views/student/namCard.vue'),
  557. // },
  558. // 教师甄选注册账号
  559. {
  560. path: '/teaRegister',
  561. name: 'teaRegister',
  562. meta: { title: '教师注册', sub: '管理' },
  563. component: () => import('@/views/register/teaRegister.vue'),
  564. },
  565. {
  566. path: '/login',
  567. name: 'login',
  568. meta: { title: '登录', sub: '管理' },
  569. component: () => import('@/views/register/login.vue'),
  570. },
  571. ];
  572. const router = new VueRouter({
  573. mode: 'history',
  574. base: process.env.NODE_ENV === 'development' ? '' : 'center',
  575. routes,
  576. });
  577. router.beforeEach((to, form, next) => {
  578. store.commit('setUser');
  579. store.dispatch('setting/checkCache');
  580. if (to.name === 'login') {
  581. next();
  582. return;
  583. }
  584. let user = store.state.user;
  585. if (user) {
  586. if (user.type == process.env.VUE_APP_USER_TYPE) {
  587. console.log('已登录');
  588. next();
  589. } else {
  590. Notification({
  591. title: '请重新登陆',
  592. message: `原因:非当前端用户,需要重新登陆`,
  593. type: 'warning',
  594. });
  595. console.warn('非当前端用户,需要重新登陆');
  596. next({ name: 'login' });
  597. }
  598. }
  599. //下面是没登录的情况,需要跳转页面到用户未登录页
  600. else next({ name: 'login' });
  601. });
  602. export default router;