小程序的wx.request
没有对传过来的请求进行处理,对于各种状态进行处理,所以需要在代码里封装,这里是直接写app.jsl里的,get和post的封装.
首先写通用header
header
header: {
'app_code': "DAFENGBAODAI",
'client': 'miniProgram',
'imei': 'idfv',
'applicationId': 'miniprogram',
'wxToken': '',
'Content-Type': 'application/json',
}
post
post(options) {
let header = this.header
return new Promise((resolve, reject) => {
const requestTask = wx.request({
method: 'POST',
header: header,
url: