Commit 4aa4b9c30d531bf71230c241ae6e5d17b466f5b3
1 parent
81251142
请求方法添加入参类型
Showing
1 changed file
with
6 additions
and
3 deletions
utils/request.js
| ... | ... | @@ -220,15 +220,18 @@ module.exports = { |
| 220 | 220 | * @param {Object} succ //成功的回调 |
| 221 | 221 | * @param {Object} fail //失败的回调 |
| 222 | 222 | */ |
| 223 | - json_post:function(url,data,succ,fail){ | |
| 224 | - var th=this; | |
| 223 | + json_post:function(url,data,succ,fail,mathod){ | |
| 224 | + var th=this; | |
| 225 | + var Mathod="POST"; | |
| 226 | + | |
| 227 | + if (mathod) Mathod = mathod; | |
| 225 | 228 | this.showLoading(); |
| 226 | 229 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; |
| 227 | 230 | var str = JSON.stringify(data); |
| 228 | 231 | wx.request({ |
| 229 | 232 | url: url, |
| 230 | 233 | data: str, |
| 231 | - method: 'POST', | |
| 234 | + method: Mathod, | |
| 232 | 235 | header: { |
| 233 | 236 | 'content-type': 'application/json' |
| 234 | 237 | },// 设置请求的 header | ... | ... |