图片上传
This commit is contained in:
@@ -435,11 +435,18 @@
|
||||
url: 'http://219.157.255.213:9007/upload/uploadImage',
|
||||
filePath: imgUrl,
|
||||
name: 'files',
|
||||
header:{'content-type': 'application/x-www-form-urlencoded','Authorization': 'Bearer ' + uni.getStorageSync('token')},
|
||||
// header:{'content-type': 'application/x-www-form-urlencoded','Authorization': 'Bearer ' + uni.getStorageSync('token')},
|
||||
success: (uploadFileRes) => {
|
||||
const path=JSON.parse(uploadFileRes.data)
|
||||
that.form[name] = path.data.path
|
||||
console.log(that.form)
|
||||
if(path.code==-1){
|
||||
uni.showToast({
|
||||
title: path.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}else{
|
||||
that.form[name] = path.data.path
|
||||
console.log(that.form)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -165,12 +165,19 @@
|
||||
uni.uploadFile({
|
||||
url: 'http://219.157.255.213:9007/upload/uploadImage',
|
||||
filePath: imgUrl,
|
||||
name: 'image',
|
||||
header:{'content-type': 'application/x-www-form-urlencoded','Authorization': 'Bearer ' + uni.getStorageSync('token')},
|
||||
name: 'files',
|
||||
// header:{'content-type': 'application/x-www-form-urlencoded','Authorization': 'Bearer ' + uni.getStorageSync('token')},
|
||||
success: (uploadFileRes) => {
|
||||
const path=JSON.parse(uploadFileRes.data)
|
||||
that.userinfo.avatar = path.data.image_url
|
||||
console.log(that.carinfo)
|
||||
if(path.code==-1){
|
||||
uni.showToast({
|
||||
title: path.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}else{
|
||||
that.userinfo.avatar = path.data.path
|
||||
console.log(that.form)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user