对接阅读论文接口

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

@ -102,6 +102,7 @@
<script lang="ts">
import Vue from 'vue'
import { Loading } from 'element-ui'
export default Vue.extend({
name: 'document',
@ -128,12 +129,30 @@
},
methods: {
read(item: any) {
this.$store.commit('menus/read')
this.$store.commit('read/open', item)
this.$router.push(this.localePath('/read'))
let loadingInstance =Loading.service({});
let that=this
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(){
let that=this
let loadingInstance =Loading.service({});
this.GLOBAL.fetchGet('/v1/api/paper/list', {
title: this.form.title,
author: this.form.author,
@ -148,6 +167,7 @@
}else{
that.$message.error(that.$t('error_500').toString())
}
loadingInstance.close()
})
}
},

Loading…
Cancel
Save