```
module.exports = (method,url,data,header)=>{
return new Promise((resolve,reject)=>{
wx.request({
url:`https://mall.natapp4.cc/lock/app${url}`,
data:data,
method:method,
header:{
'Accept': 'application/json',
'content-type': 'application/json',
'token': header,
},
success:resolve,
fail:reject
})
})
}
//method 你的HTTP 請求方法
// url 你的地址
//data 你的數據
```
引入文件
const fetch =require('../../utils/fetch')
使用請求
```
let data = {
mobile:this.data.inputPhone,
code:this.data.code,
openId:this.data.openId
}
console.log(data);
fetch('post','/wechatlogin',data)
.then(res=>{
console.log(res);
})
```