87,910
社区成员
发帖
与我相关
我的任务
分享
chooseImage: function() {
let that = this
wx.chooseImage({
count: 9,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
that.setData({
uploadlist: res.tempFilePaths
})
let tempFilePaths = res.tempFilePaths
for (var i = 0; i < tempFilePaths.length; i++) {
wx.uploadFile({
url: app.globalData.api + 'Justice/upload' + app.globalData.key,
filePath: tempFilePaths[i],
name: 'file',
header: {
'content-type': 'multipart/form-data'
},
formData: {
token: wx.getStorageSync('token'),
village_id: wx.getStorageSync('village_id'),
gov_id: wx.getStorageSync('gov_id'),
},
success(res) {
let rePath = JSON.parse(res.data)
console.log(rePath)
}
})
}
}
})
},
let files = [];
chooseImage : function(){
.....
success(res) {
let rePath = JSON.parse(res.data)
console.log(rePath)
files.push(rePath.url);
}
}