From 3ecf75a1fb1f68eb60a41a8aa6ece64e4df46bc3 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: Wed, 11 May 2022 11:03:07 +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 dad93f1c..f01e879d 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -89,7 +89,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 a3d9db34..f27941de 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -92,8 +92,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 {