From 7637d7662d11e652d282ef786dfd88adda110de9 Mon Sep 17 00:00:00 2001 From: luchenqun Date: Wed, 26 Jul 2017 22:16:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB=E5=A4=87?= =?UTF-8?q?=E5=BF=98=E5=BD=95=E9=87=8C=E9=9D=A2=E7=9A=84=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=9C=AA=E5=93=8D=E5=BA=94=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/scripts/controllers/note-controller.js | 45 +++++++++---------- public/views/note.html | 4 +- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/public/scripts/controllers/note-controller.js b/public/scripts/controllers/note-controller.js index 5513c40..65c79e2 100644 --- a/public/scripts/controllers/note-controller.js +++ b/public/scripts/controllers/note-controller.js @@ -181,12 +181,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind $scope.content = content; $scope.currentNoteId = id; $scope.currentTagId = tagId; - $scope.tags.forEach((tag) => { - tag.clicked = false; - if (tag.id == tagId) { - tag.clicked = true; - } - }) + updateSelectTag(tagId); } $scope.updateNote = function() { @@ -257,6 +252,27 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind $scope.hoverNote = note; } + $scope.clickTag = function(id) { + $scope.currentTagId = id; + updateSelectTag(id); + + if ($scope.add || $scope.edit) { + + } else { + getNotes($scope.currentTagId); + } + } + + function updateSelectTag(tagId) { + $scope.tags.forEach((tag) => { + tag.clicked = false; + if (tag.id == tagId) { + tag.clicked = true; + t = tag; + } + }) + } + // 在输入文字的时候也会触发,所以不要用Ctrl,Shift之类的按键 $document.bind("keydown", function(event) { $scope.$apply(function() { @@ -337,23 +353,6 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind }); } - $scope.clickTag = function(id, clicked) { - $scope.currentTagId = id; - // 只允许选择一个 - $scope.tags.forEach((tag) => { - tag.clicked = false; - if (tag.id == id) { - tag.clicked = true; - } - }) - - if ($scope.add || $scope.edit) { - - } else { - getNotes($scope.currentTagId); - } - } - $('.js-note-card').transition('hide'); function transition() { diff --git a/public/views/note.html b/public/views/note.html index 86765a1..6771abe 100644 --- a/public/views/note.html +++ b/public/views/note.html @@ -1,5 +1,5 @@
-
{{ tag.name }}
+
{{ tag.name }}
@@ -37,7 +37,7 @@ -
{{ note.tagName }}
+
{{ note.tagName }}