|
|
|
@ -5,7 +5,6 @@ |
|
|
|
|
<el-popover |
|
|
|
|
v-model="visible" |
|
|
|
|
trigger="click" |
|
|
|
|
@hide="resetNote" |
|
|
|
|
> |
|
|
|
|
<el-form ref="form" :model="note_form" :rules="rules" label-width="80px"> |
|
|
|
|
<el-form-item :label="$t('note.table.original_text')"> |
|
|
|
@ -375,9 +374,28 @@ |
|
|
|
|
}, |
|
|
|
|
//删除笔记 |
|
|
|
|
del(item: any, index: number) { |
|
|
|
|
this.$set(item, 'type', 'success') |
|
|
|
|
this.$set(item, 'message', '删除成功') |
|
|
|
|
this.noteList.splice(index, 1) |
|
|
|
|
let that=this |
|
|
|
|
let span=document.getElementById(item.id) |
|
|
|
|
if(span) { |
|
|
|
|
let text = document.createTextNode(span.innerText) |
|
|
|
|
span.replaceWith(text) |
|
|
|
|
that.pre.normalize() |
|
|
|
|
this.GLOBAL.fetchJSON('/v1/api/notes/remove', 'DELETE', { |
|
|
|
|
noteId: item.id, |
|
|
|
|
paperId: that.activeContent.id, |
|
|
|
|
content: that.pre.innerHTML |
|
|
|
|
}, function(res) { |
|
|
|
|
if (res.code === '200') { |
|
|
|
|
that.noteList.splice(index, 1) |
|
|
|
|
that.$store.commit('read/updateContent',that.pre.innerHTML) |
|
|
|
|
} else { |
|
|
|
|
that.$message.error(that.$t('error_500').toString()) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
that.$message.error(that.$t('error_500').toString()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//提交评分 |
|
|
|
|
submitRating() { |
|
|
|
@ -458,22 +476,36 @@ |
|
|
|
|
for (let index = 1; index < that.replace.replaceVal.length; index++) { |
|
|
|
|
that.replace.replaceVal[index - 1].after(that.replace.replaceVal[index]) |
|
|
|
|
} |
|
|
|
|
that.noteList.unshift({ |
|
|
|
|
id: this.note_form.note_id, |
|
|
|
|
title: this.note_form.note_title, |
|
|
|
|
content: this.note_form.note_content |
|
|
|
|
}) |
|
|
|
|
that.$message.info({ |
|
|
|
|
message: this.$t('read.tip.add_tip_ok').toString(), |
|
|
|
|
showClose: true, |
|
|
|
|
duration: 1000 |
|
|
|
|
|
|
|
|
|
that.GLOBAL.fetchJSON('/v1/api/notes/add','POST',{ |
|
|
|
|
noteId: this.note_form.note_id, |
|
|
|
|
noteTitle: this.note_form.note_title, |
|
|
|
|
noteContent: this.note_form.note_content, |
|
|
|
|
paperId: that.activeContent.id, |
|
|
|
|
fileId: that.activeContent.fileId, |
|
|
|
|
content: that.pre.innerHTML |
|
|
|
|
},function(res) { |
|
|
|
|
if(res.code==='200'){ |
|
|
|
|
that.$message.info({ |
|
|
|
|
message: that.$t('read.tip.add_tip_ok').toString(), |
|
|
|
|
showClose: true, |
|
|
|
|
duration: 1000, |
|
|
|
|
onClose:function() { |
|
|
|
|
that.$store.commit('read/updateContent',that.pre.innerHTML) |
|
|
|
|
that.noteList.unshift({ |
|
|
|
|
id: that.note_form.note_id, |
|
|
|
|
title: that.note_form.note_title, |
|
|
|
|
content: that.note_form.note_content |
|
|
|
|
}) |
|
|
|
|
that.resetNote() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
that.$message.error(that.$t('error_500').toString()) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
that.$message.error({ |
|
|
|
|
message: this.$t('read.tip.add_tip_fail').toString(), |
|
|
|
|
showClose: true, |
|
|
|
|
duration: 1000 |
|
|
|
|
}) |
|
|
|
|
that.$message.error(that.$t('read.tip.add_tip_fail').toString()) |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
this.visible = false |
|
|
|
@ -520,6 +552,24 @@ |
|
|
|
|
} else { |
|
|
|
|
console.error('无法获取选中文本') |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//查找笔记 |
|
|
|
|
findNote(){ |
|
|
|
|
let that=this |
|
|
|
|
this.GLOBAL.fetchGet(`/v1/api/notes/list/${this.activeContent.id}`,{},function(res) { |
|
|
|
|
if(res.code==='200'){ |
|
|
|
|
that.noteList=[] |
|
|
|
|
res.data.data.forEach(item=>{ |
|
|
|
|
that.noteList.push({ |
|
|
|
|
id: item.noteId, |
|
|
|
|
title: item.noteTitle, |
|
|
|
|
content: item.noteContent |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
that.$message.error(that.$t('error_500').toString()) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
@ -527,7 +577,9 @@ |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
if(this.activeContent) { |
|
|
|
|
that.queryRating() |
|
|
|
|
that.findNote() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.activeName = this.$store.state.read.activeName |
|
|
|
|