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.

118 lines
6.0 KiB

3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  1. import { createRouter, createWebHashHistory } from 'vue-router';
  2. const router = createRouter({
  3. history: createWebHashHistory(),
  4. routes: [//此处在做登录之前做成默认跳转工作台
  5. { path: '/workspace', name: "workspace", component: () => import("../views/workspace/index.vue") },
  6. { path: '/', redirect: "/workspace" },
  7. // { path: '/test', component: () => import("../views/z.vue") },
  8. {
  9. meta: { requireAuth: true },
  10. path: '/', component: () => import("../views/home.vue"),
  11. children: [
  12. // 工作台
  13. { path: '/workspace/:area?', name: "workspace", component: () => import("../views/workspace/index.vue") },
  14. // 充值审核
  15. { path: '/rechargeAudit', name: "rechargeAudit", component: () => import("../views/audit/rechargeAudit.vue") },
  16. // 退款审核
  17. { path: '/refundAudit', name: "refundAudit", component: () => import("../views/audit/refundAudit.vue") },
  18. // 金币消耗
  19. { path: '/coinConsume', name: "coinConsume", component: () => import("../views/consume/coinConsume.vue"),
  20. redirect: '/coinConsume/add',// 重定向到新增消耗页面
  21. children: [
  22. // 金币新增消耗
  23. { path: 'add', name: "addCoinConsume", component: () => import("../views/consume/addCoinConsume.vue") },
  24. // 金币消耗明细详情
  25. { path: 'detail', name: "coinConsumeDetail", component: () => import("../views/consume/coinConsumeDetail.vue") }
  26. ]
  27. },
  28. // 金豆消耗
  29. { path: '/beanConsume', name: "beanConsume", component: () => import("../views/consume/beanConsume.vue") },
  30. // 汇率管理
  31. { path: '/rate', name: "rate", component: () => import("../views/managerecharge/rate.vue") },
  32. // 金币充值
  33. { path: '/coinRecharge', name: "coinRecharge", component: () => import("../views/recharge/coinRecharge.vue"),
  34. redirect: '/coinRecharge/add',// 重定向到新增充值页面
  35. children: [
  36. // 金币新增充值
  37. { path: 'add', name: "addCoinRecharge", component: () => import("../views/recharge/addCoinRecharge.vue") },
  38. // 金币充值明细详情
  39. { path: 'detail', name: "coinRechargeDetail", component: () => import("../views/recharge/coinRechargeDetail.vue") }
  40. ]
  41. },
  42. // 金豆充值
  43. { path: '/beanRecharge', name: "beanRecharge", component: () => import("../views/recharge/beanRecharge.vue") },
  44. // 金币退款
  45. { path: '/coinRefund', name: "coinRefund", component: () => import("../views/refund/coinRefund.vue"),
  46. redirect: '/coinRefund/add',// 重定向到新增退款页面
  47. children: [
  48. // 金币新增消耗
  49. { path: 'add', name: "addCoinRefund", component: () => import("../views/refund/addCoinRefund.vue") },
  50. // 金币消耗明细详情
  51. { path: 'detail', name: "coinRefundDetail", component: () => import("../views/refund/coinRefundDetail.vue") }
  52. ]
  53. },
  54. // 金豆退款
  55. { path: '/beanRefund', name: "beanRefund", component: () => import("../views/refund/beanRefund.vue") },
  56. // 客户账户明细
  57. { path: '/usergold', name: "usergold", component: () => import("../views/usergold/clientCount.vue"),
  58. redirect: '/usergold/detail',// 重定向到客户账户明细页面
  59. children: [
  60. // 金币明细
  61. { path: 'detail', name: "clientCountDetail", component: () => import("../views/usergold/clientCountDetail.vue") },
  62. // 金币余额
  63. { path: 'balance', name: "clientCountBalance", component: () => import("../views/usergold/clientCountBalance.vue") },
  64. ]
  65. },
  66. // 权限管理
  67. { path: '/permissions', name: "permissions", component: () => import("../views/permissions/permission.vue") },
  68. // 没有权限
  69. { path: '/noPermission', name: "noPermission", component: () => import("../views/noPermissionPage.vue") }
  70. ]
  71. },
  72. ]
  73. });
  74. router.beforeEach((to, from, next) => {
  75. // const token = localStorage.getItem("token");
  76. // const permission = localStorage.getItem("permission");
  77. // if (to.name != "login" && !token) {
  78. // next({ name: "login" });
  79. // } else {
  80. // if (permission == "4" && to.name != "noPermission") {
  81. // next({ name: "noPermission" });
  82. // } else if (permission == "3") {
  83. // if (to.name == "addConsume" || to.name == "allConsume"
  84. // || to.name == "addRecharge" || to.name == "adminRecharge" || to.name == "allRecharge"
  85. // || to.name == "addRefund" || to.name == "allRefund"
  86. // || to.name == "permissions") {
  87. // next({ name: "workspace" });
  88. // } else {
  89. // next();
  90. // }
  91. // } else if (permission == '2') {
  92. // if (to.name == "rechargeAudit" || to.name == "refundAudit"
  93. // || to.name == "activity" || to.name == "rate"
  94. // || to.name == "permissions") {
  95. // next({ name: "workspace" })
  96. // } else {
  97. // next();
  98. // }
  99. // } else if (permission == '5') {
  100. // if (to.name == "permissions") {
  101. // next({ name: "workspace" })
  102. // } else {
  103. // next();
  104. // }
  105. // }
  106. // else {
  107. // next();
  108. // }
  109. // }
  110. next();
  111. })
  112. export default router;