完成书签分类页面的预加载

This commit is contained in:
HelloWorld 2020-04-08 08:48:00 +08:00
parent 72134d284f
commit 6c4dc01f36
2 changed files with 5 additions and 7 deletions

View File

@ -13,8 +13,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
var addBookmarkId = -1;
$scope.hoverBookmark = null;
$scope.showType = "createdAt";
$scope.loading = false;
$scope.loadTags = false;
$scope.loading = true;
$scope.tags = []; // 书签数据
$scope.tagsIndex = []; // 书签索引
$scope.bookmarks = [];
@ -344,7 +343,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
async function updateTags(_tags) {
let tags = JSON.parse(JSON.stringify(_tags));
$scope.loadTags = true;
$scope.loading = true;
$scope.tags = [];
tags.unshift({
@ -370,13 +369,13 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
tags[0].bookmarkClicked = true;
}
$scope.loadTags = false;
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexTags
});
$timeout(() => {
$scope.loading = false;
$scope.tags = tags;
if (!$scope.editMode) {
$scope.getBookmarks(null, null, null);
@ -427,7 +426,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
pubSubService.subscribe('EditCtr.addTagsSuccess', $scope, function (event, data) {
console.log('subscribe EditCtr.addTagsSuccess', data);
var menusScope = $('div[ng-controller="menuCtr"]').scope();
if (menusScope.login && menusScope.selectLoginIndex == 1) {
getTags();

View File

@ -1,4 +1,4 @@
<div class="ui segment js-tags">
<div class="ui segment js-tags" ng-show="!loading || tags.length > 0">
<div class="ui container" ng-show="!editMode" style="cursor:default">
<div class="ui label" style="margin:3px 15px 8px 0px;cursor:default;" ng-if="tag.bookmarkCount && tag.show" ng-repeat="tag in tags" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, 1, null)">
{{ tag.name }} ({{ tag.bookmarkCount || 0 }})
@ -50,7 +50,7 @@
</div>
</div>
</div>
<div class="ui huge text centered inline loader" ng-class="{active:loading, disabled: !loading}">
<div class="ui huge text centered inline loader" style="margin-top: 10px;" ng-class="{active:loading, disabled: !loading}">
正在加载中...
</div>
<table class="ui selectable sortable celled table js-tags-table" ng-if="showMode=='table'" style="margin-top:-15px;" ng-show="!loading && !editMode">