From 5d45eee7a32c61284906742ba2d0417e9c41698f Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Wed, 21 Jan 2026 14:45:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=8E=A5=E5=9C=A8?= =?UTF-8?q?=E5=8D=B0=E8=8A=B1preview=E5=90=8E=E5=8D=B0=E8=8A=B1overall?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/Canvas/CanvasEditor/index.vue | 6 +++++ src/component/Detail/DesignDetail.vue | 4 ---- src/component/Detail/detailLeft/sketch.vue | 1 - .../Detail/detailRight/editPrintElement.vue | 23 ++++++++++--------- src/store/Detail/designDetail.ts | 19 ++++++++++++++- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/component/Canvas/CanvasEditor/index.vue b/src/component/Canvas/CanvasEditor/index.vue index d28d8d06..4c1b17ed 100644 --- a/src/component/Canvas/CanvasEditor/index.vue +++ b/src/component/Canvas/CanvasEditor/index.vue @@ -1034,6 +1034,11 @@ defineExpose({ width = 0,// 导出的图片宽度 height = 0, // 导出的图片高度 } = {}) => { + console.log('导出图片',{isContainFixed, +isContainFixedOther, +isPrintTrimsNoRepeat, +isPrintTrimsRepeat, +isContainNormalLayer}) var base64 = await canvasManager.exportImage({ isContainBg, isContainFixed, @@ -1047,6 +1052,7 @@ defineExpose({ expPicType, isEnhanceImg, }); + console.log('导出图片完成',) if(width > 0 && height > 0){ base64 = await resizeImage(base64, width, height); } diff --git a/src/component/Detail/DesignDetail.vue b/src/component/Detail/DesignDetail.vue index 5ef65b19..dd36ee2f 100644 --- a/src/component/Detail/DesignDetail.vue +++ b/src/component/Detail/DesignDetail.vue @@ -275,7 +275,6 @@ export default defineComponent({ const setRevocation = async ()=>{//设置撤销 let itemDetail = JSON.parse(JSON.stringify(detailData.designDetail)) let revocation:any = JSON.parse((await KeyValueDB.get("revocation") as any) || 'null') - console.log(itemDetail,revocation,'=========') if(!revocation)revocation = [] // let oppositeRevocation = JSON.parse((await KeyValueDB.get("oppositeRevocation") as any)) // if(revocation?.[0]?.designItemId != itemDetail.designItemId || revocation?.[0]?.designItemId == undefined){ @@ -291,7 +290,6 @@ export default defineComponent({ const revocation = async ()=>{//撤回 let oppositeRevocation = JSON.parse((await KeyValueDB.get("oppositeRevocation") as any) || 'null') let revocation = JSON.parse((await KeyValueDB.get("revocation") as any) || 'null') - console.log(oppositeRevocation,revocation,'=========') if(revocation.length <= 1)return oppositeRevocation.push(revocation[revocation.length-1]) revocation.splice(revocation.length-1,1) @@ -448,7 +446,6 @@ export default defineComponent({ let value = { currentType : JSON.parse(JSON.stringify(detailData.currentDetailType)), rv:rv, - fun:setRevocation } if(detailData?.designDetail?.newModel)detailData.designDetail.oldModel = JSON.parse(JSON.stringify(detailData.designDetail.newModel)) @@ -607,7 +604,6 @@ export default defineComponent({ detailDom.canvasBox.editFront(str) if(str == 'canvasEditor'){ let otherData = await updateOtherLayers('single') - console.log(otherData,'============') await detailDom.canvasBox.updateOtherLayers(otherData) } detailData.isEditPattern.value = str diff --git a/src/component/Detail/detailLeft/sketch.vue b/src/component/Detail/detailLeft/sketch.vue index 0e8946c7..34207478 100644 --- a/src/component/Detail/detailLeft/sketch.vue +++ b/src/component/Detail/detailLeft/sketch.vue @@ -79,7 +79,6 @@ export default defineComponent({ if(data?.imgUrl)data.url = data.imgUrl let value = { data, - id, } if(detailData.currentDetailType == 'sketch'){ detailData.selectDetail.sketchString = '' diff --git a/src/component/Detail/detailRight/editPrintElement.vue b/src/component/Detail/detailRight/editPrintElement.vue index 1ab70eae..1fbefccb 100644 --- a/src/component/Detail/detailRight/editPrintElement.vue +++ b/src/component/Detail/detailRight/editPrintElement.vue @@ -379,22 +379,23 @@ export default defineComponent({ item.object.blendMode = 'source-over' } } - if(item.ifSingle && editPrintElementData.stateOverallSingle == 'single'){ + if(item.ifSingle){ editPrintElementData.printStyleList[props.type].single.push(item) } - if(!item.ifSingle && editPrintElementData.stateOverallSingle == 'overall'){ + if(!item.ifSingle){ item.token = Date.now().toString() + (editPrintElementData.printStyleList[props.type].overall.length + '') // editPrintElementData.printStyleList[props.type].overall = [] editPrintElementData.printStyleList[props.type].overall.push(item) - setTimeout(()=>{ - editPrintElementDom.pingpuRef.updataList([ - { - action: ACTIONS.ADD, - data: item, - }, - ]); - }) - + if(editPrintElementData.stateOverallSingle == 'overall'){ + setTimeout(()=>{ + editPrintElementDom.pingpuRef.updataList([ + { + action: ACTIONS.ADD, + data: item, + }, + ]); + }) + } } } const setPosition = ()=>{ diff --git a/src/store/Detail/designDetail.ts b/src/store/Detail/designDetail.ts index ea6b3cf4..f8e36f91 100644 --- a/src/store/Detail/designDetail.ts +++ b/src/store/Detail/designDetail.ts @@ -315,6 +315,24 @@ const DesignDetail : Module = { detailItem.offset = [0,0] detailItem.transpose = item.transpose || [1,1] detailItem.rotate = item.rotate || 0 + function isJSONString(str) { + try { + JSON.parse(str); + return true; // 解析成功,是有效的JSON字符串 + } catch (e) { + return false; // 解析失败,不是有效的JSON字符串 + } + } + item.trims?.prints?.forEach((item:any) => { + if(isJSONString(item.object)){ + item.object = JSON.parse(item.object) + } + }); + item.printObject?.prints?.forEach((item:any) => { + if(isJSONString(item.object)){ + item.object = JSON.parse(item.object) + } + }); detailItem.printObject = item.printObject detailItem.trims = item.trims detailItem.type = item.type @@ -345,7 +363,6 @@ const DesignDetail : Module = { uploadDetail(state.selectDetail) } } - if(value.fun)value.fun() },