|
|
@ -2,26 +2,26 @@ import router from "./index"; |
|
|
|
import Setting from "@/setting"; |
|
|
|
import Setting from "@/setting"; |
|
|
|
import util from "@/libs/util"; |
|
|
|
import util from "@/libs/util"; |
|
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => { |
|
|
|
// router.beforeEach((to, from, next) => {
|
|
|
|
document.title = Setting.titleSuffix; |
|
|
|
// document.title = Setting.titleSuffix;
|
|
|
|
const role = util.local.get(Setting.tokenKey);
|
|
|
|
// const role = util.local.get(Setting.tokenKey);
|
|
|
|
if (!role && to.path !== "/login") { |
|
|
|
// if (!role && to.path !== "/login") {
|
|
|
|
next("/login"); |
|
|
|
// next("/login");
|
|
|
|
} else if (role && to.path == "/login") { |
|
|
|
// } else if (role && to.path == "/login") {
|
|
|
|
next("/index"); |
|
|
|
// next("/index");
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
let mg = from.query.mg; |
|
|
|
// let mg = from.query.mg;
|
|
|
|
if (mg) { |
|
|
|
// if (mg) {
|
|
|
|
if (!to.query.mg) { |
|
|
|
// if (!to.query.mg) {
|
|
|
|
next({ |
|
|
|
// next({
|
|
|
|
path: to.path, |
|
|
|
// path: to.path,
|
|
|
|
query: { mg } |
|
|
|
// query: { mg }
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
next(); |
|
|
|
// next();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
next(); |
|
|
|
// next();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}); |
|
|
|
// });
|