import util from &
#39;util.js';/**
* url 请求地址
* success 成功的回调
* fail 失败的回调
*/
function
_get( url, success, fail ) {
console.log(
"------start---_get----"
);
wx.request( {
url: url,
header: {
success:
function
( res ) {
success( res ); },
fail:
function
( res ) {
fail( res ); } });
console.log(
"----end-----_get----"
);}
function
_post_from(url,data, success, fail ) {
console.log(
"----_post--start-------"
);
wx.request( {
url: url,
header: { &
#39;content-type': 'application/x-www-form-urlencoded', },
method:&
#39;POST',
data:{data: data},
success:
function
( res ) {
success( res ); },
fail:
function
( res ) {
fail( res ); } });
console.log(
"----end-----_get----"
);}
function
_post_json(url,data, success, fail ) {
console.log(
"----_post--start-------"
);
wx.request( {
url: url,
header: { &
#39;content-type': 'application/json', },
method:&
#39;POST',
data:data,
success:
function
( res ) {
success( res ); },
fail:
function
( res ) {
fail( res ); } });
console.log(
"----end----_post-----"
);}module.exports = {
_get: _get,
_post:_post,
_post_json:_post_json}