You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.ts 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
  2. import Cookies from 'js-cookie'
  3. const routes: RouteRecordRaw[] = [
  4. {
  5. path: '/',
  6. name: 'Login',
  7. component: () => import('@/views/system/login/Login.vue'),
  8. },
  9. {
  10. path: '/layout/index',
  11. name: 'Layout',
  12. component: () => import('@/layout/index.vue'),
  13. redirect: '/views/home',
  14. children: [
  15. {
  16. path: '/views/home',
  17. name: 'home',
  18. meta: { title: '主页', isAuth: true }, //用户自定内容
  19. components: {
  20. key: () => import('@/views/system/home/Home.vue'),
  21. },
  22. },
  23. {
  24. path: '/views/system/menu',
  25. name: 'menu',
  26. meta: { title: '菜单模块', isAuth: true }, //用户自定内容
  27. components: {
  28. key: () => import('@/views/system/menu/index.vue'),
  29. },
  30. },
  31. {
  32. path: '/views/fancongcong/advancepaymentaccount',
  33. name: 'advancepaymentaccount',
  34. meta: { title: '对公账户打款充值服务', isAuth: true }, //用户自定内容
  35. components: {
  36. key: () => import('@/views/fancongcong/advancepaymentaccount/advancepaymentaccount.vue'),
  37. },
  38. },
  39. {
  40. path: '/views/fancongcong/addsupplyCardBalance',
  41. name: 'addsupplyCardBalance',
  42. meta: { title: '储值卡-补交服务 ', isAuth: true }, //用户自定内容
  43. components: {
  44. key: () => import('@/views/fancongcong/addsupplyCardBalance/addsupplyCardBalance.vue'),
  45. },
  46. },
  47. {
  48. path: '/views/fancongcong/cardrechargefix',
  49. name: 'cardrechargefix',
  50. meta: { title: '储值卡充值修复服务(圈存修复服务)', isAuth: true }, //用户自定内容
  51. components: {
  52. key: () => import('@/views/fancongcong/cardrechargefix/cardrechargefix.vue'),
  53. },
  54. },
  55. {
  56. path: '/views/fancongcong/cardrefundcostManage',
  57. name: 'cardrefundcostManage ',
  58. meta: { title: '注销退费服务', isAuth: true }, //用户自定内容
  59. components: {
  60. key: () => import('@/views/fancongcong/cardrefundcostManage/cardrefundcostManage.vue'),
  61. },
  62. },
  63. {
  64. path: '/views/fancongcong/supplyCardBalance',
  65. name: 'supplyCardBalance',
  66. meta: { title: '储值卡-补卡额服务', isAuth: true }, //用户自定内容
  67. components: {
  68. key: () => import('@/views/fancongcong/supplyCardBalance/supplyCardBalance.vue'),
  69. },
  70. },
  71. {
  72. path: '/views/fancongcong/customerservice',
  73. name: 'customerservice',
  74. meta: { title: '储值卡充值服务(圈存)', isAuth: true }, //用户自定内容
  75. components: {
  76. key: () => import('@/views/fancongcong/customerservice/customerservice.vue'),
  77. },
  78. },
  79. {
  80. path: '/views/fancongcong/corporateaccountManage/corporateaccountManage',
  81. name: 'corporateaccountManage',
  82. meta: { title: '对公账户注册审核服务', isAuth: true }, //用户自定内容
  83. components: {
  84. key: () => import('@/views/fancongcong/corporateaccountManage/corporateaccountManage.vue'),
  85. },
  86. },
  87. {
  88. path: '/views/shengbo/blacklistQuery/blacklistQuery',
  89. name: 'blacklistQuery',
  90. meta: { title: '菜单模块', isAuth: true }, //黑名单查询服务
  91. components: {
  92. key: () => import('@/views/shengbo/blacklistQuery/blacklistQuery.vue'),
  93. },
  94. }, {
  95. path: '/views/shengbo/trafficFlow/trafficFlow',
  96. name: 'trafficFlow',
  97. meta: { title: '菜单模块', isAuth: true }, //通行流水查询服务
  98. components: {
  99. key: () => import('@/views/shengbo/trafficFlow/trafficFlow.vue'),
  100. },
  101. }, {
  102. path: '/views/dengmingcong/cardFillDo/cardFillDo',
  103. name: 'cardFillDo',
  104. meta: { title: '卡签补办', isAuth: true }, //卡签补办
  105. components: {
  106. key: () => import('@/views/dengmingcong/cardFillDo/cardFillDo.vue'),
  107. },
  108. }, {
  109. path: '/views/dengmingcong/cardRenewal/cardRenewal',
  110. name: 'cardRenewal',
  111. meta: { title: '卡签续期', isAuth: true }, //卡签续期
  112. components: {
  113. key: () => import('@/views/dengmingcong/cardRenewal/cardRenewal.vue'),
  114. },
  115. }, {
  116. path: '/views/dengmingcong/initiativeHangUp/initiativeHangUp',
  117. name: 'initiativeHangUp',
  118. meta: { title: '主动挂起服务', isAuth: true }, //主动挂起服务
  119. components: {
  120. key: () => import('@/views/dengmingcong/initiativeHangUp/initiativeHangUp.vue'),
  121. },
  122. }, {
  123. path: '/views/dengmingcong/passivityHangUp/passivityHangUp',
  124. name: 'passivityHangUp',
  125. meta: { title: '被动挂起服务', isAuth: true }, //被动挂起服务
  126. components: {
  127. key: () => import('@/views/dengmingcong/passivityHangUp/passivityHangUp.vue'),
  128. },
  129. }, {
  130. path: '/views/dengmingcong/TABActivate/TABActivate',
  131. name: 'TABActivate',
  132. meta: { title: '标签重新激活服务', isAuth: true }, //标签重新激活服务
  133. components: {
  134. key: () => import('@/views/dengmingcong/TABActivate/TABActivate.vue'),
  135. },
  136. }
  137. ],
  138. }
  139. ]
  140. const router = createRouter({
  141. history: createWebHashHistory(), //createWebHistory createWebHashHistory(带#号) 路由模式
  142. routes,
  143. })
  144. //新增前置路由首位
  145. router.beforeEach((to, from, next) => {
  146. if (to.meta.isAuth) { //是否需要验证权限
  147. if (Cookies.get('token')) {
  148. next() //继续往下
  149. } else {
  150. next({ name: 'Login' }); //没登录,跳转到login页
  151. }
  152. } else {
  153. next() //继续往下
  154. }
  155. })
  156. export default router