diff --git a/src/layout/index.vue b/src/layout/index.vue index 7b66ff2..93edf1f 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -139,6 +139,7 @@ export default { }, methods: { async logout() { + await this.$store.dispatch('app/clearLayout') await this.$store.dispatch("user/logout"); this.$router.push(`/login?redirect=${this.$route.fullPath}`); }, diff --git a/src/store/modules/app.js b/src/store/modules/app.js index fdc70de..88beb88 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -82,6 +82,10 @@ const actions = { }); }); }, + clearLayout({ commit }) { + commit("SET_LAYOUT",{}) + window.localStorage.removeItem('worker-layout') + } }; export default { diff --git a/src/views/system/worker.vue b/src/views/system/worker.vue index aeaec44..b43360e 100644 --- a/src/views/system/worker.vue +++ b/src/views/system/worker.vue @@ -131,6 +131,14 @@ export default { async sync() { await this.$store.dispatch("app/setLayout") + this.$store.dispatch('app/getLayout').then(res => { + this.layoutList = res.map(item => { + layout.forEach(lay => { + lay.i === item.i ? item.component = lay.component : '' + }) + return item + }) + }) }, save(){ let layout = this.layoutList.map(item => {