提交 425841ad 编写于 作者: H hxr

fix: 🐛 修复因接口调整而影响的调用页面的问题

上级 088bc5e4
......@@ -78,7 +78,7 @@ watch(
*/
async function handleUpload(options: UploadRequestOptions): Promise<any> {
// 上传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<any> {
);
fileList.value.splice(fileIndex, 1, {
name: fileInfo.name,
url: fileInfo.url,
name: data.name,
url: data.url,
} as UploadUserFile);
emit(
......
......@@ -33,8 +33,8 @@ const imgUrl = useVModel(props, "modelValue", emit);
* @param options
*/
async function uploadFile(options: UploadRequestOptions): Promise<any> {
const { data: fileInfo } = await FileAPI.update(options.file);
imgUrl.value = fileInfo.url;
const data = await FileAPI.upload(options.file);
imgUrl.value = data.url;
}
/**
......
......@@ -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);
});
},
},
......
......@@ -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) {
......
<script setup lang="ts">
import { uploadFileApi } from "@/api/file";
import FileAPI from "@/api/file";
const imgUrl = ref("");
const canvas = ref();
......@@ -68,7 +68,7 @@ const handleToFile = async () => {
const file = dataURLtoFile(canvas.value.toDataURL(), "签名.png");
if (!file) return;
const { data } = await uploadFileApi(file);
const data = await FileAPI.upload(file);
handleClearSign();
imgUrl.value = data.url;
};
......
......@@ -254,7 +254,7 @@ function handleSubmit() {
})
.finally(() => (loading.value = false));
} else {
DeptAPI.update(formData)
DeptAPI.add(formData)
.then(() => {
ElMessage.success("新增成功");
closeDialog();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册