推荐后台对接

master
pan 4 years ago
parent 7bf718d938
commit 4fec3aabac
  1. 2
      components/center/security.vue
  2. 2
      components/lang.vue
  3. 2
      layouts/mainmenu.vue
  4. 10
      nuxt.config.js
  5. 33
      pages/index/document.vue
  6. 5
      store/read.js

@ -101,6 +101,8 @@
if(res.code==='200'){ if(res.code==='200'){
that.$message.info(that.$t('center.security.tip.ok').toString()) that.$message.info(that.$t('center.security.tip.ok').toString())
that.$cookies.remove(that.GLOBAL.user_key) that.$cookies.remove(that.GLOBAL.user_key)
that.$store.commit('read/reset')
that.$store.commit('menus/none')
that.$router.push(that.localePath('/account')) that.$router.push(that.localePath('/account'))
}else if(res.msg!==null){ }else if(res.msg!==null){
that.$message.error(res.msg) that.$message.error(res.msg)

@ -32,6 +32,8 @@
methods:{ methods:{
logout:function() { logout:function() {
this.$cookies.remove(this.GLOBAL.user_key) this.$cookies.remove(this.GLOBAL.user_key)
this.$store.commit('read/reset')
this.$store.commit('menus/none')
this.$router.push(this.localePath('/account')) this.$router.push(this.localePath('/account'))
} }
} }

@ -7,7 +7,7 @@
</el-image> </el-image>
<h1 class="el-dialog--center"></h1> <h1 class="el-dialog--center"></h1>
<el-menu @select="selectItem" :router="true" :default-active="$route.path"> <el-menu @select="selectItem" :router="true" :default-active="$route.path">
<el-menu-item :index="localePath('/'+item,$i18n.locale)" v-for="item in menus" :key="item"> <el-menu-item :index="localePath('/'+item,$i18n.locale)" v-for="item in menus" :key="item" :disabled="$route.path==='/'+item">
<template slot="title"> <template slot="title">
<i class="el-icon-location"></i> <i class="el-icon-location"></i>
<span>{{$t('menus.'+item)}}</span> <span>{{$t('menus.'+item)}}</span>

@ -165,7 +165,8 @@ export default {
"tutor": "导师" "tutor": "导师"
}, },
"tip": { "tip": {
"empty": "没有匹配到一篇论文" "doc_empty": "没有匹配到一篇论文",
"recommend_empty": "暂无论文推荐"
} }
}, },
"en": "英文", "en": "英文",
@ -184,6 +185,7 @@ export default {
"upload": "本地上传论文" "upload": "本地上传论文"
}, },
"more_query": "更多查询", "more_query": "更多查询",
"new_recommend": "最新推荐",
"note": { "note": {
"table": { "table": {
"original_text": "注释原文", "original_text": "注释原文",
@ -233,7 +235,6 @@ export default {
"reset": "重置", "reset": "重置",
"select_please": "请选择{keyword}", "select_please": "请选择{keyword}",
"tip": "提示", "tip": "提示",
"today_recommend": "今日推荐",
"unknown_error": "未知错误", "unknown_error": "未知错误",
"upload": { "upload": {
"form": { "form": {
@ -338,7 +339,8 @@ export default {
"tutor": "" "tutor": ""
}, },
"tip": { "tip": {
"empty": "" "doc_empty": "",
"recommend_empty": ""
} }
}, },
"en": "english", "en": "english",
@ -357,6 +359,7 @@ export default {
"upload": "" "upload": ""
}, },
"more_query": "", "more_query": "",
"new_recommend": "",
"note": { "note": {
"table": { "table": {
"original_text": "", "original_text": "",
@ -406,7 +409,6 @@ export default {
"reset": "", "reset": "",
"select_please": "", "select_please": "",
"tip": "", "tip": "",
"today_recommend": "",
"unknown_error": "", "unknown_error": "",
"upload": { "upload": {
"form": { "form": {

@ -47,7 +47,7 @@
<el-col :span="18"> <el-col :span="18">
<template v-if="docList.length===0"> <template v-if="docList.length===0">
<el-alert <el-alert
:title="tip" :title="$t('document.tip.doc_empty')"
type="success" type="success"
:closable="false" :closable="false"
center> center>
@ -82,15 +82,20 @@
</el-col> </el-col>
<el-col :span="5" class="ml3"> <el-col :span="5" class="ml3">
<el-row> <el-row>
<h1 class="center">{{$t('today_recommend')}}</h1> <h1 class="center">{{$t('new_recommend')}}</h1>
</el-row> </el-row>
<div class="recommend-list"> <div class="recommend-list"v-if="recommend_list.length>0">
<el-row v-for="(item,index) in recommend_list" :key="index">
<el-row v-for="(item,index) in recommend_list" :key="index"> <h3 class="center doc-title"><a @click="read(item)">{{item.title}}</a></h3>
<h3 class="center doc-title">{{item.title}}</h3> <p class="doc-summary">{{item.summary}}</p>
<p class="doc-summary">{{item.summary}}</p> </el-row>
</el-row>
</div> </div>
<el-alert v-else
:title="$t('document.tip.recommend_empty')"
type="success"
:closable="false"
center>
</el-alert>
</el-col> </el-col>
</el-row> </el-row>
<el-pagination <el-pagination
@ -123,7 +128,6 @@
activeNames: [], activeNames: [],
docList: [], docList: [],
recommend_list: [], recommend_list: [],
tip: this.$t('document.tip.empty'),
total:1 total:1
} }
}, },
@ -150,10 +154,17 @@
} }
loadingInstance.close() loadingInstance.close()
}) })
},
recommend(){
let that=this
this.GLOBAL.fetchGet('/v1/api/paper/recommend',{},function(res) {
that.recommend_list=res.data
})
} }
}, },
mounted() { mounted() {
this.query() this.query()
this.recommend()
} }
}) })
</script> </script>
@ -174,4 +185,8 @@
.recommend-list { .recommend-list {
overflow-y: scroll; overflow-y: scroll;
} }
a{
cursor: pointer;
}
</style> </style>

@ -45,5 +45,10 @@ export const mutations = {
//更新收藏状态 //更新收藏状态
updateCollect(state,key){ updateCollect(state,key){
state.read[key].hasCollect=!state.read[key].hasCollect state.read[key].hasCollect=!state.read[key].hasCollect
},
//重置
reset(state){
state.read={ }
state.activeName=''
} }
} }

Loading…
Cancel
Save