//头像上传
changephoto:function(e){
var that = this
wx.chooseImage({
count: 1, // 最多可以选择的图片张数,默认9
success: function(res){
var pic = res.tempFilePaths;
console.log(pic[0]);
wx.uploadFile({
url: app.globalData.url +’/Member/get_img’,
filePath: pic[0],
name: ‘file’,
formData:{
‘user’: ‘test’
},
success: function(res){
var data = res.data
console.log(data);
},
fail:function(res){
console.log(res);
}
})
that.setData({
law_pic:pic
})
},
fail: function() {
that.setData({
law_pic:that.data.law_pic,
})
}
});
},
代码如上,域名的话用request在安卓苹果上都没问题的,求大神解决~