router.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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: 'examsystem',
  43. path: 'examsystem',
  44. meta: {
  45. parentPath: 'croot',
  46. breadcrumb: {
  47. display: '考试平台',
  48. },
  49. },
  50. component: () => {
  51. return import(/* webpackChunkName: "examsystem" */ './views/client/examsystem.vue');
  52. },
  53. },
  54. {
  55. name: 'trainsystem',
  56. path: 'trainsystem',
  57. meta: {
  58. parentPath: 'croot',
  59. breadcrumb: {
  60. display: '培训平台',
  61. },
  62. },
  63. component: () => {
  64. return import(/* webpackChunkName: "trainsystem" */ './views/client/trainsystem.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: "admin" */ './views/management/Home/index.vue');
  144. },
  145. children: [
  146. {
  147. path: '/newsClassify',
  148. name: 'newsClassify',
  149. meta: {
  150. icon: "",
  151. title: "新闻分类"
  152. },
  153. isAdminMenu: true,
  154. component: () => {
  155. return import(/* webpackChunkName: "newsClassify" */ './views/management/XinWenFenLei/index.vue');
  156. },
  157. },
  158. {
  159. path: '/news',
  160. name: 'news',
  161. meta: {
  162. icon: "",
  163. title: "新闻资讯"
  164. },
  165. isAdminMenu: true,
  166. component: () => {
  167. return import(/* webpackChunkName: "news" */ './views/management/XingWenZiXun/index.vue');
  168. },
  169. },
  170. {
  171. path: '/news/config',
  172. name: 'newsConfig',
  173. component: () => {
  174. return import(/* webpackChunkName: "newsConfig" */ './views/management/XingWenZiXun/XinWenZiXunConfig/index.vue');
  175. },
  176. },
  177. {
  178. path: '/blogroll',
  179. name: 'blogroll',
  180. meta: {
  181. icon: "",
  182. title: "友情链接"
  183. },
  184. isAdminMenu: true,
  185. component: () => {
  186. return import(/* webpackChunkName: "blogroll" */ './views/management/YouQingLianJie/index.vue');
  187. },
  188. },
  189. {
  190. path: '/Advertising',
  191. name: 'advertising',
  192. meta: {
  193. icon: "",
  194. title: "横幅广告"
  195. },
  196. isAdminMenu: true,
  197. component: () => {
  198. return import(/* webpackChunkName: "Advertising" */ './views/management/Advertising/index.vue');
  199. },
  200. },
  201. {
  202. path: '/register',
  203. name: 'register',
  204. meta: {
  205. icon: "",
  206. title: "注册审核"
  207. },
  208. isAdminMenu: true,
  209. component: () => {
  210. return import(/* webpackChunkName: "register" */ './views/management/RegistrationManagement/index.vue');
  211. },
  212. },
  213. {
  214. path: '/weikezhizuo',
  215. name: 'weikezhizuo',
  216. meta: {
  217. icon: "",
  218. title: "微课制作"
  219. },
  220. isAdminMenu: false,
  221. component: () => {
  222. return import(/* webpackChunkName: "news" */ './views/management/weikezhizuo/index.vue');
  223. },
  224. },
  225. {
  226. path: '/think',
  227. name: 'think',
  228. meta: {
  229. icon: "",
  230. title: "think"
  231. },
  232. isAdminMenu: false,
  233. component: () => {
  234. return import(/* webpackChunkName: "register" */ './views/think/youqinglianjie/index.vue');
  235. },
  236. },
  237. ],
  238. },
  239. ],
  240. });
  241. router.beforeEach((to, from, next) => {
  242. // FIXME 标题 待确认
  243. document.title = to.meta.title ? '麦塔': '麦塔';
  244. next();
  245. });
  246. export default router;