|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<n-space class="go-mt-0">
|
|
<n-space class="go-mt-0">
|
|
|
- <n-button v-for="item in btnList" :key="item.title" ghost size="small" @click="item.event">
|
|
|
|
|
|
|
+ <n-button v-for="item in btnList" :key="item.title" ghost @click="item.event">
|
|
|
<template #icon>
|
|
<template #icon>
|
|
|
<component :is="item.icon"></component>
|
|
<component :is="item.icon"></component>
|
|
|
</template>
|
|
</template>
|
|
@@ -14,13 +14,12 @@ import { shallowReactive } from 'vue'
|
|
|
import { renderIcon, fetchPathByName, routerTurnByPath, setSessionStorage, getLocalStorage } from '@/utils'
|
|
import { renderIcon, fetchPathByName, routerTurnByPath, setSessionStorage, getLocalStorage } from '@/utils'
|
|
|
import { PreviewEnum } from '@/enums/pageEnum'
|
|
import { PreviewEnum } from '@/enums/pageEnum'
|
|
|
import { StorageEnum } from '@/enums/storageEnum'
|
|
import { StorageEnum } from '@/enums/storageEnum'
|
|
|
-import { canvasCut, downloadTextFile } from '@/utils'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
|
|
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
|
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
|
|
import { icon } from '@/plugins'
|
|
import { icon } from '@/plugins'
|
|
|
|
|
|
|
|
-const { BrowsersOutlineIcon, SendIcon, DownloadIcon } = icon.ionicons5
|
|
|
|
|
|
|
+const { BrowsersOutlineIcon, SendIcon } = icon.ionicons5
|
|
|
const chartEditStore = useChartEditStore()
|
|
const chartEditStore = useChartEditStore()
|
|
|
|
|
|
|
|
const routerParamsInfo = useRoute()
|
|
const routerParamsInfo = useRoute()
|
|
@@ -54,45 +53,6 @@ const previewHandle = () => {
|
|
|
routerTurnByPath(path, [previewId], undefined, true)
|
|
routerTurnByPath(path, [previewId], undefined, true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 导入
|
|
|
|
|
-const importHandle = () => {}
|
|
|
|
|
-
|
|
|
|
|
-// 导出
|
|
|
|
|
-const exportHandle = () => {
|
|
|
|
|
- // 导出数据
|
|
|
|
|
- downloadTextFile(JSON.stringify(chartEditStore.getStorageInfo || []), undefined, 'json')
|
|
|
|
|
-
|
|
|
|
|
- // 导出图片
|
|
|
|
|
- const ruler = document.getElementById('mb-ruler')
|
|
|
|
|
- const range = document.querySelector('.go-edit-range') as HTMLElement
|
|
|
|
|
- const watermark = document.getElementById('go-edit-watermark')
|
|
|
|
|
- // 隐藏边距线
|
|
|
|
|
- if (!ruler || !range || !watermark) {
|
|
|
|
|
- window['$message'].error('导出失败!')
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- // 记录缩放比例
|
|
|
|
|
- const scaleTemp = chartEditStore.getEditCanvas.scale
|
|
|
|
|
- // 去除标尺Dom
|
|
|
|
|
- ruler.style.display = 'none'
|
|
|
|
|
- // 百分百展示页面
|
|
|
|
|
- chartEditStore.setScale(1, true)
|
|
|
|
|
- // 展示水印
|
|
|
|
|
- watermark.style.display = 'block'
|
|
|
|
|
-
|
|
|
|
|
- window['$message'].warning('生成截图和数据中, 请耐心等待...')
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- canvasCut(range, () => {
|
|
|
|
|
- // 隐藏水印
|
|
|
|
|
- if (watermark) watermark.style.display = 'none'
|
|
|
|
|
- // 放开边距线
|
|
|
|
|
- if (ruler) ruler.style.display = 'block'
|
|
|
|
|
- // 还原页面大小
|
|
|
|
|
- chartEditStore.setScale(scaleTemp, true)
|
|
|
|
|
- })
|
|
|
|
|
- }, 600)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// 发布
|
|
// 发布
|
|
|
const sendHandle = () => {
|
|
const sendHandle = () => {
|
|
|
window['$message'].warning('该功能暂未实现(因为压根没有后台)')
|
|
window['$message'].warning('该功能暂未实现(因为压根没有后台)')
|
|
@@ -105,12 +65,6 @@ const btnList = shallowReactive([
|
|
|
icon: renderIcon(BrowsersOutlineIcon),
|
|
icon: renderIcon(BrowsersOutlineIcon),
|
|
|
event: previewHandle
|
|
event: previewHandle
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- select: true,
|
|
|
|
|
- title: '下载',
|
|
|
|
|
- icon: renderIcon(DownloadIcon),
|
|
|
|
|
- event: exportHandle
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
select: true,
|
|
select: true,
|
|
|
title: '发布',
|
|
title: '发布',
|