31 lines
539 B
JavaScript
31 lines
539 B
JavaScript
//请求接口
|
|
let request = function (obj){
|
|
let {
|
|
url,
|
|
method,
|
|
header,
|
|
dataType,
|
|
responseType,
|
|
complete
|
|
} = obj
|
|
return new Promise((res,rej)=>{
|
|
Wx.request({
|
|
url,
|
|
method,
|
|
header,
|
|
dataType,
|
|
responseType,
|
|
success(data){
|
|
res(data)
|
|
},
|
|
fail(data){
|
|
rej(data)
|
|
},
|
|
complete
|
|
})
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
request
|
|
} |