From 425841ad45d63e00a34df93c321f13e369d2795e Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sat, 4 May 2024 13:15:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BF=AE=E5=A4=8D=E5=9B=A0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4=E8=80=8C=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E7=94=A8=E9=A1=B5=E9=9D=A2=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Upload/MultiUpload.vue | 6 +++--- src/components/Upload/SingleUpload.vue | 4 ++-- src/components/WangEditor/index.vue | 7 +++---- src/views/demo/curd/index.vue | 4 ++-- src/views/demo/signature.vue | 4 ++-- src/views/system/dept/index.vue | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/Upload/MultiUpload.vue b/src/components/Upload/MultiUpload.vue index 5bf141cd..01b90780 100644 --- a/src/components/Upload/MultiUpload.vue +++ b/src/components/Upload/MultiUpload.vue @@ -78,7 +78,7 @@ watch( */ async function handleUpload(options: UploadRequestOptions): Promise { // 上传API调用 - const { data: fileInfo } = await FileAPI.upload(options.file); + const data = await FileAPI.upload(options.file); // 上传成功需手动替换文件路径为远程URL,否则图片地址为预览地址 blob:http:// const fileIndex = fileList.value.findIndex( @@ -86,8 +86,8 @@ async function handleUpload(options: UploadRequestOptions): Promise { ); fileList.value.splice(fileIndex, 1, { - name: fileInfo.name, - url: fileInfo.url, + name: data.name, + url: data.url, } as UploadUserFile); emit( diff --git a/src/components/Upload/SingleUpload.vue b/src/components/Upload/SingleUpload.vue index ff242f0c..5da8039a 100644 --- a/src/components/Upload/SingleUpload.vue +++ b/src/components/Upload/SingleUpload.vue @@ -33,8 +33,8 @@ const imgUrl = useVModel(props, "modelValue", emit); * @param options */ async function uploadFile(options: UploadRequestOptions): Promise { - const { data: fileInfo } = await FileAPI.update(options.file); - imgUrl.value = fileInfo.url; + const data = await FileAPI.upload(options.file); + imgUrl.value = data.url; } /** diff --git a/src/components/WangEditor/index.vue b/src/components/WangEditor/index.vue index 2f4c6782..bdc4cc8d 100644 --- a/src/components/WangEditor/index.vue +++ b/src/components/WangEditor/index.vue @@ -23,7 +23,7 @@ import { Editor, Toolbar } from "@wangeditor/editor-for-vue"; // API 引用 -import { uploadFileApi } from "@/api/file"; +import FileAPI from "@/api/file"; const props = defineProps({ modelValue: { @@ -46,9 +46,8 @@ const editorConfig = ref({ uploadImage: { // 自定义图片上传 async customUpload(file: any, insertFn: any) { - uploadFileApi(file).then((response) => { - const url = response.data.url; - insertFn(url); + FileAPI.upload(file).then((data) => { + insertFn(data.url); }); }, }, diff --git a/src/views/demo/curd/index.vue b/src/views/demo/curd/index.vue index b3e02d85..d4998e9a 100644 --- a/src/views/demo/curd/index.vue +++ b/src/views/demo/curd/index.vue @@ -65,8 +65,8 @@ const { // 编辑 async function handleEditClick(row: IObject) { // 根据id获取数据进行填充 - const response = await UserAPI.getFormData(row.id); - editModalRef.value?.setModalVisible(response.data); + const data = await UserAPI.getFormData(row.id); + editModalRef.value?.setModalVisible(data); } // 其他工具栏 function handleToolbarClick(name: string) { diff --git a/src/views/demo/signature.vue b/src/views/demo/signature.vue index c63fc444..ce5fb4a5 100644 --- a/src/views/demo/signature.vue +++ b/src/views/demo/signature.vue @@ -1,5 +1,5 @@