笔记导出

master
pan 4 years ago
parent 4fec3aabac
commit eccfb2e321
  1. 12
      nuxt.config.js
  2. 16
      pages/index/note.vue
  3. 41
      pages/index/read.vue

@ -188,6 +188,8 @@ export default {
"new_recommend": "最新推荐", "new_recommend": "最新推荐",
"note": { "note": {
"table": { "table": {
"note_content": "笔记内容",
"note_title": "笔记标题",
"original_text": "注释原文", "original_text": "注释原文",
"paper_name": "论文标题" "paper_name": "论文标题"
}, },
@ -201,9 +203,7 @@ export default {
"search": "查找" "search": "查找"
}, },
"form": { "form": {
"keyword": "关键字", "keyword": "关键字"
"note_content": "笔记内容",
"note_title": "笔记标题"
}, },
"tip": { "tip": {
"add_tip": "是否添加该笔记?", "add_tip": "是否添加该笔记?",
@ -362,6 +362,8 @@ export default {
"new_recommend": "", "new_recommend": "",
"note": { "note": {
"table": { "table": {
"note_content": "",
"note_title": "",
"original_text": "", "original_text": "",
"paper_name": "" "paper_name": ""
}, },
@ -375,9 +377,7 @@ export default {
"search": "" "search": ""
}, },
"form": { "form": {
"keyword": "", "keyword": ""
"note_content": "",
"note_title": ""
}, },
"tip": { "tip": {
"add_tip": "", "add_tip": "",

@ -3,11 +3,11 @@
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="5"> <el-col :span="5">
<el-form ref="form" :model="form" label-width="80px"> <el-form ref="form" :model="form" label-width="80px">
<el-form-item :label="$t('read.form.note_title')" prop="note_title"> <el-form-item :label="$t('note.table.note_title')" prop="note_title">
<el-input v-model="form.note_title" :placeholder="$t('input_please', { keyword: this.$t('read.form.note_title') })"></el-input> <el-input v-model="form.note_title" :placeholder="$t('input_please', { keyword: this.$t('note.table.note_title') })"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('read.form.note_content')" prop="note_content"> <el-form-item :label="$t('note.table.note_content')" prop="note_content">
<el-input type="textarea" v-model="form.note_content" :placeholder="$t('input_please', { keyword: this.$t('read.form.note_content') })"></el-input> <el-input type="textarea" v-model="form.note_content" :placeholder="$t('input_please', { keyword: this.$t('note.table.note_content') })"></el-input>
</el-form-item> </el-form-item>
<el-form-item class="center"> <el-form-item class="center">
<el-button @click="findNote">{{$t('button.query')}}</el-button> <el-button @click="findNote">{{$t('button.query')}}</el-button>
@ -22,8 +22,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="originalText" :label="$t('note.table.original_text')" /> <el-table-column align="center" prop="originalText" :label="$t('note.table.original_text')" />
<el-table-column align="center" prop="noteTitle" :label="$t('read.form.note_title')" /> <el-table-column align="center" prop="noteTitle" :label="$t('note.table.note_title')" />
<el-table-column align="center" prop="noteContent" :label="$t('read.form.note_content')" /> <el-table-column align="center" prop="noteContent" :label="$t('note.table.note_content')" />
<el-table-column align="center" :label="$t('action')" > <el-table-column align="center" :label="$t('action')" >
<template slot-scope="scope" > <template slot-scope="scope" >
<el-button @click="read(scope.row)">{{$t('button.jump_note')}}</el-button> <el-button @click="read(scope.row)">{{$t('button.jump_note')}}</el-button>
@ -55,12 +55,12 @@
rules:{ rules:{
note_title:[{ note_title:[{
required: true, required: true,
message: this.$t('input_please', { keyword: this.$t('read.form.note_title') }), message: this.$t('input_please', { keyword: this.$t('note.table.note_title') }),
trigger: 'blur' trigger: 'blur'
}], }],
note_content:[{ note_content:[{
required: true, required: true,
message: this.$t('input_please', { keyword: this.$t('read.form.note_content') }), message: this.$t('input_please', { keyword: this.$t('note.table.note_content') }),
trigger: 'blur' trigger: 'blur'
}] }]
}, },

@ -10,13 +10,13 @@
<el-form-item :label="$t('note.table.original_text')"> <el-form-item :label="$t('note.table.original_text')">
<el-input autosize type="textarea" v-model="note_form.original_text" disabled></el-input> <el-input autosize type="textarea" v-model="note_form.original_text" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('read.form.note_title')" prop="note_title"> <el-form-item :label="$t('note.table.note_title')" prop="note_title">
<el-input v-model="note_form.note_title" <el-input v-model="note_form.note_title"
:placeholder="$t('input_please', { keyword: this.$t('read.form.note_title') })"></el-input> :placeholder="$t('input_please', { keyword: this.$t('note.table.note_title') })"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('read.form.note_content')" prop="note_content"> <el-form-item :label="$t('note.table.note_content')" prop="note_content">
<el-input autosize type="textarea" v-model="note_form.note_content" <el-input autosize type="textarea" v-model="note_form.note_content"
:placeholder="$t('input_please', { keyword: this.$t('read.form.note_content') })"></el-input> :placeholder="$t('input_please', { keyword: this.$t('note.table.note_content') })"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="addNote">{{$t('button.add')}}</el-button> <el-button @click="addNote">{{$t('button.add')}}</el-button>
@ -80,6 +80,8 @@
> >
<el-button size="mini" type="danger" slot="reference" icon="el-icon-delete"></el-button> <el-button size="mini" type="danger" slot="reference" icon="el-icon-delete"></el-button>
</el-popconfirm> </el-popconfirm>
<el-button size="mini" type="success" @click="download(item)"
icon="el-icon-download"></el-button>
</el-button-group> </el-button-group>
</el-row> </el-row>
</div> </div>
@ -165,12 +167,12 @@
rules: { rules: {
note_title: [{ note_title: [{
required: true, required: true,
message: this.$t('input_please', { keyword: this.$t('read.form.note_title') }), message: this.$t('input_please', { keyword: this.$t('note.table.note_title') }),
trigger: 'blur' trigger: 'blur'
}], }],
note_content: [{ note_content: [{
required: true, required: true,
message: this.$t('input_please', { keyword: this.$t('read.form.note_content') }), message: this.$t('input_please', { keyword: this.$t('note.table.note_content') }),
trigger: 'blur' trigger: 'blur'
}] }]
}, },
@ -232,6 +234,28 @@
}, },
methods: { methods: {
//
download(item) {
console.info(item)
let ele = document.createElement('a')
//
ele.download = `${this.$t('note.table.note_title')}.txt`
//
ele.style.display = 'none'
//blob
let blob = new Blob([`${this.$t('note.table.note_title')}${item.title}
${this.$t('note.table.paper_name')}${this.activeContent.title}
${this.$t('note.table.original_text')}${item.originalText}
${this.$t('note.table.note_content')}${item.content}`])
//
ele.href = URL.createObjectURL(blob)
document.body.appendChild(ele)
//
ele.click()
//
document.body.removeChild(ele)
},
// //
star(e, item) { star(e, item) {
e.stopPropagation() e.stopPropagation()
@ -434,7 +458,7 @@
paperId: this.activeContent.id, paperId: this.activeContent.id,
score1: this.stars[0].value, score1: this.stars[0].value,
score2: this.stars[1].value, score2: this.stars[1].value,
score3:this.stars[2].value, score3: this.stars[2].value
}, function(res) { }, function(res) {
if (res.code === '200') { if (res.code === '200') {
that.queryRating() that.queryRating()
@ -601,7 +625,8 @@
id: item.noteId, id: item.noteId,
title: item.noteTitle, title: item.noteTitle,
content: item.noteContent, content: item.noteContent,
isActive:item.noteId===that.$route.query.noteId isActive: item.noteId === that.$route.query.noteId,
originalText: item.originalText
} }
that.noteList.push(obj) that.noteList.push(obj)
if (item.noteId === that.$route.query.noteId) { if (item.noteId === that.$route.query.noteId) {

Loading…
Cancel
Save