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 => {