diff --git a/src/controller/api.js b/src/controller/api.js index 7f14143..5c8ebff 100644 --- a/src/controller/api.js +++ b/src/controller/api.js @@ -568,14 +568,17 @@ module.exports = class extends Base { } async notesAction() { + let params = this.get(); let where = {}; try { - let keyword = this.get('keyword'); - if (keyword) { - where.content = ['like', `%${keyword}%`] + if (params.keyword) { + where.content = ['like', `%${params.keyword}%`] + } + if (params.tagId) { + where.tagId = params.tagId; } let data = await this.model('notes').where(where).order("createdAt DESC").page(this.get('page'), this.get('pageSize')).countSelect(); - this.json({ code: 0, data }); + this.json({ code: 0, data }) } catch (error) { this.json({ code: 1, msg: error.toString() }); } diff --git a/view/index_index.html b/view/index_index.html index 51a79cb..7ef9a3e 100644 --- a/view/index_index.html +++ b/view/index_index.html @@ -3,7 +3,7 @@
-{{ note.brief }}
{{ note.content }}