fix: 处理联动的合并问题

This commit is contained in:
奔跑的面条 2023-03-16 20:25:31 +08:00
parent afe17efde9
commit 30f1f058c7
2 changed files with 21 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<template>
<div
:class="`go-preview ${localStorageInfo.editCanvasConfig.previewScaleType}`"
:class="`go-preview ${chartEditStore.editCanvasConfig.previewScaleType}`"
>
<template v-if="showEntity">
<!-- 实体区域 -->
@ -10,9 +10,7 @@
<!-- 展示层 -->
<div :style="previewRefStyle" v-if="show">
<!-- 渲染层 -->
<preview-render-list
:localStorageInfo="localStorageInfo"
></preview-render-list>
<preview-render-list></preview-render-list>
</div>
</div>
</div>
@ -23,9 +21,7 @@
<!-- 展示层 -->
<div :style="previewRefStyle" v-if="show">
<!-- 渲染层 -->
<preview-render-list
:localStorageInfo="localStorageInfo"
></preview-render-list>
<preview-render-list></preview-render-list>
</div>
</div>
</template>
@ -35,45 +31,43 @@
<script setup lang="ts">
import { computed } from 'vue'
import { PreviewRenderList } from './components/PreviewRenderList'
import { getFilterStyle, routerTurnByName, getSessionStorage, setTitle } from '@/utils'
import { getFilterStyle, routerTurnByName, setTitle } from '@/utils'
import { getEditCanvasConfigStyle, getSessionStorageInfo } from './utils'
import { PageEnum } from '@/enums/pageEnum'
import { StorageEnum } from '@/enums/storageEnum'
import { useScale } from './hooks/useScale.hook'
import { useStore } from './hooks/useStore.hook'
import { PreviewScaleEnum } from '@/enums/styleEnum'
import { useComInstall } from './hooks/useComInstall.hook'
import type { ChartEditStorageType } from './index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
const storageList: ChartEditStorageType[] = getSessionStorage(
StorageEnum.GO_CHART_STORAGE_LIST
)
await getSessionStorageInfo()
const chartEditStore = useChartEditStore() as unknown as ChartEditStorageType
const localStorageInfo = await getSessionStorageInfo() as unknown as ChartEditStorageType
setTitle(`预览-${localStorageInfo.editCanvasConfig.projectName}`)
setTitle(`预览-${chartEditStore.editCanvasConfig.projectName}`)
// @ts-ignore
if(localStorageInfo.isRelease === false) {
if(chartEditStore.isRelease === false) {
routerTurnByName(PageEnum.REDIRECT_UN_PUBLISH_NAME, true, false)
}
const previewRefStyle = computed(() => {
return {
...getEditCanvasConfigStyle(localStorageInfo.editCanvasConfig),
...getFilterStyle(localStorageInfo.editCanvasConfig.filterShow ? localStorageInfo.editCanvasConfig : undefined),
...getEditCanvasConfigStyle(chartEditStore.editCanvasConfig),
...getFilterStyle(chartEditStore.editCanvasConfig.filterShow ? chartEditStore.editCanvasConfig : undefined),
}
})
const showEntity = computed(() => {
const type = localStorageInfo.editCanvasConfig.previewScaleType
const type = chartEditStore.editCanvasConfig.previewScaleType
return (
type === PreviewScaleEnum.SCROLL_Y || type === PreviewScaleEnum.SCROLL_X
)
})
useStore(localStorageInfo)
const { entityRef, previewRef } = useScale(localStorageInfo)
const { show } = useComInstall(localStorageInfo)
useStore(chartEditStore)
const { entityRef, previewRef } = useScale(chartEditStore)
const { show } = useComInstall(chartEditStore)
</script>
<style lang="scss" scoped>

View File

@ -26,7 +26,12 @@ export const getSessionStorageInfo = async () => {
// 跳转未发布页
return { isRelease: false }
}
return { ...JSONParse(content), id }
const parseData = { ...JSONParse(content), id }
const { editCanvasConfig, requestGlobalConfig, componentList } = parseData
chartEditStore.editCanvasConfig = editCanvasConfig
chartEditStore.requestGlobalConfig = requestGlobalConfig
chartEditStore.componentList = componentList
return parseData
} else {
httpErrorHandle()
}