From 2fb1afed4a039413806dcda05771082ab2c67e64 Mon Sep 17 00:00:00 2001 From: yangzhe Date: Tue, 16 Dec 2025 15:37:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=B9=E6=8D=AE=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=B7=B3=E8=BD=AC=E5=AF=B9=E5=BA=94=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E9=81=BF=E5=85=8D=E5=BC=BA=E5=88=B6=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/App.vue b/App.vue index abef9c0..c7e4d35 100644 --- a/App.vue +++ b/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", "");