diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue index 1f6e0fe..eda2701 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue @@ -59,7 +59,7 @@ import { mergeDeepObject, objectHasKey, } from "@/components/DraftDesign/utils/FuncUtil"; -import {register, getTeleport} from '@antv/x6-vue-shape' +import {register} from '@antv/x6-vue-shape' import './icons/style.css' @@ -169,8 +169,6 @@ const regNode = () => { }) } } -const TeleportContainer = defineComponent(getTeleport()); - // @ts-nocheck const emit = defineEmits(["save"]) const {t} = useI18n() // 国际化 @@ -699,25 +697,28 @@ const toPngUrl = (callback: (url: string) => void, options?: { bottom: number } }) => { - let widthScale = options && options.widthScale ? options.widthScale : 5 - let heightScale = options && options.heightScale ? options.heightScale : 5 - graph.toPNG((dataUri) => { - that.previewUrl = dataUri; - callback(that.previewUrl) - }, { - backgroundColor: that.pageConfig.background.areaColor, - width: that.pageConfig.width * (widthScale), - height: that.pageConfig.height * (heightScale), - padding: { - top: 0, - left: 0, - right: 0, - bottom: 0 - }, - quality: 1, - ...options - }) + setTimeout(()=>{ + //处理图片等待加载完成 + let widthScale = options && options.widthScale ? options.widthScale : 5 + let heightScale = options && options.heightScale ? options.heightScale : 5 + graph.toPNG((dataUri) => { + that.previewUrl = dataUri; + callback(that.previewUrl) + }, { + backgroundColor: that.pageConfig.background.areaColor, + width: that.pageConfig.width * (widthScale), + height: that.pageConfig.height * (heightScale), + padding: { + top: 0, + left: 0, + right: 0, + bottom: 0 + }, + quality: 1, + ...options + }) + },500) } const setPropList = (propDataInfo) => { const keys = Object.keys(propDataInfo) diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/utils/Dpi.ts b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/utils/Dpi.ts index 574b99c..670dd14 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/utils/Dpi.ts +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/utils/Dpi.ts @@ -38,7 +38,7 @@ export function calcDpiFromSize( screenSize=16,opt = 'd'){ } const tmpImage = {} export function convertImageToBase64(url) { - return new Promise(async (resolve, reject)=>{ + return new Promise(async (resolve)=>{ FileApi.getDomain().then(async (domain) => { url = replaceDomain(domain, url) if(tmpImage[url]){