diff --git a/public/scripts/controllers/note-controller.js b/public/scripts/controllers/note-controller.js index a39a194..f07f8bf 100644 --- a/public/scripts/controllers/note-controller.js +++ b/public/scripts/controllers/note-controller.js @@ -100,6 +100,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind $scope.tags.forEach((tag) => { if ($scope.currentTagId === tag.id) { tagName = tag.name; + tag.ncnt += 1; } if (!$scope.currentTagId) { if (tag.name == '未分类') { diff --git a/public/views/note.html b/public/views/note.html index fe96664..8c19c93 100644 --- a/public/views/note.html +++ b/public/views/note.html @@ -1,7 +1,7 @@
{{ tag.name }} ({{ tag.ncnt || 0 }})
+ ng-click="clickTag(tag.id)" ng-show="tag.ncnt || add">{{ tag.name }} ({{ tag.ncnt || 0 }})
diff --git a/schema.sql b/schema.sql index 73b0d56..f7ae183 100644 --- a/schema.sql +++ b/schema.sql @@ -93,6 +93,6 @@ CREATE TABLE `notes` ( `content` text DEFAULT NULL, -- 备忘内容 `tag_id` int(11) DEFAULT NULL, -- 分类id `created_at` datetime DEFAULT now(), -- 创建时间 - `public` tinyint(4) DEFAULT '1', -- 是否公开 1 公开,0 不公开 + `public` tinyint(4) DEFAULT '0', -- 是否公开 1 公开,0 不公开 PRIMARY KEY (`id`) );