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.

87 lines
4.9 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
4 weeks ago
2 months 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: "/login" },
  7. {path: "/login",name: "login",component: () => import("../views/login.vue"),},
  8. // { path: '/test', component: () => import("../views/z.vue") },
  9. {
  10. meta: { requireAuth: true },
  11. path: '/', component: () => import("../views/home.vue"),
  12. children: [
  13. // 工作台
  14. { path: '/workspace/:area?', name: "workspace", component: () => import("../views/workspace/index.vue") },
  15. // 充值审核
  16. { path: '/rechargeAudit', name: "rechargeAudit", component: () => import("../views/audit/rechargeAudit.vue") },
  17. // 退款审核
  18. { path: '/refundAudit', name: "refundAudit", component: () => import("../views/audit/refundAudit.vue") },
  19. // 金币消耗
  20. { path: '/coinConsume', name: "coinConsume", component: () => import("../views/consume/coinConsume.vue"),
  21. redirect: '/coinConsume/add',// 重定向到新增消耗页面
  22. children: [
  23. // 金币新增消耗
  24. { path: 'add', name: "addCoinConsume", component: () => import("../views/consume/addCoinConsume.vue") },
  25. // 金币消耗明细详情
  26. { path: 'detail', name: "coinConsumeDetail", component: () => import("../views/consume/coinConsumeDetail.vue") }
  27. ]
  28. },
  29. // 金豆消耗
  30. { path: '/beanConsume', name: "beanConsume", component: () => import("../views/consume/beanConsume.vue") },
  31. // 汇率管理
  32. { path: '/rate', name: "rate", component: () => import("../views/managerecharge/rate.vue") },
  33. // 金币充值
  34. { path: '/coinRecharge', name: "coinRecharge", component: () => import("../views/recharge/coinRecharge.vue"),
  35. redirect: '/coinRecharge/add',// 重定向到新增充值页面
  36. children: [
  37. // 金币新增充值
  38. { path: 'add', name: "addCoinRecharge", component: () => import("../views/recharge/addCoinRecharge.vue") },
  39. // 金币充值明细详情
  40. { path: 'detail', name: "coinRechargeDetail", component: () => import("../views/recharge/coinRechargeDetail.vue") }
  41. ]
  42. },
  43. // 金豆充值
  44. { path: '/beanRecharge', name: "beanRecharge", component: () => import("../views/recharge/beanRecharge.vue") },
  45. // 金币退款
  46. { path: '/coinRefund', name: "coinRefund", component: () => import("../views/refund/coinRefund.vue"),
  47. redirect: '/coinRefund/add',// 重定向到新增退款页面
  48. children: [
  49. // 金币新增消耗
  50. { path: 'add', name: "addCoinRefund", component: () => import("../views/refund/addCoinRefund.vue") },
  51. // 金币消耗明细详情
  52. { path: 'detail', name: "coinRefundDetail", component: () => import("../views/refund/coinRefundDetail.vue") }
  53. ]
  54. },
  55. // 金豆退款
  56. { path: '/beanRefund', name: "beanRefund", component: () => import("../views/refund/beanRefund.vue") },
  57. // 客户账户明细
  58. { path: '/usergold', name: "usergold", component: () => import("../views/usergold/clientCount.vue"),
  59. redirect: '/usergold/detail',// 重定向到客户账户明细页面
  60. children: [
  61. // 金币明细
  62. { path: 'detail', name: "clientCountDetail", component: () => import("../views/usergold/clientCountDetail.vue") },
  63. // 金币余额
  64. { path: 'balance', name: "clientCountBalance", component: () => import("../views/usergold/clientCountBalance.vue") },
  65. ]
  66. },
  67. // 权限管理
  68. { path: '/permissions', name: "permissions", component: () => import("../views/permissions/permission.vue") },
  69. // 没有权限
  70. { path: '/noPermission', name: "noPermission", component: () => import("../views/noPermissionPage.vue") }
  71. ]
  72. },
  73. ]
  74. });
  75. router.beforeEach((to, from, next) => {
  76. const token = localStorage.getItem("token");
  77. const machineId = localStorage.getItem("machineId");
  78. if (to.name != "login" && !token) {
  79. next('/login?machineId=' + machineId);
  80. }
  81. next();
  82. })
  83. export default router;