fix 修复 切换租户 页面tab未清空问题

This commit is contained in:
疯狂的狮子li 2023-02-09 19:45:17 +08:00
parent 6b4c1b4c94
commit 0e172d2aa1
2 changed files with 9 additions and 6 deletions

View File

@ -21,6 +21,7 @@
:label="item.companyName" :label="item.companyName"
:value="item.tenantId"> :value="item.tenantId">
</el-option> </el-option>
<svg-icon slot="prefix" icon-class="company" class="el-input__icon input-icon" />
</el-select> </el-select>
<search id="header-search" class="right-menu-item" /> <search id="header-search" class="right-menu-item" />
@ -123,13 +124,15 @@ export default {
dynamicTenantEvent(tenantId) { dynamicTenantEvent(tenantId) {
if (this.companyName != null && this.companyName !== '') { if (this.companyName != null && this.companyName !== '') {
dynamicTenant(tenantId).then(res => { dynamicTenant(tenantId).then(res => {
this.$router.push("/index"); this.$tab.closeAllPage()
this.$router.push('/')
}); });
} }
}, },
dynamicClearEvent() { dynamicClearEvent() {
dynamicClear().then(res => { dynamicClear().then(res => {
this.$router.push("/index"); this.$tab.closeAllPage()
this.$router.push('/')
}); });
}, },
// //

View File

@ -3,16 +3,16 @@ import { getToken, setToken, removeToken } from '@/utils/auth'
const user = { const user = {
state: { state: {
userId: undefined,
token: getToken(), token: getToken(),
name: '', name: '',
avatar: '', avatar: '',
roles: [], roles: [],
permissions: [], permissions: []
userId: null
}, },
mutations: { mutations: {
SET_USERID: (state, userId) => { SET_USER_ID: (state, userId) => {
state.userId = userId state.userId = userId
}, },
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
@ -65,7 +65,7 @@ const user = {
} }
commit('SET_NAME', user.userName) commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
commit('SET_USERID', user.userId) commit('SET_USER_ID', user.userId)
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)