fix: 根据用户类型跳转对应主页避免强制重定向
This commit is contained in:
parent
38154d6306
commit
2fb1afed4a
29
App.vue
29
App.vue
|
|
@ -53,6 +53,35 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
// 根据用户类型跳转对应主页
|
||||
const userType = that.vuex_userType || 0;
|
||||
const currentPath = that._route.path;
|
||||
|
||||
// 只有在根路径("/")或 首页("/pages/home/index/index")或教师端首页("/pages/consultation/index")时才进行跳转判断
|
||||
// 这样可以避免在其他有权限的页面刷新时被强制重定向
|
||||
const isRootPath =
|
||||
currentPath === "/" ||
|
||||
currentPath === "/pages/home/index/index" ||
|
||||
currentPath === "/pages/consultation/index";
|
||||
|
||||
if (isRootPath) {
|
||||
if (userType === 1) {
|
||||
// 教师端主页
|
||||
if (currentPath !== "/pages/consultation/index") {
|
||||
uni.reLaunch({
|
||||
url: "/pages/consultation/index",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 学生端主页
|
||||
if (currentPath !== "/pages/home/index/index") {
|
||||
uni.reLaunch({
|
||||
url: "/pages/home/index/index",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
if (!that.vuex_user.isFill) {
|
||||
this.$u.vuex("vuex_msgList", "");
|
||||
|
|
|
|||
Loading…
Reference in New Issue