|
|
@ -5,7 +5,6 @@ |
|
|
|
<el-popover |
|
|
|
<el-popover |
|
|
|
v-model="visible" |
|
|
|
v-model="visible" |
|
|
|
trigger="click" |
|
|
|
trigger="click" |
|
|
|
@hide="resetNote" |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
<el-form ref="form" :model="note_form" :rules="rules" label-width="80px"> |
|
|
|
<el-form ref="form" :model="note_form" :rules="rules" label-width="80px"> |
|
|
|
<el-form-item :label="$t('note.table.original_text')"> |
|
|
|
<el-form-item :label="$t('note.table.original_text')"> |
|
|
@ -375,9 +374,28 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
//删除笔记 |
|
|
|
//删除笔记 |
|
|
|
del(item: any, index: number) { |
|
|
|
del(item: any, index: number) { |
|
|
|
this.$set(item, 'type', 'success') |
|
|
|
let that=this |
|
|
|
this.$set(item, 'message', '删除成功') |
|
|
|
let span=document.getElementById(item.id) |
|
|
|
this.noteList.splice(index, 1) |
|
|
|
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() { |
|
|
|
submitRating() { |
|
|
@ -458,22 +476,36 @@ |
|
|
|
for (let index = 1; index < that.replace.replaceVal.length; index++) { |
|
|
|
for (let index = 1; index < that.replace.replaceVal.length; index++) { |
|
|
|
that.replace.replaceVal[index - 1].after(that.replace.replaceVal[index]) |
|
|
|
that.replace.replaceVal[index - 1].after(that.replace.replaceVal[index]) |
|
|
|
} |
|
|
|
} |
|
|
|
that.noteList.unshift({ |
|
|
|
|
|
|
|
id: this.note_form.note_id, |
|
|
|
that.GLOBAL.fetchJSON('/v1/api/notes/add','POST',{ |
|
|
|
title: this.note_form.note_title, |
|
|
|
noteId: this.note_form.note_id, |
|
|
|
content: this.note_form.note_content |
|
|
|
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({ |
|
|
|
that.$message.info({ |
|
|
|
message: this.$t('read.tip.add_tip_ok').toString(), |
|
|
|
message: that.$t('read.tip.add_tip_ok').toString(), |
|
|
|
showClose: true, |
|
|
|
showClose: true, |
|
|
|
duration: 1000 |
|
|
|
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{ |
|
|
|
}else{ |
|
|
|
that.$message.error({ |
|
|
|
that.$message.error(that.$t('error_500').toString()) |
|
|
|
message: this.$t('read.tip.add_tip_fail').toString(), |
|
|
|
} |
|
|
|
showClose: true, |
|
|
|
|
|
|
|
duration: 1000 |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
that.$message.error(that.$t('read.tip.add_tip_fail').toString()) |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
this.visible = false |
|
|
|
this.visible = false |
|
|
@ -520,6 +552,24 @@ |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.error('无法获取选中文本') |
|
|
|
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() { |
|
|
|
mounted() { |
|
|
@ -527,7 +577,9 @@ |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
if(this.activeContent) { |
|
|
|
if(this.activeContent) { |
|
|
|
that.queryRating() |
|
|
|
that.queryRating() |
|
|
|
|
|
|
|
that.findNote() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.activeName = this.$store.state.read.activeName |
|
|
|
this.activeName = this.$store.state.read.activeName |
|
|
|