From 85b0ebf6fe0178be668ce1bf6a8adb6766f86afe Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Fri, 31 Jul 2020 23:14:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=94=E8=AE=B0=E5=88=97=E8=A1=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nuxt.config.js | 2 ++ pages/index/note.vue | 73 ++++++++++++++++++++++++++++++++------------ pages/index/read.vue | 38 +++++++++++++++++++---- 3 files changed, 87 insertions(+), 26 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index bd599a5..ab627a4 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -112,6 +112,7 @@ export default { "catalog": "目录", "del": "删除", "edit": "编辑", + "jump_note": "定位笔记", "ok": "确定", "query": "查询", "rating": "提交评分", @@ -276,6 +277,7 @@ export default { "catalog": "", "del": "", "edit": "", + "jump_note": "", "ok": "", "query": "", "rating": "", diff --git a/pages/index/note.vue b/pages/index/note.vue index be6d65c..6ef95fe 100644 --- a/pages/index/note.vue +++ b/pages/index/note.vue @@ -10,20 +10,23 @@ - {{$t('button.query')}} + {{$t('button.query')}} - - - - + + + + + + @@ -31,7 +34,7 @@
+ :total="total">
@@ -44,14 +47,9 @@ name: 'note', data(){ return { - tableData:[{ - note_name:'笔记', - original_text:'注释原文', - note_content:'笔记内容', - paper_name: '《论文》' - }], + tableData:[], form:{ - note_name:'', + note_title:'', note_content:'' }, rules:{ @@ -65,16 +63,51 @@ message: this.$t('input_please', { keyword: this.$t('read.form.note_content') }), trigger: 'blur' }] - } + }, + total:1 } }, methods:{ - del(){ - this.$confirm(this.$t('note.tip.confirm_del').toString(),this.$t('tip').toString(),{ - confirmButtonText:this.$t('button.ok').toString(), - cancelButtonText:this.$t('button.cancel').toString() + //查找笔记 + findNote(){ + let that=this + this.GLOBAL.fetchGet("/v1/api/notes/list",{ + noteTitle:that.form.note_title, + noteContent:that.form.note_content + },function(res) { + if(res.code==='200'){ + that.tableData=[] + that.tableData=res.data.data + that.total=res.data.total + }else{ + that.$message.error(that.$t('error_500').toString()) + } + }) + }, + //打开笔记 + read(row){ + let that=this + let item=row.paper + this.GLOBAL.fetchGet("/v1/api/file/find",{ + paperId:item.id, + },function(res) { + if(res.code==='200'){ + item.content=res.msg + that.$store.commit('menus/read') + that.$store.commit('read/open', item) + // that.$router.push({that.localePath('/read')}) + that.$router.push({ + path:that.localePath('/read'), + query:row + }) + }else{ + that.$message.error(that.$t('error_500').toString()) + } }) } + }, + mounted() { + this.findNote() } }) diff --git a/pages/index/read.vue b/pages/index/read.vue index 84ab291..0aeba73 100644 --- a/pages/index/read.vue +++ b/pages/index/read.vue @@ -59,10 +59,10 @@ @contextmenu="selectText" @scroll="scrollContent" v-html="item.content" /> - +