给搜索加了个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.totalPages = 0;
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.inputPage = ''; $scope.inputPage = '';
$scope.loading = false;
$scope.changeCurrentPage = function(currentPage) { $scope.changeCurrentPage = function(currentPage) {
currentPage = parseInt(currentPage) || 0; currentPage = parseInt(currentPage) || 0;
console.log(currentPage); console.log(currentPage);
@ -152,18 +153,23 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
} }
function searchBookmarks(params) { function searchBookmarks(params) {
$scope.loading = true;
bookmarkService.searchBookmarks(params) bookmarkService.searchBookmarks(params)
.then((data) => { .then((data) => {
$scope.bookmarks = data.bookmarks; $scope.bookmarks = data.bookmarks;
$scope.bookmarkCount = data.totalItems; $scope.bookmarkCount = data.totalItems;
$scope.totalPages = Math.ceil($scope.bookmarkCount / perPageItems); $scope.totalPages = Math.ceil($scope.bookmarkCount / perPageItems);
toastr.success('搜索书签成功,共为您找到相关书签约 ' + $scope.bookmarkCount + ' 个', "提示"); $scope.loading = false;
// 有点问题,暂时留在这里 // 有点问题,暂时留在这里
// pubSubService.publish('Common.menuActive', { // pubSubService.publish('Common.menuActive', {
// login: true, // login: true,
// index: 0 // 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.inputPage = '';
$scope.loadBookmarks = false; $scope.loadBookmarks = false;
pubSubService.publish('Common.menuActive', {
login: true,
index: 1
});
}) })
.catch((err) => { .catch((err) => {
console.log('getTags err', 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"> <div class="fourteen wide column" ng-show="!showSearch">
共为您找到相关书签约{{bookmarkCount}}个 共为您找到相关书签约{{bookmarkCount}}个
</div> </div>
@ -113,7 +115,7 @@
</div> </div>
</div> </div>
</div> </div>
<table class="ui celled table"> <table class="ui celled table" ng-show="!loading">
<thead> <thead>
<tr> <tr>
<th>标题</th> <th>标题</th>