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 @@