|
|
|
@ -1,25 +1,12 @@ |
|
|
|
import {_form, _post} from '../http/index' |
|
|
|
import { baseUrl } from "../config/env"; |
|
|
|
import axios from 'axios'; |
|
|
|
const http = axios.create({ |
|
|
|
traditional: true, |
|
|
|
contentType : "application/json", |
|
|
|
timeout: 1000 * 500000, // 1 秒
|
|
|
|
}); |
|
|
|
import http from '../http/http'; |
|
|
|
|
|
|
|
const uploadFile = (files, callback) => { |
|
|
|
files.status = "uploading"; |
|
|
|
files.message = "上传中..."; |
|
|
|
// 需要使用 FormData 进行文件上传
|
|
|
|
let form = new FormData(); |
|
|
|
form.append("file", files.file); |
|
|
|
axios({ |
|
|
|
method: "post", |
|
|
|
url: baseUrl+ "/app-enf/common/file/upload", |
|
|
|
data: form, |
|
|
|
headers: { |
|
|
|
'Content-Type': 'multipart/form-data' |
|
|
|
} |
|
|
|
}) |
|
|
|
http.post("/app-enf/common/file/upload", form) |
|
|
|
.then((res) => { |
|
|
|
files.status = "done"; |
|
|
|
files.message = "上传成功"; |
|
|
|
@ -30,7 +17,6 @@ const uploadFile = (files,callback) => { |
|
|
|
files.message = "上传失败"; |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const nameCorrect=(name)=>{ |
|
|
|
|