forked from github/dataease
fix(仪表板): 设置移动端快速点击图标导致显示不正确,且退出不保存在此查看依然保存
This commit is contained in:
parent
049c661fd5
commit
ecd2d77992
@ -174,6 +174,48 @@ export async function initCanvasData(dvId, busiFlag, callBack) {
|
||||
)
|
||||
}
|
||||
|
||||
export async function backCanvasData(dvId, busiFlag, callBack) {
|
||||
initCanvasDataPrepare(dvId, busiFlag, function ({ canvasDataResult, canvasStyleResult }) {
|
||||
const componentDataCopy = canvasDataResult.filter(ele => !!ele.inMobile)
|
||||
const componentDataId = componentDataCopy.map(ele => ele.id)
|
||||
componentData.value.forEach(ele => {
|
||||
ele.inMobile = componentDataId.includes(ele.id)
|
||||
if (ele.inMobile) {
|
||||
const { mx, my, mSizeX, mSizeY } = componentDataCopy.find(itx => itx.id === ele.id)
|
||||
ele.mx = mx
|
||||
ele.my = my
|
||||
ele.mSizeX = mSizeX
|
||||
ele.mSizeY = mSizeY
|
||||
if (ele.component === 'DeTabs') {
|
||||
ele.propValue.forEach(tabItem => {
|
||||
tabItem.componentData.forEach(tabComponent => {
|
||||
tabComponent.mx = tabComponent.mx
|
||||
tabComponent.my = tabComponent.my
|
||||
tabComponent.mSizeX = tabComponent.mSizeX
|
||||
tabComponent.mSizeY = tabComponent.mSizeY
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
dvMainStore.setComponentData(componentData.value)
|
||||
const canvasStyleDataCopy = cloneDeep(canvasStyleData.value)
|
||||
if (!canvasStyleDataCopy.mobileSetting) {
|
||||
canvasStyleDataCopy.mobileSetting = {
|
||||
backgroundColorSelect: false,
|
||||
background: '',
|
||||
color: '#ffffff',
|
||||
backgroundImageEnable: false,
|
||||
customSetting: false
|
||||
}
|
||||
} else {
|
||||
canvasStyleDataCopy.mobileSetting = canvasStyleResult.mobileSetting
|
||||
}
|
||||
dvMainStore.setCanvasStyle(canvasStyleDataCopy)
|
||||
callBack()
|
||||
})
|
||||
}
|
||||
|
||||
export function initCanvasDataMobile(dvId, busiFlag, callBack) {
|
||||
initCanvasDataPrepare(
|
||||
dvId,
|
||||
|
@ -8,6 +8,7 @@ import { useEmbedded } from '@/store/modules/embedded'
|
||||
import { canvasSave } from '@/utils/canvasUtils'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import { backCanvasData } from '@/utils/canvasUtils'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { debounce } from 'lodash-es'
|
||||
import mobileHeader from '@/assets/img/mobile-header.png'
|
||||
@ -175,6 +176,7 @@ onBeforeUnmount(() => {
|
||||
})
|
||||
|
||||
const addToMobile = com => {
|
||||
if (mobileLoading.value) return
|
||||
com.inMobile = true
|
||||
changeTimes.value++
|
||||
mobileStatusChange('addToMobile', JSON.parse(JSON.stringify(unref(com))))
|
||||
@ -194,7 +196,10 @@ const handleBack = () => {
|
||||
showClose: false
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
mobileStatusChange('mobilePatch', undefined)
|
||||
backCanvasData(dvInfo.value.id, 'dashboard', () => {
|
||||
changeTimes.value = 0
|
||||
emits('pcMode')
|
||||
})
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
|
@ -1,23 +1,33 @@
|
||||
<template>
|
||||
<div class="mobile-link-container" v-loading="loading">
|
||||
<div
|
||||
:class="curType === 'dashboard' ? 'mobile-link-container' : 'link-container'"
|
||||
v-loading="loading"
|
||||
>
|
||||
<LinkError v-if="!loading && !linkExist" />
|
||||
<Exp v-else-if="!loading && linkExp" />
|
||||
<PwdTips v-else-if="!loading && !pwdValid" />
|
||||
<de-preview
|
||||
ref="dashboardPreview"
|
||||
v-else-if="state.canvasStylePreview && dataInitState"
|
||||
v-else-if="state.canvasStylePreview && dataInitState && curType === 'dashboard'"
|
||||
:component-data="state.canvasDataPreview"
|
||||
:canvas-style-data="state.canvasStylePreview"
|
||||
:canvas-view-info="state.canvasViewInfoPreview"
|
||||
:dv-info="state.dvInfo"
|
||||
:cur-gap="state.curPreviewGap"
|
||||
></de-preview>
|
||||
<PreviewCanvas
|
||||
v-else-if="curType !== 'dashboard'"
|
||||
:class="{ 'hidden-link': loading }"
|
||||
ref="pcanvas"
|
||||
public-link-status="true"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, nextTick, ref, reactive } from 'vue'
|
||||
import { initCanvasDataMobile } from '@/utils/canvasUtils'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import PreviewCanvas from '@/views/data-visualization/PreviewCanvas.vue'
|
||||
import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
|
||||
import { ProxyInfo, shareProxy } from './ShareProxy'
|
||||
import Exp from './exp.vue'
|
||||
@ -71,9 +81,14 @@ const loadCanvasData = (dvId, weight?) => {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const curType = ref('')
|
||||
const pcanvas = ref(null)
|
||||
|
||||
onMounted(async () => {
|
||||
dvMainStore.setMobileInPc(true)
|
||||
const proxyInfo = (await shareProxy.loadProxy()) as ProxyInfo
|
||||
curType.value = proxyInfo.type || 'dashboard'
|
||||
dvMainStore.setMobileInPc(curType.value === 'dashboard')
|
||||
if (!proxyInfo?.resourceId) {
|
||||
loading.value = false
|
||||
return
|
||||
@ -82,9 +97,17 @@ onMounted(async () => {
|
||||
linkExp.value = !!proxyInfo.exp
|
||||
pwdValid.value = !!proxyInfo.pwdValid
|
||||
nextTick(() => {
|
||||
loadCanvasData(proxyInfo.resourceId, proxyInfo.type)
|
||||
dvMainStore.setPublicLinkStatus(true)
|
||||
loading.value = false
|
||||
if (curType.value === 'dashboard') {
|
||||
loadCanvasData(proxyInfo.resourceId, proxyInfo.type)
|
||||
dvMainStore.setPublicLinkStatus(true)
|
||||
loading.value = false
|
||||
} else {
|
||||
const method = pcanvas?.value?.loadCanvasDataAsync
|
||||
if (method) {
|
||||
method(proxyInfo.resourceId, proxyInfo.type, null)
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@ -96,3 +119,15 @@ onMounted(async () => {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped>
|
||||
.link-container {
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.hidden-link {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user