Commit 453185c5 by zhanxin liu

fix

parent 759a18ec
......@@ -128,20 +128,16 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
},
uploadPic(imgPath){
var currentTime = new Date().getTime();
var formData = new FormData();
let file = {uri: imgPath, type: 'application/octet-stream', name: currentTime+'.jpg'};
formData.append("file", file);
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
console.log(formData)
uni.request({
uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image',
method: 'POST',
body:formData,
files:[{uri: imgPath[0],name: currentTime+'.jpg'}],
filePath:"",
name:"",
header: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'user' : JSON.stringify(user)
},
success: (res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment