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.
86 lines
4.9 KiB
86 lines
4.9 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: "/login" },
|
|
{path: "/login",name: "login",component: () => import("../views/login.vue"),},
|
|
// { 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 machineId = localStorage.getItem("machineId");
|
|
if (to.name != "login" && !token) {
|
|
next('/login?machineId=' + machineId);
|
|
}
|
|
next();
|
|
})
|
|
export default router;
|