var requestUrl = "http://tp51.io/api.php/";
function post(url, data, fun, that) {
if (url == 'undefined') {
return false;
}
var postUrl = requestUrl + url;
wx.request({
url: postUrl,
data: data,
method: "POST",
dataType: "json",
header: {
'content-type': 'application/json'
},
success: function (res) {
that[fun](res.data.result);
},
fail: function (res) {
console.log('请求失败,请重试');
return {};
}
})
}
module.exports.post=post;