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)