|
|
@ -3,6 +3,7 @@ var apiUrl = '/api/v1/';
|
|
|
|
var debug = false; //调试标志,如果在本地请置为true
|
|
|
|
var debug = false; //调试标志,如果在本地请置为true
|
|
|
|
|
|
|
|
|
|
|
|
if(debug===true){
|
|
|
|
if(debug===true){
|
|
|
|
|
|
|
|
//apiUrl = 'http://localhost:3000/api/v1/';
|
|
|
|
apiUrl = 'https://www.trustie.net/api/v1/';
|
|
|
|
apiUrl = 'https://www.trustie.net/api/v1/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -435,6 +436,25 @@ app.directive('textAutoHeight', function($timeout){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.directive('loadingSpinner', function ($http) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
restrict: 'A',
|
|
|
|
|
|
|
|
replace: true,
|
|
|
|
|
|
|
|
template: '<div class="loading-bg"><div class="loading-box"><img src="/images/wechat/loading.gif" alt=""/><span>加载中...</span></div></div>',
|
|
|
|
|
|
|
|
link: function (scope, element, attrs) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope.$watch('activeCalls', function (newVal, oldVal) {
|
|
|
|
|
|
|
|
if (newVal == 0) {
|
|
|
|
|
|
|
|
$(element).hide();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
$(element).show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProvider) {
|
|
|
|
app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProvider) {
|
|
|
|
$routeProvider
|
|
|
|
$routeProvider
|
|
|
|
.when('/activities', {
|
|
|
|
.when('/activities', {
|
|
|
@ -472,22 +492,30 @@ app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProv
|
|
|
|
.otherwise({
|
|
|
|
.otherwise({
|
|
|
|
redirectTo: '/activities'
|
|
|
|
redirectTo: '/activities'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//$httpProvider.interceptors.push('timestampMarker');
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//loading
|
|
|
|
//监听异步请求
|
|
|
|
app.factory('timestampMarker', ["$rootScope", function ($rootScope) {
|
|
|
|
$httpProvider.interceptors.push(function ($q, $rootScope) {
|
|
|
|
var timestampMarker = {
|
|
|
|
if ($rootScope.activeCalls == undefined) {
|
|
|
|
request: function (config) {
|
|
|
|
$rootScope.activeCalls = 0;
|
|
|
|
$rootScope.loading = true;
|
|
|
|
}
|
|
|
|
config.requestTimestamp = new Date().getTime();
|
|
|
|
|
|
|
|
return config;
|
|
|
|
return {
|
|
|
|
},
|
|
|
|
request: function (config) {
|
|
|
|
response: function (response) {
|
|
|
|
$rootScope.activeCalls += 1;
|
|
|
|
// $rootScope.loading = false;
|
|
|
|
return config;
|
|
|
|
response.config.responseTimestamp = new Date().getTime();
|
|
|
|
},
|
|
|
|
return response;
|
|
|
|
requestError: function (rejection) {
|
|
|
|
}
|
|
|
|
$rootScope.activeCalls -= 1;
|
|
|
|
};
|
|
|
|
return rejection;
|
|
|
|
return timestampMarker;
|
|
|
|
},
|
|
|
|
|
|
|
|
response: function (response) {
|
|
|
|
|
|
|
|
$rootScope.activeCalls -= 1;
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
responseError: function (rejection) {
|
|
|
|
|
|
|
|
$rootScope.activeCalls -= 1;
|
|
|
|
|
|
|
|
return rejection;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
}]);
|
|
|
|
}]);
|
|
|
|