|
@ -76,43 +76,11 @@ const router = createRouter({ |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => { |
|
|
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();
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
const token = localStorage.getItem("token"); |
|
|
|
|
|
const machineId = localStorage.getItem("machineId"); |
|
|
|
|
|
if (to.name != "login" && !token) { |
|
|
|
|
|
next('/login?machineId=' + machineId); |
|
|
|
|
|
} |
|
|
next(); |
|
|
next(); |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
export default router; |
|
|
export default router; |