From 7761512bcb8281fcdeb15464a8d9c7b6fc7ef98b Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 25 Oct 2024 14:00:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E3=80=81=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=90=AB=E6=9C=89=E5=88=86=E7=BB=84=E3=80=81tab=E7=9A=84?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=AF=BC=E5=87=BA=E6=A8=A1=E6=9D=BF=E5=86=8D?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=97=B6=E5=87=BA=E7=8E=B0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=97=E5=BC=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/imgUtils.ts | 42 +++++++++++++++++------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/core/core-frontend/src/utils/imgUtils.ts b/core/core-frontend/src/utils/imgUtils.ts index 21d9cba60b..1c1c40ea65 100644 --- a/core/core-frontend/src/utils/imgUtils.ts +++ b/core/core-frontend/src/utils/imgUtils.ts @@ -158,17 +158,8 @@ export function dataURLToBlob(dataUrl) { return new Blob([u8arr], { type: mime }) } -// 解析静态文件 -export function findStaticSource(callBack) { - const staticResource = [] - // 系统背景文件 - if ( - typeof canvasStyleData.value.background === 'string' && - canvasStyleData.value.background.indexOf('static-resource') > -1 - ) { - staticResource.push(canvasStyleData.value.background) - } - componentData.value.forEach(item => { +function findStaticSourceInner(componentDataInfo, staticResource) { + componentDataInfo.forEach(item => { if ( typeof item.commonBackground.outerImage === 'string' && item.commonBackground.outerImage.indexOf('static-resource') > -1 @@ -182,8 +173,37 @@ export function findStaticSource(callBack) { item.propValue['url'].indexOf('static-resource') > -1 ) { staticResource.push(item.propValue['url']) + } else if ( + item.component === 'picture-group' && + item.propValue['urlList'] && + item.propValue['urlList'].length > 0 + ) { + item.propValue['urlList'].forEach(urlInfo => { + if (urlInfo.url.indexOf('static-resource') > -1) { + staticResource.push(urlInfo.url) + } + }) + } else if (item.component === 'Group') { + findStaticSourceInner(item.propValue, staticResource) + } else if (item.component === 'DeTabs') { + item.propValue.forEach(tabItem => { + findStaticSourceInner(tabItem.componentData, staticResource) + }) } }) +} + +// 解析静态文件 +export function findStaticSource(callBack) { + const staticResource = [] + // 系统背景文件 + if ( + typeof canvasStyleData.value.background === 'string' && + canvasStyleData.value.background.indexOf('static-resource') > -1 + ) { + staticResource.push(canvasStyleData.value.background) + } + findStaticSourceInner(componentData.value, staticResource) if (staticResource.length > 0) { try { findResourceAsBase64({ resourcePathList: staticResource }).then(rsp => {