From 6c7c9f5da6470d6b73d4bd1d06ca6900e9413c54 Mon Sep 17 00:00:00 2001 From: aixianling Date: Fri, 25 Feb 2022 11:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AiUploader/AiUploader.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/AiUploader/AiUploader.vue b/src/components/AiUploader/AiUploader.vue index 8c11ff4..7b72044 100644 --- a/src/components/AiUploader/AiUploader.vue +++ b/src/components/AiUploader/AiUploader.vue @@ -51,7 +51,7 @@ export default { fileId: String, mediaId: String, def: {default: () => []}, - action: {default: '/app/wxcp/upload/uploadFile'}, + action: {default: '/admin/file/add'}, preview: Boolean, size: {default: 10 * 1024 * 1024}, disabled: Boolean, @@ -124,7 +124,7 @@ export default { uni.hideLoading() } else { uni.uploadFile({ - url: this.$instance.defaults.baseURL + '/admin/file/add', + url: this.$instance.defaults.baseURL + this.action, filePath: img, name: 'file', header: { @@ -137,10 +137,10 @@ export default { if (res?.data) { this.$emit('data', res.data) this.$u.toast('上传成功!') - if (this.action == '/app/wxcp/upload/uploadFile') { - this.$emit('update:mediaId', res.data?.media?.mediaId) - this.$emit('update:fileId', res.data.file.id) - this.fileList.push(res.data.file) + if (this.action == '/admin/file/add') { + this.fileList.push({url: res.data?.split(";")?.[0], id: res.data?.split(";")?.[1]}) + this.$emit('input', [...this.fileList]) + this.$emit('change', [...this.fileList]) } else if (this.action == '/admin/file/add2') { let info = res.data this.$emit('update:fileId', info?.id) @@ -150,8 +150,6 @@ export default { } this.$emit("update:def", this.fileList) this.$emit("list", this.fileList) - this.$emit('input', [...this.fileList]) - this.$emit('change', [...this.fileList]) } else { this.$u.toast(res.msg) }