From ac84f7376af93a31cb94eafbb769a8f35dc293aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=AF=BA?= <1253070437@qq.com>
Date: Sat, 22 Apr 2023 13:24:15 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E5=89=8D?=
=?UTF-8?q?=E7=AB=AF=E7=99=BB=E5=BD=95=E8=B7=B3=E8=BD=AC=E8=87=B3=E9=80=80?=
=?UTF-8?q?=E5=87=BA=E5=89=8D=E7=9A=84=E7=95=8C=E9=9D=A2=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
snowy-admin-web/src/config/route.js | 10 +++++-----
snowy-admin-web/src/views/auth/login/util.js | 14 ++++++++++++++
snowy-admin-web/src/views/sys/user/userCenter.vue | 2 +-
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/snowy-admin-web/src/config/route.js b/snowy-admin-web/src/config/route.js
index 7478aeef..3ca82bf2 100644
--- a/snowy-admin-web/src/config/route.js
+++ b/snowy-admin-web/src/config/route.js
@@ -25,7 +25,7 @@ const routes = {
children: []
}
],
- // 默认首页、用户中心
+ // 默认首页、个人中心
menu: [
{
id: '001',
@@ -42,11 +42,11 @@ const routes = {
},
{
id: '002',
- name: 'usercenter',
- path: '/usercenter12',
- component: 'userCenter/index',
+ name: 'userCenter',
+ path: '/userCenter',
+ component: 'sys/user/userCenter',
meta: {
- title: '用户中心',
+ title: '个人中心',
type: 'menu',
hidden: true
},
diff --git a/snowy-admin-web/src/views/auth/login/util.js b/snowy-admin-web/src/views/auth/login/util.js
index df4cbc3d..ca16d275 100644
--- a/snowy-admin-web/src/views/auth/login/util.js
+++ b/snowy-admin-web/src/views/auth/login/util.js
@@ -25,6 +25,20 @@ export const afterLogin = async (loginToken) => {
// 如果有缓存,将其登录跳转到最后访问的路由
indexMenu = tool.data.get('LAST_VIEWS_PATH')
}
+ // 如果存在退出后换新账号登录,进行重新匹配,匹配无果则默认首页
+ if (menu) {
+ let routerTag = 0
+ menu.forEach((item) => {
+ if (item.children) {
+ if (JSON.stringify(item.children).indexOf(indexMenu) > -1) {
+ routerTag++
+ }
+ }
+ })
+ if (routerTag === 0) {
+ indexMenu = menu[0].children[0].path
+ }
+ }
await router.replace({
path: indexMenu
})
diff --git a/snowy-admin-web/src/views/sys/user/userCenter.vue b/snowy-admin-web/src/views/sys/user/userCenter.vue
index fd6503ab..cd7d476f 100644
--- a/snowy-admin-web/src/views/sys/user/userCenter.vue
+++ b/snowy-admin-web/src/views/sys/user/userCenter.vue
@@ -62,7 +62,7 @@
-