更新了一下标签的跳转
This commit is contained in:
parent
fde846f138
commit
1817ea2ca8
|
|
@ -25,6 +25,9 @@ app.config(function($stateProvider, $urlRouterProvider, $httpProvider) {
|
||||||
.state('tags', {
|
.state('tags', {
|
||||||
url: '/tags',
|
url: '/tags',
|
||||||
templateUrl: '/views/tags.html',
|
templateUrl: '/views/tags.html',
|
||||||
|
params: {
|
||||||
|
tagId: null,
|
||||||
|
},
|
||||||
controller: 'tagsCtr'
|
controller: 'tagsCtr'
|
||||||
})
|
})
|
||||||
.state('advice', {
|
.state('advice', {
|
||||||
|
|
@ -39,8 +42,6 @@ app.config(function($stateProvider, $urlRouterProvider, $httpProvider) {
|
||||||
url: '/login',
|
url: '/login',
|
||||||
templateUrl: '/views/login.html',
|
templateUrl: '/views/login.html',
|
||||||
params: {
|
params: {
|
||||||
foo: null,
|
|
||||||
bar: null,
|
|
||||||
showStyle: 'table',
|
showStyle: 'table',
|
||||||
},
|
},
|
||||||
controller: 'loginCtr'
|
controller: 'loginCtr'
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,12 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
|
||||||
toastr.warning('功能暂未实现。。。', "警告");
|
toastr.warning('功能暂未实现。。。', "警告");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.jumpToTags = function(tagId) {
|
||||||
|
$state.go('tags', {
|
||||||
|
tagId: tagId,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pubSubService.subscribe('EditCtr.inserBookmarsSuccess', $scope, function(event, params) {
|
pubSubService.subscribe('EditCtr.inserBookmarsSuccess', $scope, function(event, params) {
|
||||||
params.showStyle = $scope.showStyle;
|
params.showStyle = $scope.showStyle;
|
||||||
console.log('subscribe EditCtr.inserBookmarsSuccess', params);
|
console.log('subscribe EditCtr.inserBookmarsSuccess', params);
|
||||||
|
|
@ -92,8 +98,8 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
|
||||||
var width = $('.js-segment-navigate').width();
|
var width = $('.js-segment-navigate').width();
|
||||||
// console.log('js-edit position update', top+10, left+width-10)
|
// console.log('js-edit position update', top+10, left+width-10)
|
||||||
$('.js-edit').offset({
|
$('.js-edit').offset({
|
||||||
top: top+10,
|
top: top + 10,
|
||||||
left: left+width-10,
|
left: left + width - 10,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
app.controller('tagsCtr', ['$scope', '$filter', '$window', 'bookmarkService', 'pubSubService', function($scope, $filter, $window, bookmarkService, pubSubService) {
|
app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', 'bookmarkService', 'pubSubService', function($scope, $filter, $window, $stateParams, bookmarkService, pubSubService) {
|
||||||
console.log("Hello tagsCtr...");
|
console.log("Hello tagsCtr...", $stateParams);
|
||||||
getTags({});
|
getTags({});
|
||||||
|
|
||||||
const perPageItems = 20;
|
const perPageItems = 20;
|
||||||
|
$scope.loadBookmarks = false;
|
||||||
$scope.tags = []; // 书签数据
|
$scope.tags = []; // 书签数据
|
||||||
$scope.bookmarkClicked = false;
|
$scope.bookmarkClicked = false;
|
||||||
$scope.bookmarks = [];
|
$scope.bookmarks = [];
|
||||||
|
|
@ -10,7 +11,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', 'bookmarkService', 'p
|
||||||
$scope.totalPages = 0;
|
$scope.totalPages = 0;
|
||||||
$scope.currentPage = 1;
|
$scope.currentPage = 1;
|
||||||
$scope.inputPage = '';
|
$scope.inputPage = '';
|
||||||
$scope.currentTagId = "";
|
$scope.currentTagId = ($stateParams && $stateParams.tagId) || '';
|
||||||
|
|
||||||
pubSubService.subscribe('MenuCtr.tags', $scope, function(event, data) {
|
pubSubService.subscribe('MenuCtr.tags', $scope, function(event, data) {
|
||||||
console.log('subscribe MenuCtr.tags', data);
|
console.log('subscribe MenuCtr.tags', data);
|
||||||
|
|
@ -20,6 +21,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', 'bookmarkService', 'p
|
||||||
$scope.getBookmarks = function(tagId, currentPage) {
|
$scope.getBookmarks = function(tagId, currentPage) {
|
||||||
$scope.bookmarkClicked = true;
|
$scope.bookmarkClicked = true;
|
||||||
$scope.currentTagId = tagId;
|
$scope.currentTagId = tagId;
|
||||||
|
$scope.loadBookmarks = true;
|
||||||
|
|
||||||
$scope.tags.forEach(function(tag) {
|
$scope.tags.forEach(function(tag) {
|
||||||
tag.bookmarkClicked = false;
|
tag.bookmarkClicked = false;
|
||||||
|
|
@ -33,15 +35,20 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', 'bookmarkService', 'p
|
||||||
currentPage: currentPage,
|
currentPage: currentPage,
|
||||||
perPageItems: perPageItems,
|
perPageItems: perPageItems,
|
||||||
};
|
};
|
||||||
|
|
||||||
bookmarkService.getBookmarksByTag(params)
|
bookmarkService.getBookmarksByTag(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);
|
||||||
|
|
||||||
$scope.inputPage = ''
|
$scope.inputPage = '';
|
||||||
|
$scope.loadBookmarks = false;
|
||||||
})
|
})
|
||||||
.catch((err) => console.log('getTags err', err));
|
.catch((err) => {
|
||||||
|
console.log('getTags err', err);
|
||||||
|
$scope.loadBookmarks = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.changeCurrentPage = function(currentPage) {
|
$scope.changeCurrentPage = function(currentPage) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="ui container" ng-repeat="tag in bookmarks" ng-init="tagIndex=$index">
|
<div class="ui container" ng-repeat="tag in bookmarks" ng-init="tagIndex=$index">
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="wrap" style="width:88px;color:#0aa770;text-align:left;margin-left:20px;">
|
<div class="wrap" style="width:88px;color:#0aa770;text-align:left;margin-left:20px;" ng-click="jumpToTags(tag.id)">
|
||||||
<span title="{{ tag.name }}">{{ tag.name }}</span>
|
<span title="{{ tag.name }}">{{ tag.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="fourteen wide column" ng-if="tag.bookmarks.length">
|
<div class="fourteen wide column" ng-if="tag.bookmarks.length">
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<img class="ui ui middle aligned tiny image" ng-src=" http://favicon.byi.pw/?url={{ bookmark.url }}" style="width:16px;height:16px" ng-if="!edit">
|
<img class="ui ui middle aligned tiny image" ng-src=" http://favicon.byi.pw/?url={{ bookmark.url }}" style="width:16px;height:16px" ng-if="!edit">
|
||||||
<span>{{ bookmark.title}}</span>
|
<span>{{ bookmark.title}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="two wide column js-more-bookmark" ng-class="" ng-mouseover="" ng-mouseleave="" title="查看更多" ng-if="tag.bookmarks.length >= 4">
|
<div class="two wide column js-more-bookmark" ng-class="" ng-mouseover="" ng-mouseleave="" title="查看更多" ng-if="tag.bookmarks.length >= 4" ng-click="jumpToTags(tag.id)">
|
||||||
<img class="ui ui middle aligned tiny image" ng-src="./images/more.png" style="width:16px;height:16px">
|
<img class="ui ui middle aligned tiny image" ng-src="./images/more.png" style="width:16px;height:16px">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
<td>{{ bookmark.created_at }}</td>
|
<td>{{ bookmark.created_at }}</td>
|
||||||
<td>{{ bookmark.last_click }}</td>
|
<td>{{ bookmark.last_click }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui label" ng-repeat="tag in bookmark.tags" tag-id="{{ tag.id }}">
|
<div class="ui label" ng-repeat="tag in bookmark.tags" tag-id="{{ tag.id }}" ng-click="jumpToTags(tag.id)">
|
||||||
{{ tag.name }}
|
{{ tag.name }}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,17 @@
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
<div class="two wide column" ng-class="" ng-mouseover="" ng-mouseleave="" ng-repeat="tag in tags">
|
<div class="two wide column" ng-class="" ng-mouseover="" ng-mouseleave="" ng-repeat="tag in tags">
|
||||||
<div class="ui small label" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, 1)">
|
<div class="ui small label" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, 1)">
|
||||||
{{ tag.name }} ({{ tag.cnt }})
|
{{ tag.name }}
|
||||||
|
({{ tag.cnt }})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="ui celled table" ng-if="bookmarkCount > 0">
|
<table class="ui celled table" ng-if="bookmarkCount > 0">
|
||||||
|
<div class="ui inverted dimmer" ng-class="{active:loadBookmarks, disabled: !loadBookmarks}">
|
||||||
|
<div class="ui huge text loader">正在加载中...</div>
|
||||||
|
</div>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>标题</th>
|
<th>标题</th>
|
||||||
|
|
@ -37,7 +40,7 @@
|
||||||
<td>{{ bookmark.created_at }}</td>
|
<td>{{ bookmark.created_at }}</td>
|
||||||
<td>{{ bookmark.last_click }}</td>
|
<td>{{ bookmark.last_click }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui label" ng-repeat="tag in bookmark.tags" tag-id="{{ tag.id }}">
|
<div class="ui label" ng-repeat="tag in bookmark.tags" tag-id="{{ tag.id }}" ng-click="getBookmarks(tag.id, 1)">
|
||||||
{{ tag.name }}
|
{{ tag.name }}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue