From 99dfd42372117b32d14769bbf10db5a724de9ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 10 May 2022 23:35:54 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=BB=84=E4=BB=B6=20=E9=83=A8=E5=88=86=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=AD=98=E5=82=A8url=E4=B8=B2=20=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=9B=9E=E6=98=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/FileUpload/index.vue | 7 ++++++- ruoyi-ui/src/components/ImageUpload/index.vue | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 78baf48dd..f41a712c8 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -90,7 +90,12 @@ export default { const list = Array.isArray(val) ? val : this.value.split(','); // 然后将数组转为对象数组 this.fileList = list.map(item => { - item = { name: item.name, url: item.url, ossId: item.ossId }; + // 字符串回显处理 如果此处存的是url可直接回显 如果存的是id需要调用接口查出来 + if (typeof item === "string") { + item = { name: item, url: item }; + } else { + item = { name: item.name, url: item.url, ossId: item.ossId }; + } item.uid = item.uid || new Date().getTime() + temp++; return item; }); diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index acd467011..2d1ed577c 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -93,8 +93,13 @@ export default { const list = Array.isArray(val) ? val : this.value.split(','); // 然后将数组转为对象数组 this.fileList = list.map(item => { - // 此处name使用ossId 防止删除出现重名 - item = { name: item.ossId, url: item.url, ossId: item.ossId }; + // 字符串回显处理 如果此处存的是url可直接回显 如果存的是id需要调用接口查出来 + if (typeof item === "string") { + item = { name: item, url: item }; + } else { + // 此处name使用ossId 防止删除出现重名 + item = { name: item.ossId, url: item.url, ossId: item.ossId }; + } return item; }); } else {