更新从数据库加载数据的方法

This commit is contained in:
luchenqun 2017-03-18 18:33:14 +08:00
parent 2f9b6ddd64
commit b76b96e223
2 changed files with 14 additions and 4 deletions

View File

@ -216,8 +216,14 @@ app.controller('hotCtr', ['$scope', '$state', '$stateParams', '$filter', '$windo
}
function getHotBookmarksbyCache() {
var date = curentDate($scope.curDay, "yyyyMMdd");
if (date < "20160715") {
$scope.loadBusy = false;
toastr.info('您已将将所有的热门标签都加载完了!', "提示");
return; // 这是最早的了。
}
var params = {
date: curentDate($scope.curDay, "yyyyMMdd"),
date: date,
}
$scope.loadBusy = true;
bookmarkService.getHotBookmarks(params)
@ -230,12 +236,16 @@ app.controller('hotCtr', ['$scope', '$state', '$stateParams', '$filter', '$windo
})
$scope.curDay--;
$scope.loadBusy = false;
if (data && data.length == 0) {
getHotBookmarksbyCache(); // 没有继续请求
}
updateEditPos();
})
.catch((err) => {
toastr.error("getHotBookmarksbyCache: " + JSON.stringify(err), "提示");
$scope.curDay--;
$scope.loadBusy = false;
getHotBookmarksbyCache(); // 没有继续请求
updateEditPos();
});
}

View File

@ -26,6 +26,6 @@
<div style="width:22px;height:22px;" class="js-hot-random" ng-click="randomHotBookmarks()" title="随机查看热门收藏,如需回到最新热门收藏,请点击菜单按钮热门收藏" ng-show="!loadBusy">
<img class="ui ui middle aligned tiny image" ng-src="./images/random.png">
</div>
<div class="ui massive text centered inline loader" ng-class="{active:loadBusy, disabled:!loadBusy}" style="top:15px;">
<div class="ui massive text centered inline loader js-hot-loader" ng-class="{active:loadBusy, disabled:!loadBusy}" style="top:15px;">
正在加载中...</div>
</div>