index.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Layout from '@/layout'
  4. import store from '@/store'
  5. Vue.use(VueRouter)
  6. const routes = [
  7. {
  8. path: '/',
  9. component: Layout,
  10. children: [
  11. {
  12. path: '',
  13. name: 'Index',
  14. component: () => import('@/views/Home/HomeIndex.vue'),
  15. meta: {
  16. title: '首页'
  17. }
  18. },
  19. {
  20. path: 'policyadvice',
  21. name: 'PolicyAdvice',
  22. component: () => import('@/views/PolicyAdvice/PolicyAdviceIndex.vue'),
  23. meta: {
  24. title: '政策咨询'
  25. }
  26. },
  27. {
  28. path: 'recruitmentemployment',
  29. name: 'RecruitmentEmploymentIndex',
  30. component: () =>
  31. import(
  32. '@/views/RecruitmentEmployment/RecruitmentEmploymentIndex.vue'
  33. ),
  34. meta: {
  35. title: '招聘就业'
  36. }
  37. },
  38. {
  39. path: 'cooperativeenterprise',
  40. name: 'CooperativeEnterpriseIndex',
  41. component: () =>
  42. import(
  43. '@/views/CooperativeEnterprise/CooperativeEnterpriseIndex.vue'
  44. ),
  45. meta: {
  46. title: '合作企业'
  47. }
  48. },
  49. {
  50. path: 'enterprisedetails',
  51. name: 'EnterpriseDetailsIndex',
  52. component: () =>
  53. import(
  54. '@/views/CooperativeEnterprise/EnterpriseDetails/EnterpriseDetailsIndex.vue'
  55. ),
  56. meta: {
  57. title: '企业详情'
  58. }
  59. },
  60. {
  61. path: 'enterprisePosition',
  62. name: 'EnterprisePositionIndex',
  63. component: () =>
  64. import(
  65. '@/views/CooperativeEnterprise/EnterprisePosition/EnterprisePositionIndex.vue'
  66. ),
  67. meta: {
  68. title: '职位详情'
  69. }
  70. },
  71. {
  72. path: 'cooperativecolleges',
  73. name: 'CooperativeCollegesIndex',
  74. component: () =>
  75. import('@/views/CooperativeColleges/CooperativeCollegesIndex.vue'),
  76. meta: {
  77. title: '合作院校'
  78. }
  79. },
  80. {
  81. path: 'collegesdetails',
  82. name: 'CollegesDetailsIndex',
  83. component: () =>
  84. import(
  85. '@/views/CooperativeColleges/CollegesDetails/CollegesDetailsIndex.vue'
  86. ),
  87. meta: {
  88. title: '院校详情'
  89. }
  90. },
  91. {
  92. path: 'skilltraining',
  93. name: 'SkillTrainingIndex',
  94. component: () => import('@/views/SkillTraining/SkillTrainingIndex.vue'),
  95. meta: {
  96. title: '技能培训'
  97. }
  98. },
  99. {
  100. path: 'coursevideo',
  101. name: 'CourseVideoIndex',
  102. component: () => import('@/views/SkillTraining/CourseVideo/CourseVideoIndex.vue'),
  103. meta: {
  104. title: '课程详情'
  105. }
  106. },
  107. {
  108. path: 'workguide',
  109. name: 'WorkGuideIndex',
  110. component: () => import('@/views/WorkGuide/WorkGuideIndex.vue'),
  111. meta: {
  112. title: '创业指引'
  113. }
  114. },
  115. {
  116. path: 'educationpromote',
  117. name: 'EducationPromoteIndex',
  118. component: () =>
  119. import('@/views/EducationPromote/EducationPromoteIndex.vue'),
  120. meta: {
  121. title: '学历提升'
  122. }
  123. },
  124. {
  125. path: 'adaptivetraining',
  126. name: 'AdaptiveTrainingIndex',
  127. component: () =>
  128. import('@/views/AdaptiveTraining/AdaptiveTrainingIndex.vue'),
  129. meta: {
  130. title: '适应性培训'
  131. }
  132. },
  133. {
  134. path: 'adaptivetraining/onlinecoursedetails',
  135. name: 'OnlineCourseDetailsIndex',
  136. component: () =>
  137. import('@/views/AdaptiveTraining/OnlineCourseDetails/OnlineCourseDetailsIndex.vue'),
  138. meta: {
  139. title: '线上课程详情'
  140. }
  141. },
  142. {
  143. path: 'personalcenter',
  144. name: 'PersonalCenterIndex',
  145. component: () =>
  146. import('@/views/PersonalCenter/PersonalCenterIndex.vue'),
  147. meta: {
  148. title: '我的'
  149. }
  150. },
  151. {
  152. path: 'personalcenter/setting',
  153. name: 'SettingIndex',
  154. component: () =>
  155. import('@/views/PersonalCenter/Setting/SettingIndex.vue'),
  156. meta: {
  157. title: '设置'
  158. }
  159. },
  160. {
  161. path: 'personalcenter/resume',
  162. name: 'ResumeIndex',
  163. component: () =>
  164. import('@/views/PersonalCenter/Resume/ResumeIndex.vue'),
  165. meta: {
  166. title: '我的简历'
  167. }
  168. },
  169. {
  170. path: 'personalcenter/resumeEdit',
  171. name: 'ResumeEdit',
  172. component: () =>
  173. import('@/views/PersonalCenter/Resume/ResumeEdit.vue'),
  174. meta: {
  175. title: '编辑简历'
  176. }
  177. },
  178. {
  179. path: 'personalcenter/deliver',
  180. name: 'DeliverIndex',
  181. component: () =>
  182. import('@/views/PersonalCenter/Deliver/DeliverIndex.vue'),
  183. meta: {
  184. title: '我的投递'
  185. }
  186. },
  187. {
  188. path: 'personalcenter/interview',
  189. name: 'InterviewIndex',
  190. component: () =>
  191. import('@/views/PersonalCenter/Interview/InterviewIndex.vue'),
  192. meta: {
  193. title: '我的面试'
  194. }
  195. },
  196. {
  197. path: 'personalcenter/evaluate',
  198. name: 'EvaluateIndex',
  199. component: () =>
  200. import('@/views/PersonalCenter/Evaluate/EvaluateIndex.vue'),
  201. meta: {
  202. title: '我的评价'
  203. }
  204. },
  205. {
  206. path: 'personalcenter/skilltraining',
  207. name: 'SkillTrainingIndex',
  208. component: () =>
  209. import('@/views/PersonalCenter/SkillTraining/SkillTrainingIndex.vue'),
  210. meta: {
  211. title: '我的技能培训'
  212. }
  213. },
  214. {
  215. path: 'personalcenter/skillsTrainingDetails',
  216. name: 'SkillsTrainingDetails',
  217. component: () =>
  218. import('@/views/PersonalCenter/SkillTraining/SkillsTrainingDetails.vue'),
  219. meta: {
  220. title: '我的技能培训-详情'
  221. }
  222. },
  223. {
  224. path: 'personalcenter/progresspoints',
  225. name: 'ProgressPointsIndex',
  226. component: () =>
  227. import('@/views/PersonalCenter/ProgressPoints/ProgressPointsIndex.vue'),
  228. meta: {
  229. title: '进步积分'
  230. }
  231. },
  232. {
  233. path: 'applyeducationauth',
  234. name: 'ApplyEducationAuthIndex',
  235. component: () =>
  236. import('@/views/PersonalCenter/ApplyEducationAuth/ApplyEducationAuthIndex.vue'),
  237. meta: {
  238. title: '退役军人认证'
  239. }
  240. },
  241. {
  242. path: 'newscenter',
  243. name: 'NewsCenterIndex',
  244. component: () =>
  245. import('@/views/NewsCenter/NewsCenterIndex.vue'),
  246. meta: {
  247. title: '新闻中心'
  248. }
  249. },
  250. {
  251. path: 'newsdetails',
  252. name: 'NewsDetailsIndex',
  253. component: () =>
  254. import('@/views/NewsCenter/NewsDetails/NewsDetailsIndex.vue'),
  255. meta: {
  256. title: '新闻详情'
  257. }
  258. },
  259. {
  260. path: 'noticedetails',
  261. name: 'NoticeDetailsIndex',
  262. component: () =>
  263. import('@/views/NewsCenter/NoticeDetails/NoticeDetailsIndex.vue'),
  264. meta: {
  265. title: '通知详情'
  266. }
  267. }
  268. ]
  269. },
  270. {
  271. path: '/login',
  272. name: 'Login',
  273. component: () => import('@/views/Login/LoginIndex.vue'),
  274. meta: {
  275. title: '登录'
  276. }
  277. }
  278. ]
  279. const router = new VueRouter({
  280. mode: 'history',
  281. routes
  282. })
  283. router.beforeEach((to, from, next) => {
  284. /* 路由发生变化修改页面title */
  285. if (to.meta.title) {
  286. document.title = to.meta.title
  287. }
  288. if (store.state.user.token && !store.state.user.isLogin) {
  289. store.dispatch('GetUserInfo')
  290. }
  291. next()
  292. })
  293. export default router