feat: 仪表板取消收藏实时展示

This commit is contained in:
fit2cloud-chenyw 2021-05-21 14:25:00 +08:00
parent a588e9e29a
commit 4f19867823
2 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,7 @@
import { deleteEnshrine, enshrineList } from '@/api/panel/enshrine'
import { uuid } from 'vue-uuid'
import { get } from '@/api/panel/panel'
import bus from '@/utils/bus'
export default {
name: 'Enshrine',
data() {
@ -36,6 +37,7 @@ export default {
}
},
created() {
bus.$on('panle_start_list_refresh', this.initData)
this.initData()
},
methods: {

View File

@ -67,6 +67,7 @@ import { mapState } from 'vuex'
import html2canvas from 'html2canvas'
import FileSaver from 'file-saver'
import { enshrineList, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
import bus from '@/utils/bus'
export default {
name: 'PanelViewShow',
components: { Preview, SaveToTemplate },
@ -161,11 +162,13 @@ export default {
star() {
this.panelInfo && saveEnshrine(this.panelInfo.id).then(res => {
this.hasStar = true
this.refreshStarList()
})
},
unstar() {
this.panelInfo && deleteEnshrine(this.panelInfo.id).then(res => {
this.hasStar = false
this.refreshStarList()
})
},
initHasStar() {
@ -173,6 +176,9 @@ export default {
enshrineList(param).then(res => {
this.hasStar = res.data && res.data.some(item => item.panelGroupId === this.panelInfo.id)
})
},
refreshStarList() {
bus.$emit('panle_start_list_refresh')
}
}