From 0e172d2aa1cacd57b33fa52aff26718676c404bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 9 Feb 2023 19:45:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E7=A7=9F=E6=88=B7=20=E9=A1=B5=E9=9D=A2tab=E6=9C=AA=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/layout/components/Navbar.vue | 7 +++++-- ruoyi-ui/src/store/modules/user.js | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 2d6478b6d..85fb1b582 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -21,6 +21,7 @@ :label="item.companyName" :value="item.tenantId"> + @@ -123,13 +124,15 @@ export default { dynamicTenantEvent(tenantId) { if (this.companyName != null && this.companyName !== '') { dynamicTenant(tenantId).then(res => { - this.$router.push("/index"); + this.$tab.closeAllPage() + this.$router.push('/') }); } }, dynamicClearEvent() { dynamicClear().then(res => { - this.$router.push("/index"); + this.$tab.closeAllPage() + this.$router.push('/') }); }, // 租户列表 diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 1c7b6985e..b375adc05 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -3,16 +3,16 @@ import { getToken, setToken, removeToken } from '@/utils/auth' const user = { state: { + userId: undefined, token: getToken(), name: '', avatar: '', roles: [], - permissions: [], - userId: null + permissions: [] }, mutations: { - SET_USERID: (state, userId) => { + SET_USER_ID: (state, userId) => { state.userId = userId }, SET_TOKEN: (state, token) => { @@ -65,7 +65,7 @@ const user = { } commit('SET_NAME', user.userName) commit('SET_AVATAR', avatar) - commit('SET_USERID', user.userId) + commit('SET_USER_ID', user.userId) resolve(res) }).catch(error => { reject(error)