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,7 +116,8 @@ module.exports = { | ||
116 | }, | 116 | }, |
117 | showLoading: function() { | 117 | showLoading: function() { |
118 | wx.showLoading({ | 118 | wx.showLoading({ |
119 | - title: "加载中" | 119 | + title: "加载中", |
120 | + mask:true, | ||
120 | }); | 121 | }); |
121 | }, | 122 | }, |
122 | hideLoading: function() { | 123 | hideLoading: function() { |
@@ -220,6 +221,8 @@ module.exports = { | @@ -220,6 +221,8 @@ module.exports = { | ||
220 | * @param {Object} fail //失败的回调 | 221 | * @param {Object} fail //失败的回调 |
221 | */ | 222 | */ |
222 | json_post:function(url,data,succ,fail){ | 223 | json_post:function(url,data,succ,fail){ |
224 | + var th=this; | ||
225 | + this.showLoading(); | ||
223 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; | 226 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; |
224 | var str = JSON.stringify(data); | 227 | var str = JSON.stringify(data); |
225 | wx.request({ | 228 | wx.request({ |
@@ -229,7 +232,7 @@ module.exports = { | @@ -229,7 +232,7 @@ module.exports = { | ||
229 | header: { | 232 | header: { |
230 | 'content-type': 'application/json' | 233 | 'content-type': 'application/json' |
231 | },// 设置请求的 header | 234 | },// 设置请求的 header |
232 | - success: function (res) { succ(res); }, | 235 | + success: function (res) { succ(res);th.hideLoading(); }, |
233 | fail:function(res){fail(res);} | 236 | fail:function(res){fail(res);} |
234 | }) | 237 | }) |
235 | } | 238 | } |