Commit 2513173dde209b4e648d229c0a948ace5b036c6a
1 parent
426ec47a
请求方法的更新
Showing
1 changed file
with
5 additions
and
2 deletions
utils/request.js
| ... | ... | @@ -116,7 +116,8 @@ module.exports = { |
| 116 | 116 | }, |
| 117 | 117 | showLoading: function() { |
| 118 | 118 | wx.showLoading({ |
| 119 | - title: "加载中" | |
| 119 | + title: "加载中", | |
| 120 | + mask:true, | |
| 120 | 121 | }); |
| 121 | 122 | }, |
| 122 | 123 | hideLoading: function() { |
| ... | ... | @@ -220,6 +221,8 @@ module.exports = { |
| 220 | 221 | * @param {Object} fail //失败的回调 |
| 221 | 222 | */ |
| 222 | 223 | json_post:function(url,data,succ,fail){ |
| 224 | + var th=this; | |
| 225 | + this.showLoading(); | |
| 223 | 226 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; |
| 224 | 227 | var str = JSON.stringify(data); |
| 225 | 228 | wx.request({ |
| ... | ... | @@ -229,7 +232,7 @@ module.exports = { |
| 229 | 232 | header: { |
| 230 | 233 | 'content-type': 'application/json' |
| 231 | 234 | },// 设置请求的 header |
| 232 | - success: function (res) { succ(res); }, | |
| 235 | + success: function (res) { succ(res);th.hideLoading(); }, | |
| 233 | 236 | fail:function(res){fail(res);} |
| 234 | 237 | }) |
| 235 | 238 | } | ... | ... |