给搜索加了个load动画

This commit is contained in:
luchenqun 2017-02-22 20:48:21 +08:00
parent a64cbdb63f
commit e9df59b560
3 changed files with 17 additions and 4 deletions

View File

@ -17,6 +17,7 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
$scope.totalPages = 0;
$scope.currentPage = 1;
$scope.inputPage = '';
$scope.loading = false;
$scope.changeCurrentPage = function(currentPage) {
currentPage = parseInt(currentPage) || 0;
console.log(currentPage);
@ -152,18 +153,23 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
}
function searchBookmarks(params) {
$scope.loading = true;
bookmarkService.searchBookmarks(params)
.then((data) => {
$scope.bookmarks = data.bookmarks;
$scope.bookmarkCount = data.totalItems;
$scope.totalPages = Math.ceil($scope.bookmarkCount / perPageItems);
toastr.success('搜索书签成功,共为您找到相关书签约 ' + $scope.bookmarkCount + ' 个', "提示");
$scope.loading = false;
// 有点问题,暂时留在这里
// pubSubService.publish('Common.menuActive', {
// login: true,
// index: 0
// });
})
.catch((err) => console.log('getBookmarks err', err));
.catch((err) => {
console.log('getBookmarks err', err);
$scope.loading = false;
});
}
}]);

View File

@ -45,6 +45,11 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', 'book
$scope.inputPage = '';
$scope.loadBookmarks = false;
pubSubService.publish('Common.menuActive', {
login: true,
index: 1
});
})
.catch((err) => {
console.log('getTags err', err);

View File

@ -1,4 +1,6 @@
<div class="ui grid" style="height:45px">
<div class="ui huge text centered inline loader" ng-class="{active:loading, disabled: !loading}">
加载中,请稍候...</div>
<div class="ui grid" style="height:45px" ng-show="!loading">
<div class="fourteen wide column" ng-show="!showSearch">
共为您找到相关书签约{{bookmarkCount}}个
</div>
@ -113,7 +115,7 @@
</div>
</div>
</div>
<table class="ui celled table">
<table class="ui celled table" ng-show="!loading">
<thead>
<tr>
<th>标题</th>