|
|
|
@ -21,6 +21,7 @@ const whiteList = [
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
let { isFromVolunteer, tel } = to.query;
|
|
|
|
|
NProgress.start();
|
|
|
|
|
if (getToken()) {
|
|
|
|
|
to.meta.title && store.dispatch("settings/setTitle", to.meta.title);
|
|
|
|
@ -29,8 +30,7 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
next({ path: "/" });
|
|
|
|
|
NProgress.done();
|
|
|
|
|
} else {
|
|
|
|
|
let isTrue = whiteList.some((item) => item == to.path);
|
|
|
|
|
store.commit("SET_IS_MENU_HEADER", !isTrue);
|
|
|
|
|
store.commit("SET_IS_MENU_HEADER", isFromVolunteer ? false : true);
|
|
|
|
|
if (store.getters.roles.length === 0) {
|
|
|
|
|
isRelogin.show = true;
|
|
|
|
|
// 判断当前用户是否已拉取完user_info信息
|
|
|
|
@ -55,7 +55,6 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let { isFromVolunteer, tel } = to.query;
|
|
|
|
|
if (tel) {
|
|
|
|
|
// store
|
|
|
|
|
// .dispatch("Login", {
|
|
|
|
@ -67,9 +66,9 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
|
|
|
store.commit("SET_IS_MENU_HEADER", false); //不显示左侧菜单,头部标题
|
|
|
|
|
// 没有token
|
|
|
|
|
// 在免登录白名单,直接进入
|
|
|
|
|
store.commit("SET_IS_MENU_HEADER", false); //不显示左侧菜单,头部标题
|
|
|
|
|
next();
|
|
|
|
|
} else {
|
|
|
|
|
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页
|
|
|
|
|