module.exports = { getInstance: function() { // wx.showToast({ // title: '加载中...', // icon: 'loading', // duration: 600 // }) return { _sucCallback: null, _failCallback: null, _method: 'GET', _data: {}, _header: { 'content-type': 'application/json' }, _url: '', send: function() { wx.request({ url: this._url, data: this._data, method: this._method, header: this._header, success: function(res) { this._sucCallback ? this._sucCallback(res) : null; }.bind(this), fail: function(res) { this._failCallback(res); }.bind(this) }); return this; }, success: function(callback) { this._sucCallback = callback; // setTimeout(function () { // wx.hideLoading() // }, 200) return this; }, fail: function(callback) { this._failCallback = callback; // setTimeout(function () { // wx.hideLoading() // }, 200) return this; }, url: function(url) { this._url = url; return this; }, data: function(data) { this._data = data; return this; }, header: function(header) { this._header = header; return this; }, method: function(method) { this._method = method; return this; } }; } };