fix(仪表板): 仪表板移动端配置每次保存后退出在此进行保存提示都会+1

This commit is contained in:
dataeaseShu 2024-03-04 11:27:37 +08:00
parent 34c23ba315
commit 813c02a045
2 changed files with 12 additions and 11 deletions

View File

@ -141,13 +141,6 @@ const saveCanvasWithCheck = () => {
saveResource()
}
const saveCanvasWithCheckFromMobile = () => {
snapshotStore.resetStyleChangeTimes()
canvasSave(() => {
ElMessage.success('保存成功')
})
}
const saveResource = () => {
if (styleChangeTimes.value > 0) {
snapshotStore.resetStyleChangeTimes()
@ -199,7 +192,6 @@ const mobileConfig = () => {
eventBus.on('preview', previewInner)
eventBus.on('save', saveCanvasWithCheck)
eventBus.on('saveFromMobile', saveCanvasWithCheckFromMobile)
eventBus.on('clearCanvas', clearCanvas)
const openDataBoardSetting = () => {

View File

@ -1,8 +1,9 @@
<script lang="ts" setup>
import { ref, onMounted, unref, onBeforeUnmount, computed } from 'vue'
import eventBus from '@/utils/eventBus'
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
import MobileBackgroundSelector from './MobileBackgroundSelector.vue'
import { ElMessageBox } from 'element-plus-secondary'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { canvasSave } from '@/utils/canvasUtils'
import { useEmitt } from '@/hooks/web/useEmitt'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { getStyle } from '@/utils/style'
@ -12,6 +13,7 @@ const dvMainStore = dvMainStoreWithOut()
const { componentData, canvasStyleData, canvasViewInfo, dvInfo } = storeToRefs(dvMainStore)
const mobileLoading = ref(true)
const emits = defineEmits(['pcMode'])
const snapshotStore = snapshotStoreWithOut()
const getComponentStyleDefault = style => {
return getStyle(style, ['top', 'left', 'width', 'height', 'rotate'])
@ -78,9 +80,16 @@ const hanedleMessage = event => {
}
})
eventBus.emit('saveFromMobile')
saveCanvasWithCheckFromMobile()
}
}
const saveCanvasWithCheckFromMobile = () => {
snapshotStore.resetStyleChangeTimes()
canvasSave(() => {
ElMessage.success('保存成功')
})
}
onMounted(() => {
window.addEventListener('message', hanedleMessage)
dvMainStore.setMobileInPc(true)