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

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; var addBookmarkId = -1;
$scope.hoverBookmark = null; $scope.hoverBookmark = null;
$scope.showType = "createdAt"; $scope.showType = "createdAt";
$scope.loading = false; $scope.loading = true;
$scope.loadTags = false;
$scope.tags = []; // 书签数据 $scope.tags = []; // 书签数据
$scope.tagsIndex = []; // 书签索引 $scope.tagsIndex = []; // 书签索引
$scope.bookmarks = []; $scope.bookmarks = [];
@ -344,7 +343,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
async function updateTags(_tags) { async function updateTags(_tags) {
let tags = JSON.parse(JSON.stringify(_tags)); let tags = JSON.parse(JSON.stringify(_tags));
$scope.loadTags = true; $scope.loading = true;
$scope.tags = []; $scope.tags = [];
tags.unshift({ tags.unshift({
@ -370,13 +369,13 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
tags[0].bookmarkClicked = true; tags[0].bookmarkClicked = true;
} }
$scope.loadTags = false;
pubSubService.publish('Common.menuActive', { pubSubService.publish('Common.menuActive', {
login: true, login: true,
index: dataService.LoginIndexTags index: dataService.LoginIndexTags
}); });
$timeout(() => { $timeout(() => {
$scope.loading = false;
$scope.tags = tags; $scope.tags = tags;
if (!$scope.editMode) { if (!$scope.editMode) {
$scope.getBookmarks(null, null, null); $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) { pubSubService.subscribe('EditCtr.addTagsSuccess', $scope, function (event, data) {
console.log('subscribe EditCtr.addTagsSuccess', data); console.log('subscribe EditCtr.addTagsSuccess', data);
var menusScope = $('div[ng-controller="menuCtr"]').scope(); var menusScope = $('div[ng-controller="menuCtr"]').scope();
if (menusScope.login && menusScope.selectLoginIndex == 1) { if (menusScope.login && menusScope.selectLoginIndex == 1) {
getTags(); 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 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)"> <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 }}) {{ tag.name }} ({{ tag.bookmarkCount || 0 }})
@ -50,7 +50,7 @@
</div> </div>
</div> </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> </div>
<table class="ui selectable sortable celled table js-tags-table" ng-if="showMode=='table'" style="margin-top:-15px;" ng-show="!loading && !editMode"> <table class="ui selectable sortable celled table js-tags-table" ng-if="showMode=='table'" style="margin-top:-15px;" ng-show="!loading && !editMode">