添加分类定制的快捷键

This commit is contained in:
luchenqun 2017-11-30 17:20:44 +08:00
parent 715b67fdfe
commit ec1da85efd
4 changed files with 41 additions and 28 deletions

View File

@ -46,6 +46,7 @@ app.config(function($stateProvider, $urlRouterProvider, $httpProvider) {
templateUrl: '/views/tags.html', templateUrl: '/views/tags.html',
params: { params: {
tagId: null, tagId: null,
orderIndex: null,
}, },
controller: 'tagsCtr' controller: 'tagsCtr'
}) })

View File

@ -225,14 +225,22 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
if (key == 'A') { if (key == 'A') {
if ($scope.selectLoginIndex !== dataService.LoginIndexNote) { if ($scope.selectLoginIndex !== dataService.LoginIndexNote) {
updateMenuActive($scope.selectLoginIndex = dataService.LoginIndexNote); updateMenuActive($scope.selectLoginIndex = dataService.LoginIndexNote);
$state.go('note', { $state.go('note', { key: key }, { reload: true })
key: key,
}, {
reload: true,
})
} }
} }
if (key == ',' || key == '.' || key == '/') {
pubSubService.publish('Common.menuActive', {
login: $scope.login,
index: dataService.LoginIndexTags
});
var stateParams = {
tagId: -1,
orderIndex: (key == ',' ? 0 : (key == '.' ? 1 : 2)),
}
$state.go(dataService.loginMenus[dataService.LoginIndexTags].uiSref, stateParams, { reload: true, })
}
// 数字键用来切换菜单 // 数字键用来切换菜单
if (!isNaN(key)) { if (!isNaN(key)) {
var num = parseInt(key); var num = parseInt(key);

View File

@ -78,6 +78,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
} }
$scope.getBookmarks = function(tagId, currentPage) { $scope.getBookmarks = function(tagId, currentPage) {
console.log(tagId, currentPage)
$scope.bookmarkClicked = true; $scope.bookmarkClicked = true;
$scope.currentTagId = tagId; $scope.currentTagId = tagId;
$scope.currentPage = currentPage; $scope.currentPage = currentPage;
@ -473,7 +474,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
find = true; // 如果是删了分类返回来,那么要重新默认选中第一个分类 find = true; // 如果是删了分类返回来,那么要重新默认选中第一个分类
} }
}) })
if (!find) $scope.currentTagId = null; if (!find && $scope.currentTagId !== -1) $scope.currentTagId = null;
if (!$scope.currentTagId && $scope.tags.length > 0) { if (!$scope.currentTagId && $scope.tags.length > 0) {
$scope.currentTagId = $scope.tags[0].id; $scope.currentTagId = $scope.tags[0].id;
$scope.tags[0].bookmarkClicked = true; $scope.tags[0].bookmarkClicked = true;

View File

@ -91,6 +91,9 @@ app.factory('dataService', [function() {
'R': '在热门收藏界面,已用作随机查看热门收藏', 'R': '在热门收藏界面,已用作随机查看热门收藏',
'INSERT': '全局页面,已用做添加书签', 'INSERT': '全局页面,已用做添加书签',
'ESC': '全局页面,已用做退出弹窗', 'ESC': '全局页面,已用做退出弹窗',
',': '跳转到分类定制点击次数',
'.': '跳转到分类定制添加日期',
'/': '跳转到分类定制最后点击',
}, },
keyShortcuts: function() { // 判断快捷方式是否生效 keyShortcuts: function() { // 判断快捷方式是否生效
var ret = true; var ret = true;