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

import { createRouter, createWebHashHistory } from 'vue-router';
const router = createRouter({
history: createWebHashHistory(),
routes: [//此处在做登录之前做成默认跳转工作台
{ path: '/workspace', name: "workspace", component: () => import("../views/workspace/index.vue") },
{ path: '/', redirect: "/workspace" },
// { path: '/test', component: () => import("../views/z.vue") },
{
meta: { requireAuth: true },
path: '/', component: () => import("../views/home.vue"),
children: [
// 工作台
{ path: '/workspace/:area?', name: "workspace", component: () => import("../views/workspace/index.vue") },
// 充值审核
{ path: '/rechargeAudit', name: "rechargeAudit", component: () => import("../views/audit/rechargeAudit.vue") },
// 退款审核
{ path: '/refundAudit', name: "refundAudit", component: () => import("../views/audit/refundAudit.vue") },
// 金币消耗
{ path: '/coinConsume', name: "coinConsume", component: () => import("../views/consume/coinConsume.vue"),
redirect: '/coinConsume/add',// 重定向到新增消耗页面
children: [
// 金币新增消耗
{ path: 'add', name: "addCoinConsume", component: () => import("../views/consume/addCoinConsume.vue") },
// 金币消耗明细详情
{ path: 'detail', name: "coinConsumeDetail", component: () => import("../views/consume/coinConsumeDetail.vue") }
]
},
// 金豆消耗
{ path: '/beanConsume', name: "beanConsume", component: () => import("../views/consume/beanConsume.vue") },
// 汇率管理
{ path: '/rate', name: "rate", component: () => import("../views/managerecharge/rate.vue") },
// 金币充值
{ path: '/coinRecharge', name: "coinRecharge", component: () => import("../views/recharge/coinRecharge.vue"),
redirect: '/coinRecharge/add',// 重定向到新增充值页面
children: [
// 金币新增充值
{ path: 'add', name: "addCoinRecharge", component: () => import("../views/recharge/addCoinRecharge.vue") },
// 金币充值明细详情
{ path: 'detail', name: "coinRechargeDetail", component: () => import("../views/recharge/coinRechargeDetail.vue") }
]
},
// 金豆充值
{ path: '/beanRecharge', name: "beanRecharge", component: () => import("../views/recharge/beanRecharge.vue") },
// 金币退款
{ path: '/coinRefund', name: "coinRefund", component: () => import("../views/refund/coinRefund.vue"),
redirect: '/coinRefund/add',// 重定向到新增退款页面
children: [
// 金币新增消耗
{ path: 'add', name: "addCoinRefund", component: () => import("../views/refund/addCoinRefund.vue") },
// 金币消耗明细详情
{ path: 'detail', name: "coinRefundDetail", component: () => import("../views/refund/coinRefundDetail.vue") }
]
},
// 金豆退款
{ path: '/beanRefund', name: "beanRefund", component: () => import("../views/refund/beanRefund.vue") },
// 客户账户明细
{ path: '/usergold', name: "usergold", component: () => import("../views/usergold/clientCount.vue"),
redirect: '/usergold/detail',// 重定向到客户账户明细页面
children: [
// 金币明细
{ path: 'detail', name: "clientCountDetail", component: () => import("../views/usergold/clientCountDetail.vue") },
// 金币余额
{ path: 'balance', name: "clientCountBalance", component: () => import("../views/usergold/clientCountBalance.vue") },
]
},
// 权限管理
{ path: '/permissions', name: "permissions", component: () => import("../views/permissions/permission.vue") },
// 没有权限
{ path: '/noPermission', name: "noPermission", component: () => import("../views/noPermissionPage.vue") }
]
},
]
});
router.beforeEach((to, from, next) => {
// const token = localStorage.getItem("token");
// const permission = localStorage.getItem("permission");
// if (to.name != "login" && !token) {
// next({ name: "login" });
// } else {
// if (permission == "4" && to.name != "noPermission") {
// next({ name: "noPermission" });
// } else if (permission == "3") {
// if (to.name == "addConsume" || to.name == "allConsume"
// || to.name == "addRecharge" || to.name == "adminRecharge" || to.name == "allRecharge"
// || to.name == "addRefund" || to.name == "allRefund"
// || to.name == "permissions") {
// next({ name: "workspace" });
// } else {
// next();
// }
// } else if (permission == '2') {
// if (to.name == "rechargeAudit" || to.name == "refundAudit"
// || to.name == "activity" || to.name == "rate"
// || to.name == "permissions") {
// next({ name: "workspace" })
// } else {
// next();
// }
// } else if (permission == '5') {
// if (to.name == "permissions") {
// next({ name: "workspace" })
// } else {
// next();
// }
// }
// else {
// next();
// }
// }
next();
})
export default router;