From 1a535e520256a288053e3299f91ea86feda1fc1c Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 3 Jan 2025 15:30:55 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/upload/src/image-upload.vue | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/web-antd/src/components/upload/src/image-upload.vue b/apps/web-antd/src/components/upload/src/image-upload.vue index 9ccb70fc..a000e05b 100644 --- a/apps/web-antd/src/components/upload/src/image-upload.vue +++ b/apps/web-antd/src/components/upload/src/image-upload.vue @@ -90,8 +90,25 @@ watch( value = v; const withUrlList: UploadProps['fileList'] = []; for (const item of _fileList) { - // 非ossId情况 - if (props.resultField !== 'ossId') { + // ossId情况 + if (props.resultField === 'ossId') { + const resp = await ossInfo([item]); + if (item && isString(item)) { + withUrlList.push({ + uid: item, // ossId作为uid 方便getValue获取 + name: item.slice(Math.max(0, item.lastIndexOf('/') + 1)), + status: 'done', + url: resp?.[0]?.url, + }); + } else if (item && isObject(item)) { + withUrlList.push({ + ...(item as any), + uid: item, + url: resp?.[0]?.url, + }); + } + } else { + // 非ossId情况 if (item && isString(item)) { withUrlList.push({ uid: uniqueId(), @@ -102,23 +119,6 @@ watch( } else if (item && isObject(item)) { withUrlList.push(item); } - return; - } - // ossId情况 - const resp = await ossInfo([item]); - if (item && isString(item)) { - withUrlList.push({ - uid: item, // ossId作为uid 方便getValue获取 - name: item.slice(Math.max(0, item.lastIndexOf('/') + 1)), - status: 'done', - url: resp?.[0]?.url, - }); - } else if (item && isObject(item)) { - withUrlList.push({ - ...(item as any), - uid: item, - url: resp?.[0]?.url, - }); } } fileList.value = withUrlList;