From 27109824f2ca2414c3ebcbf25a6d1d64fba21c02 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 21 May 2021 15:54:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=96=E6=B6=88=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E5=90=8E=E4=B8=BB=E9=A1=B5=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E4=BB=AA=E8=A1=A8=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/panel/enshrine/index.vue | 15 ++++++++++++++- frontend/src/views/panel/list/PanelViewShow.vue | 8 ++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/panel/enshrine/index.vue b/frontend/src/views/panel/enshrine/index.vue index 3f6fadbbbb..646a68beba 100644 --- a/frontend/src/views/panel/enshrine/index.vue +++ b/frontend/src/views/panel/enshrine/index.vue @@ -36,8 +36,13 @@ export default { starDatas: [] } }, + computed: { + panelInfo() { + return this.$store.state.panel.panelInfo + } + }, created() { - bus.$on('panle_start_list_refresh', this.initData) + bus.$on('panle_start_list_refresh', this.refreshStarts) this.initData() }, methods: { @@ -64,12 +69,20 @@ export default { remove(row) { deleteEnshrine(row.storeId).then(res => { this.initData() + this.panelInfo && this.panelInfo.id && row.panelGroupId === this.panelInfo.id && this.setMainNull() }) }, initData() { enshrineList({}).then(res => { this.starDatas = res.data }) + }, + setMainNull() { + this.$store.dispatch('panel/setPanelInfo', { id: null, name: '', preStyle: null }) + }, + refreshStarts(isStar) { + this.initData() + !isStar && this.setMainNull() } } } diff --git a/frontend/src/views/panel/list/PanelViewShow.vue b/frontend/src/views/panel/list/PanelViewShow.vue index 4390ea6b44..bff2cf7f9d 100644 --- a/frontend/src/views/panel/list/PanelViewShow.vue +++ b/frontend/src/views/panel/list/PanelViewShow.vue @@ -162,13 +162,13 @@ export default { star() { this.panelInfo && saveEnshrine(this.panelInfo.id).then(res => { this.hasStar = true - this.refreshStarList() + this.refreshStarList(true) }) }, unstar() { this.panelInfo && deleteEnshrine(this.panelInfo.id).then(res => { this.hasStar = false - this.refreshStarList() + this.refreshStarList(false) }) }, initHasStar() { @@ -177,8 +177,8 @@ export default { this.hasStar = res.data && res.data.some(item => item.panelGroupId === this.panelInfo.id) }) }, - refreshStarList() { - bus.$emit('panle_start_list_refresh') + refreshStarList(isStar) { + bus.$emit('panle_start_list_refresh', isStar) } }