From bbd112d5a31d39a144518f436580bba688e3418a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 18 Apr 2025 13:25:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=96=87=E4=BB=B6&=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BB=84=E4=BB=B6=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9C=B0?= =?UTF-8?q?=E5=9D=80&=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/FileUpload/index.vue | 14 ++++++++++++-- ruoyi-ui/src/components/ImageUpload/index.vue | 12 +++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 03c3d55b..7b4fe120 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -5,6 +5,7 @@ :action="uploadFileUrl" :before-upload="handleBeforeUpload" :file-list="fileList" + :data="data" :limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed" @@ -48,6 +49,15 @@ export default { props: { // 值 value: [String, Object, Array], + // 上传接口地址 + action: { + type: String, + default: "/file/upload" + }, + // 上传携带的参数 + data: { + type: Object + }, // 数量限制 limit: { type: Number, @@ -78,7 +88,7 @@ export default { return { number: 0, uploadList: [], - uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传文件服务器地址 + uploadFileUrl: process.env.VUE_APP_BASE_API + this.action, // 上传文件服务器地址 headers: { Authorization: "Bearer " + getToken(), }, @@ -152,7 +162,7 @@ export default { // 上传失败 handleUploadError(err) { this.$modal.msgError("上传文件失败,请重试"); - this.$modal.closeLoading() + this.$modal.closeLoading(); }, // 上传成功回调 handleUploadSuccess(res, file) { diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index 7da56eb0..4966c654 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -6,6 +6,7 @@ list-type="picture-card" :on-success="handleUploadSuccess" :before-upload="handleBeforeUpload" + :data="data" :limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed" @@ -48,6 +49,15 @@ import { getToken } from "@/utils/auth"; export default { props: { value: [String, Object, Array], + // 上传接口地址 + action: { + type: String, + default: "/file/upload" + }, + // 上传携带的参数 + data: { + type: Object + }, // 图片数量限制 limit: { type: Number, @@ -76,7 +86,7 @@ export default { dialogImageUrl: "", dialogVisible: false, hideUpload: false, - uploadImgUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传的图片服务器地址 + uploadImgUrl: process.env.VUE_APP_BASE_API + this.action, // 上传的图片服务器地址 headers: { Authorization: "Bearer " + getToken(), },