app.service("configService", function($http, http, errorMsg, wxUrl, errUrl,loadUrl,walletUrl){
//post获取数据
this.post = function(url, params, success){
$http.post(http + url, params).success(function(resp){
result(resp, success, function(resp){});
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//post获取数据(带错误方法)
this.postWithError = function(url, params, success, error){
$http.post(http + url, params).success(function(resp){
result(resp, success, error);
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//get获取数据
this.get = function(url, success, skipAuth){
$http.get(http + url).success(function(resp){
if (skipAuth) {
success(resp);
} else {
result(resp, success, function(resp){});
}
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//get获取数据(带错误方法)
this.getWithError = function(url, success, error){
$http.get(http + url).success(function(resp){
result(resp, success, error);
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//获取地址栏参数
this.getUrlParam = function(name){
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substring(1).match(reg);
if (r != null) return decodeURI(r[2]);//if (r != null) return unescape(r[2]);
return '';
//post获取数据
this.post = function(url, params, success){
$http.post(http + url, params).success(function(resp){
result(resp, success, function(resp){});
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//post获取数据(带错误方法)
this.postWithError = function(url, params, success, error){
$http.post(http + url, params).success(function(resp){
result(resp, success, error);
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//get获取数据
this.get = function(url, success, skipAuth){
$http.get(http + url).success(function(resp){
if (skipAuth) {
success(resp);
} else {
result(resp, success, function(resp){});
}
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//get获取数据(带错误方法)
this.getWithError = function(url, success, error){
$http.get(http + url).success(function(resp){
result(resp, success, error);
}).error(function(resp) {
layer.msg(errorMsg);
});
}
//获取地址栏参数
this.getUrlParam = function(name){
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substring(1).match(reg);
if (r != null) return decodeURI(r[2]);//if (r != null) return unescape(r[2]);
return '';
}
});
function result(resp, success, error){
};