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,15 +220,18 @@ module.exports = { | ||
| 220 | * @param {Object} succ //成功的回调 | 220 | * @param {Object} succ //成功的回调 |
| 221 | * @param {Object} fail //失败的回调 | 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 | this.showLoading(); | 228 | this.showLoading(); |
| 226 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; | 229 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; |
| 227 | var str = JSON.stringify(data); | 230 | var str = JSON.stringify(data); |
| 228 | wx.request({ | 231 | wx.request({ |
| 229 | url: url, | 232 | url: url, |
| 230 | data: str, | 233 | data: str, |
| 231 | - method: 'POST', | 234 | + method: Mathod, |
| 232 | header: { | 235 | header: { |
| 233 | 'content-type': 'application/json' | 236 | 'content-type': 'application/json' |
| 234 | },// 设置请求的 header | 237 | },// 设置请求的 header |