|
|
|
@ -8,7 +8,17 @@ import { isRelogin } from "@/utils/request";
|
|
|
|
|
|
|
|
|
|
NProgress.configure({ showSpinner: false });
|
|
|
|
|
|
|
|
|
|
const whiteList = ["/login", "/register", "/3dmodel"];
|
|
|
|
|
const whiteList = [
|
|
|
|
|
"/login",
|
|
|
|
|
"/register",
|
|
|
|
|
"/3dmodel",
|
|
|
|
|
"/volunteer/userbq/bqhsj",
|
|
|
|
|
"/volunteer/userbq/dictGl",
|
|
|
|
|
"/volunteer/hdtj/hdGl",
|
|
|
|
|
"/volunteer/yzczs/ycxzsff",
|
|
|
|
|
"/volunteer/gxhzs/gxhzsgl",
|
|
|
|
|
"/volunteer/gxhzs/gxhzsff",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
NProgress.start();
|
|
|
|
@ -19,6 +29,8 @@ 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);
|
|
|
|
|
if (store.getters.roles.length === 0) {
|
|
|
|
|
isRelogin.show = true;
|
|
|
|
|
// 判断当前用户是否已拉取完user_info信息
|
|
|
|
@ -43,13 +55,26 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 没有token
|
|
|
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
|
|
|
// 在免登录白名单,直接进入
|
|
|
|
|
next();
|
|
|
|
|
let { isFromVolunteer, tel } = to.query;
|
|
|
|
|
if (tel) {
|
|
|
|
|
// store
|
|
|
|
|
// .dispatch("Login", {
|
|
|
|
|
// username: "15937192537",
|
|
|
|
|
// password: "123456",
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// store.commit("SET_IS_MENU_HEADER", false);
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页
|
|
|
|
|
NProgress.done();
|
|
|
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
|
|
|
store.commit("SET_IS_MENU_HEADER", false); //不显示左侧菜单,头部标题
|
|
|
|
|
// 没有token
|
|
|
|
|
// 在免登录白名单,直接进入
|
|
|
|
|
next();
|
|
|
|
|
} else {
|
|
|
|
|
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页
|
|
|
|
|
NProgress.done();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|