Merge branch 'dev' into master-fetch-dev

This commit is contained in:
奔跑的面条
2023-09-13 10:44:28 +08:00
15 changed files with 202 additions and 110 deletions
@@ -20,14 +20,14 @@ export const syncData = () => {
onPositiveCallback: async () => {
window['$message'].success('正在同步编辑器...')
dataSyncUpdate && (await dataSyncUpdate())
dispatchEvent(new CustomEvent(SavePageEnum.CHART, { detail: chartEditStore.getStorageInfo }))
dispatchEvent(new CustomEvent(SavePageEnum.CHART, { detail: chartEditStore.getStorageInfo() }))
}
})
}
// 同步数据到预览页
export const syncDataToPreview = () => {
dispatchEvent(new CustomEvent(SavePageEnum.CHART_TO_PREVIEW, { detail: chartEditStore.getStorageInfo }))
dispatchEvent(new CustomEvent(SavePageEnum.CHART_TO_PREVIEW, { detail: chartEditStore.getStorageInfo() }))
}
// 侦听器更新
@@ -158,7 +158,7 @@ const editHandle = () => {
// 把内存中的数据同步到SessionStorage 便于传递给新窗口初始化数据
const updateToSession = (id: string) => {
const storageInfo = chartEditStore.getStorageInfo
const storageInfo = chartEditStore.getStorageInfo()
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
if (sessionStorageInfo?.length) {
@@ -1,41 +1,41 @@
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { canvasCut, downloadTextFile, JSONStringify } from '@/utils'
const chartEditStore = useChartEditStore()
// 导出
export const exportHandle = () => {
// 取消选中
chartEditStore.setTargetSelectChart(undefined)
// 导出数据
downloadTextFile(
JSONStringify(chartEditStore.getStorageInfo || []),
undefined,
'json'
)
// 导出图片
const range = document.querySelector('.go-edit-range') as HTMLElement
const watermark = document.getElementById('go-edit-watermark')
// 隐藏边距线
if (!range || !watermark) {
window['$message'].error('导出失败!')
return
}
// 记录缩放比例
const scaleTemp = chartEditStore.getEditCanvas.scale
// 百分百展示页面
chartEditStore.setScale(1, true)
// 展示水印
watermark.style.display = 'block'
setTimeout(() => {
canvasCut(range, () => {
// 隐藏水印
if (watermark) watermark.style.display = 'none'
// 还原页面大小
chartEditStore.setScale(scaleTemp, true)
})
}, 600)
}
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { canvasCut, downloadTextFile, JSONStringify } from '@/utils'
const chartEditStore = useChartEditStore()
// 导出
export const exportHandle = () => {
// 取消选中
chartEditStore.setTargetSelectChart(undefined)
// 导出数据
downloadTextFile(
JSONStringify(chartEditStore.getStorageInfo() || []),
undefined,
'json'
)
// 导出图片
const range = document.querySelector('.go-edit-range') as HTMLElement
const watermark = document.getElementById('go-edit-watermark')
// 隐藏边距线
if (!range || !watermark) {
window['$message'].error('导出失败!')
return
}
// 记录缩放比例
const scaleTemp = chartEditStore.getEditCanvas.scale
// 百分百展示页面
chartEditStore.setScale(1, true)
// 展示水印
watermark.style.display = 'block'
setTimeout(() => {
canvasCut(range, () => {
// 隐藏水印
if (watermark) watermark.style.display = 'none'
// 还原页面大小
chartEditStore.setScale(scaleTemp, true)
})
}, 600)
}
@@ -94,7 +94,7 @@ const previewHandle = () => {
const { id } = routerParamsInfo.params
// id 标识
const previewId = typeof id === 'string' ? id : id[0]
const storageInfo = chartEditStore.getStorageInfo
const storageInfo = chartEditStore.getStorageInfo()
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
if (sessionStorageInfo?.length) {
+1 -3
View File
@@ -209,9 +209,7 @@ export const useSync = () => {
chartHistoryStore.clearForwardStack()
}
}
} else {
// 非组件(顺便排除脏数据)
if (key !== 'editCanvasConfig' && key !== 'requestGlobalConfig') return
} else if (key === ChartEditStoreEnum.EDIT_CANVAS_CONFIG || key === ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG) {
componentMerge(chartEditStore[key], projectData[key], true)
}
}
@@ -6,8 +6,8 @@
:key="item.id"
:style="{
...getComponentAttrStyle(item.attr, groupIndex),
...getFilterStyle(item.styles),
...getTransformStyle(item.styles),
...getFilterStyle(groupData.styles),
...getTransformStyle(groupData.styles),
...getStatusStyle(item.status),
...getPreviewConfigStyle(item.preview),
...getBlendModeStyle(item.styles) as any
@@ -19,7 +19,11 @@
:chartConfig="item"
:themeSetting="themeSetting"
:themeColor="themeColor"
:style="{ ...getSizeStyle(item.attr) }"
:style="{
...getSizeStyle(item.attr),
...getFilterStyle(item.styles),
...getTransformStyle(item.styles)
}"
v-on="useLifeHandler(item)"
></component>
</div>
+1
View File
@@ -47,6 +47,7 @@ setTitle(`预览-${chartEditStore.editCanvasConfig.projectName}`)
const previewRefStyle = computed(() => {
return {
overflow: 'hidden',
...getEditCanvasConfigStyle(chartEditStore.editCanvasConfig),
...getFilterStyle(chartEditStore.editCanvasConfig)
}