更新一些小bug

This commit is contained in:
luchenqun 2017-02-28 21:40:11 +08:00
parent 9b9e660bf2
commit ac92a6cbd6
4 changed files with 39 additions and 10 deletions

View File

@ -134,13 +134,17 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
}
pubSubService.subscribe('EditCtr.inserBookmarsSuccess', $scope, function(event, data) {
params.showStyle = $scope.showStyle;
console.log('subscribe EditCtr.inserBookmarsSuccess', params);
getBookmarks(params);
var menusScope = $('div[ng-controller="menuCtr"]').scope();
if (menusScope.login && menusScope.selectLoginIndex == 0) {
params.showStyle = $scope.showStyle;
if ($scope.showStyle == 'card') {
$scope.currentPage = 1;
$scope.bookmarks = [];
}
getBookmarks(params);
}
});
function getBookmarks(params) {

View File

@ -49,6 +49,9 @@ app.controller('editCtr', ['$scope', '$state', '$timeout', 'bookmarkService', 'p
bookmarkService.addTags(params)
.then((data) => {
$scope.tags = data;
pubSubService.publish('EditCtr.addTagsSuccess', data);
$scope.newTags = '';
toastr.success('[ ' + params.toString() + ' ]分类添加成功!', "提示");
$timeout(() => {
// 将新增加的分类自动添加到下啦列表中
var count = 0;
@ -169,6 +172,10 @@ app.controller('editCtr', ['$scope', '$state', '$timeout', 'bookmarkService', 'p
function getTags(params) {
bookmarkService.getTags(params)
.then((data) => {
data.sort((a, b) => {
if (a.last_use > b.last_use) return -1;
return 1;
})
$scope.tags = data;
initJsTags();
$('.ui.modal.js-add-bookmark .ui.dropdown').removeClass('loading');

View File

@ -188,10 +188,10 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
bookmarkService.delTag(params)
.then((data) => {
if (data.retCode == 0) {
toastr.success('分类删除成功!将自动更新分类信息', "提示");
toastr.success('[ ' + tagName + ' ]分类删除成功!将自动更新分类信息', "提示");
getTags({});
} else {
toastr.error('分类删除失败!', "提示");
toastr.error('[ ' + tagName + ' ]分类删除失败!', "提示");
getTags({});
}
})
@ -225,11 +225,11 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
tags.push(tag);
bookmarkService.addTags(tags)
.then((data) => {
toastr.success('插入分类成功!将自动更新分类信息', "提示");
toastr.success('[ ' + tag + ' ]插入分类成功!将自动更新分类信息', "提示");
getTags({});
})
.catch((err) => {
toastr.warning('插入分类失败:' + JSON.stringify(err), "提示");
toastr.warning('[ ' + tag + ' ]插入分类失败:' + JSON.stringify(err), "提示");
});
} else {
toastr.warning('您可能没有输入分类或者输入的分类有误', "提示");
@ -324,6 +324,24 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
});
}
pubSubService.subscribe('EditCtr.inserBookmarsSuccess', $scope, function(event, data) {
console.log('subscribe EditCtr.inserBookmarsSuccess', data);
var menusScope = $('div[ng-controller="menuCtr"]').scope();
if (menusScope.login && menusScope.selectLoginIndex == 1) {
getTags({});
}
});
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({});
}
});
// TODO: 我要将编辑按钮固定在容器的右上角
$(window).resize(updateEditPos);
updateEditPos();

View File

@ -36,7 +36,7 @@
</div>
<div class="results"></div>
</div>
<div class="item" title="添加书签" ng-click="showAddBookmarkMoadl()" ui-sref="bookmarks">
<div class="item" title="添加书签" ng-click="showAddBookmarkMoadl()">
<i class="add square icon"></i>
</div>
<div class="item">