From b41184a5deec40313c5e7e27991802e11ec85dd2 Mon Sep 17 00:00:00 2001 From: yf <770153798@qq.com> Date: Tue, 7 Jan 2025 01:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DraftDesign/components/DesignPropEdit.vue | 7 +- .../components/node/ShapeBarCodeNode.vue | 308 ++++++++++++++++++ .../components/DraftDesign/config/index.ts | 55 ++++ .../DraftDesign/components/DesignPropEdit.vue | 7 +- .../components/DraftDesign/config/index.ts | 55 ++++ 5 files changed, 426 insertions(+), 6 deletions(-) create mode 100644 hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/node/ShapeBarCodeNode.vue diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue index 52e3fcd..0dc938f 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue @@ -310,7 +310,7 @@ import {reactive, watch} from 'vue' import {useMessage} from "@/hooks/web/useMessage"; import {DraftDesignDataApi} from "@/api/oms/draftdesigndata"; import DraftDesign from "@/components/DraftDesign/index.vue"; -import {ShapeType} from "@/components/DraftDesign/config"; +import {getHtml, ShapeType} from "@/components/DraftDesign/config"; import {ProductCareItemApi} from "@/api/oms/productcareitem"; import {replaceDomain} from "@/utils"; import * as FileApi from "@/api/infra/file"; @@ -632,8 +632,9 @@ const uploadFile = async (fileName) => { } const saveMaxSvg = (svgElement,fileName)=>{ - const blob = new Blob([svgElement?.parentElement?.innerHTML], { type: 'text/html' }); - const file = new File([blob], fileName+".html", {type: 'image/png'}); + const htmlStr = getHtml(`${svgElement?.parentElement?.innerHTML}`); + const blob = new Blob([htmlStr], { type: 'text/html' }); + const file = new File([blob], fileName+".html", {type: 'text/html'}); FileApi.updateFile({file: file}) .then((res) => { console.log("res"+res) diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/node/ShapeBarCodeNode.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/node/ShapeBarCodeNode.vue new file mode 100644 index 0000000..a05f495 --- /dev/null +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/node/ShapeBarCodeNode.vue @@ -0,0 +1,308 @@ + + + + + + diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts index 617a2a6..7834f88 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts @@ -521,3 +521,58 @@ export const configInfo = { return localStorage.setItem('lk_show_random_group_color', show ? 'true' : '') } } + +export const getHtml = (htmlStr:string)=>{ + return ` + + + + + oms稿件预览源文件 + + + +
+ *仅供参考 +
+ ${htmlStr} + + + + + + + ` +} diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue index 52e3fcd..0dc938f 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue @@ -310,7 +310,7 @@ import {reactive, watch} from 'vue' import {useMessage} from "@/hooks/web/useMessage"; import {DraftDesignDataApi} from "@/api/oms/draftdesigndata"; import DraftDesign from "@/components/DraftDesign/index.vue"; -import {ShapeType} from "@/components/DraftDesign/config"; +import {getHtml, ShapeType} from "@/components/DraftDesign/config"; import {ProductCareItemApi} from "@/api/oms/productcareitem"; import {replaceDomain} from "@/utils"; import * as FileApi from "@/api/infra/file"; @@ -632,8 +632,9 @@ const uploadFile = async (fileName) => { } const saveMaxSvg = (svgElement,fileName)=>{ - const blob = new Blob([svgElement?.parentElement?.innerHTML], { type: 'text/html' }); - const file = new File([blob], fileName+".html", {type: 'image/png'}); + const htmlStr = getHtml(`${svgElement?.parentElement?.innerHTML}`); + const blob = new Blob([htmlStr], { type: 'text/html' }); + const file = new File([blob], fileName+".html", {type: 'text/html'}); FileApi.updateFile({file: file}) .then((res) => { console.log("res"+res) diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts index 617a2a6..7834f88 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts @@ -521,3 +521,58 @@ export const configInfo = { return localStorage.setItem('lk_show_random_group_color', show ? 'true' : '') } } + +export const getHtml = (htmlStr:string)=>{ + return ` + + + + + oms稿件预览源文件 + + + +
+ *仅供参考 +
+ ${htmlStr} + + + + + + + ` +}