uploadFile:function(e){
console.log(e);
wx.showToast({
title:‘加载中’,
icon:‘loading’,
});
var acc=wx.getStorageSync(‘account’);
const that = this;
wx.request({
url: ’ ',
data: {
account_no: acc,
files:e.detail.value
},
header: {
“Content-Type”: “application/x-www-form-urlencoded”
},
method:‘POST’,
dataType:‘json’,
success: function (res) {
wx.downloadFile({
url: ’ ',
success: function (res) {
var filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log(‘打开文档成功’)
var tempFilePath = res.tempFilePath
wx.uploadFile({
url: ‘https://cibhelp.xiaohesoft.com/cibapi/monthlyplan/plan_file_upload.php’, //仅为示例,非真实的接口地址
filePath: tempFilePath,
name: ‘files’,
formData:{
‘user’: ‘test’
},
success: function(res){
var data = res.data
//do something
}
})
}
})
}
})
that.setData({
upFile:res.tempFilePat
})
console.log(res);
console.log(res.data);
}
});
wx.hideToast();
}