/**
- path请求地址
- params请求参数
- method请求方法
- */
const HOST = 'url';
module.exports = (path, params,token, method = 'POST') => {
let URL = path.includes('https//') ? path :${HOST}/${path}
;
return new Promise((resolve, reject) => {
wx.request({
url: URL,
method: method,
data: Object.assign({}, params),
dataType: 'json',
header: { 'content-type': 'application/json', 'token': token},
success: resolve,
fail: reject
})
})
}
网友评论