这是上传的代码
附件有查看控制台的图片,请求参数里面什么都没有
selectPic(type) {
let this_ = this
uni.chooseImage({
count: 1,
sourceType: [type],
success: (res) => {
console.log(res)
this_.close('headPic')
this_.picSrc = res.tempFilePaths[0]
const tempFilePaths = res.tempFilePaths;
const token = uni.getStorageSync('token');
uni.uploadFile({
url: 'http://148.70.55.201:8089/backwordSystem/uploadFile',
filePath: tempFilePaths[0],
fileType: "image",
name: 'file',
header: {
'X-Token': token
},
formData: {
userId: this.userId,
userIdenty: "1"
},
success: (uploadFileRes)=>{
console.log(uploadFileRes);
this.userImg="http://148.70.55.201:8089/backwordSystem"+uploadFileRes.data.data
this.$minApi.updatetUserInfo({
userIdenty: 1,
id: this.userId,
avatarPath: this.userImg
}).then(data => {
console.log(data)
// this.getUserInfo()
})
}
});
},
})
}