router.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import Vue from 'vue';
  2. import Router from 'vue-router';
  3. import { getAuth } from '@/utils/auth';
  4. import { getGuide } from '@/utils/guide';
  5. import {
  6. getTenantCode, getSystemConfig,
  7. getUserIcon, shitiStatusControl,
  8. saveHistoryPaths,
  9. } from '@/utils/common';
  10. Vue.use(Router);
  11. const originalPush = Router.prototype.push
  12. Router.prototype.push = function push (location) {
  13. return originalPush.call(this, location).catch(err => err)
  14. };
  15. const router = new Router({
  16. mode: 'history',
  17. base: process.env.BASE_URL,
  18. routes: [
  19. {
  20. path: '/',
  21. redirect: '/c/index',
  22. },
  23. {
  24. name: 'Login',
  25. path: '/login',
  26. component: () => {
  27. return import(/* webpackChunkName: "Login" */ './views/management/Login/index.vue');
  28. },
  29. },
  30. {
  31. path:'/c/',
  32. component: () => import(/* webpackChunkName: "Cframe" */ './components/client/common/Cframe.vue'),
  33. children: [
  34. {
  35. name: 'index',
  36. path: 'index',
  37. component: () => {
  38. return import(/* webpackChunkName: "index" */ './views/client/Index.vue');
  39. },
  40. },
  41. {
  42. name: 'examPlatform',
  43. path: 'examPlatform',
  44. meta: {
  45. parentPath: 'croot',
  46. breadcrumb: {
  47. display: '考试平台',
  48. },
  49. },
  50. component: () => {
  51. return import(/* webpackChunkName: "examPlatform" */ './views/client/examPlatform.vue');
  52. },
  53. },
  54. {
  55. name: 'peixunPlatform',
  56. path: 'peixunPlatform',
  57. meta: {
  58. parentPath: 'croot',
  59. breadcrumb: {
  60. display: '培训平台',
  61. },
  62. },
  63. component: () => {
  64. return import(/* webpackChunkName: "peixunPlatform" */ './views/client/peixunPlatform.vue');
  65. },
  66. },
  67. {
  68. name: 'courseDev',
  69. path: 'courseDev',
  70. meta: {
  71. parentPath: 'croot',
  72. breadcrumb: {
  73. display: '课程列表',
  74. },
  75. },
  76. component: () => {
  77. return import(/* webpackChunkName: "incourseDevdex" */ './views/client/CourseDev.vue');
  78. },
  79. },
  80. {
  81. name: 'newsInfor',
  82. path: 'newsInfor',
  83. meta: {
  84. parentPath: 'croot',
  85. breadcrumb: {
  86. display: '新闻资讯',
  87. },
  88. },
  89. component: () => {
  90. return import(/* webpackChunkName: "newsInfor" */ './views/client/newsInfor.vue');
  91. },
  92. },
  93. {
  94. name: 'helpCenter',
  95. path: 'helpCenter',
  96. meta: {
  97. parentPath: 'croot',
  98. breadcrumb: {
  99. display: '帮助中心',
  100. },
  101. },
  102. component: () => {
  103. return import(/* webpackChunkName: "helpCenter" */ './views/client/helpCenter.vue');
  104. },
  105. },
  106. {
  107. name: 'aboutUs',
  108. path: 'aboutUs',
  109. meta: {
  110. parentPath: 'croot',
  111. breadcrumb: {
  112. display: '关于我们',
  113. },
  114. },
  115. component: () => {
  116. return import(/* webpackChunkName: "aboutUs" */ './views/client/aboutUs.vue');
  117. },
  118. },
  119. {
  120. path: 'newsInforDetails',
  121. name: 'newsInforDetails',
  122. meta: {
  123. parentPath: 'croot',
  124. breadcrumb: {
  125. display: '行业详情',
  126. },
  127. },
  128. component: () => {
  129. return import(/* webpackChunkName: "newsInforDetails" */ './views/client/newsInforDetails.vue');
  130. },
  131. },
  132. ],
  133. },
  134. {
  135. name: 'admin',
  136. path: '/admin',
  137. meta: {
  138. icon: "el-icon-platform-eleme",
  139. title: "页面管理"
  140. },
  141. isAdminMenu: true,
  142. component: () => {
  143. return import(/* webpackChunkName: "Home" */ './views/management/Home/index.vue');
  144. },
  145. children: [
  146. {
  147. path: '/news',
  148. name: 'news',
  149. meta: {
  150. icon: "",
  151. title: "新闻资讯"
  152. },
  153. isAdminMenu: true,
  154. component: () => {
  155. return import(/* webpackChunkName: "HangYeZiXun" */ './views/management/XingWenZiXun/index.vue');
  156. },
  157. },
  158. {
  159. path: '/news/config',
  160. name: 'newsConfig',
  161. component: () => {
  162. return import(/* webpackChunkName: "HangYeZiXun" */ './views/management/XingWenZiXun/XinWenZiXunConfig/index.vue');
  163. },
  164. },
  165. {
  166. path: '/blogroll',
  167. name: 'blogroll',
  168. meta: {
  169. icon: "",
  170. title: "友情链接"
  171. },
  172. isAdminMenu: true,
  173. component: () => {
  174. return import(/* webpackChunkName: "HangYeZiXun" */ './views/management/YouQingLianJie/index.vue');
  175. },
  176. },
  177. {
  178. path: '/newsClassify',
  179. name: 'newsClassify',
  180. meta: {
  181. icon: "",
  182. title: "新闻分类"
  183. },
  184. isAdminMenu: true,
  185. component: () => {
  186. return import(/* webpackChunkName: "HangYeZiXun" */ './views/management/XinWenFenLei/index.vue');
  187. },
  188. },
  189. ],
  190. },
  191. ],
  192. });
  193. router.beforeEach((to, from, next) => {
  194. // FIXME 标题 待确认
  195. document.title = to.meta.title ? '麦塔': '麦塔';
  196. next();
  197. });
  198. export default router;