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

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

@ -7,13 +7,13 @@
</div>
</div>
<div class="image hot-image" href="{{ bookmark.url }}" style="cursor:pointer" ng-click="jumpToUrl(bookmark.url)">
<img ng-src="{{bookmark.snap_url}}" err-src="./images/snap/default.png" />
<img ng-src="{{bookmark.snap_url}}" err-src="./images/snap/default.png"/>
</div>
<div class="extra content" ng-show="!bookmark.edit">
<img class="ui avatar image" style="width:16px;height:16px;" ng-src="{{bookmark.favicon_url}}">
<span class="sourceName">{{ bookmark.created_by }}</span>
<span class="favCount">·{{ bookmark.fav_count }}人收藏</span>
<i class="ellipsis horizontal icon right floated" style="margin-top:6px;"ng-mouseover="bookmark.edit=true;"></i>
<i class="ellipsis horizontal icon right floated" style="margin-top:6px;" ng-mouseover="bookmark.edit=true;"></i>
</div>
<div class="extra content" ng-show="bookmark.edit" ng-mouseleave="bookmark.edit=false;">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 8px;margin-top:4px;" ng-src="./images/favorite.png" ng-click="favoriteBookmark(bookmark)" title="一键收藏">
@ -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>