对接阅读论文接口

master
pan 4 years ago
parent f19e26b241
commit 6fb923b8a1
  1. 26
      pages/index/document.vue

@ -102,6 +102,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import { Loading } from 'element-ui'
export default Vue.extend({ export default Vue.extend({
name: 'document', name: 'document',
@ -128,12 +129,30 @@
}, },
methods: { methods: {
read(item: any) { read(item: any) {
this.$store.commit('menus/read') let loadingInstance =Loading.service({});
this.$store.commit('read/open', item) let that=this
this.$router.push(this.localePath('/read')) this.GLOBAL.fetchGet(`/v1/api/file/find/${item.fileId}`,{},function(res) {
if(res.code==='200'){
fetch(`${that.GLOBAL.server_address}${res.msg}`).then(res=>res.text()).then(res=>{
item.content=res
loadingInstance.close()
that.$store.commit('menus/read')
that.$store.commit('read/open', item)
that.$router.push(that.localePath('/read'))
}).catch(err=>{
console.error(err)
loadingInstance.close()
})
}else{
loadingInstance.close()
that.$message.error(that.$t('error_500').toString())
}
})
}, },
query(){ query(){
let that=this let that=this
let loadingInstance =Loading.service({});
this.GLOBAL.fetchGet('/v1/api/paper/list', { this.GLOBAL.fetchGet('/v1/api/paper/list', {
title: this.form.title, title: this.form.title,
author: this.form.author, author: this.form.author,
@ -148,6 +167,7 @@
}else{ }else{
that.$message.error(that.$t('error_500').toString()) that.$message.error(that.$t('error_500').toString())
} }
loadingInstance.close()
}) })
} }
}, },

Loading…
Cancel
Save