粒子研究院前台前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

178 lines
4.5 KiB

<template>
<div class="wrap">
<div class="content">
<Breadcrumb ref="breadcrumb" :data.sync="routes"/>
<div class="article">
<div class="left">
<h2>{{ form.title }}</h2>
<p class="name">作者</p>
<p class="val">{{ form.author }}</p>
<p class="name">引用</p>
<p class="val">{{ form.quote }}</p>
<p class="name">摘要</p>
<div class="des" v-html="form.mainBody"></div>
</div>
<div class="right">
<img class="pic" src="@/assets/images/publish3.png" alt="">
<div class="texts">
<p class="name">出版年份</p>
<p class="val">{{ form.publicationYear }}</p>
<p class="name">出版物类型</p>
<p class="val">{{ form.publicationTypeId && publicationTypes.find(e => e.id == form.publicationTypeId).name }}</p>
<p class="name">DOI</p>
<p class="val">{{ form.doi }}</p>
<p class="name">其他字段</p>
<p class="val">2022</p>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import Setting from '@/setting'
import Util from '@/libs/util'
import Breadcrumb from '@/components/breadcrumb'
import mixins from '@/mixins/article'
import ColumnConst from '@/const/column'
export default {
mixins: [mixins],
data() {
return {
id: this.$route.query.articleId,
publicationTypes: ColumnConst.publicationTypes,
routes: [],
columnId: '',
form: {},
columnBanner: '',
}
},
components: {
Breadcrumb
},
watch: {
'$route'() {
this.id = this.$route.query.id
this.getInfo()
}
},
mounted() {
this.getInfo()
},
methods: {
// 获取文章详情
getInfo() {
this.$post(`${this.api.findArticle}?id=${this.id}`).then(({ data }) => {
// 设置面包屑
const { columnName, path, id } = this.$route.query
this.routes = [
{
name: columnName || data.columnName,
path: path ? '/' + path : '',
query: {
id: id || data.columnId
}
},
{
name: data.title
}
]
this.form = data
this.columnId = data.columnId
// 如果没上传banner
if (!data.bannerImg) {
this.getBanner(this.columns)
this.form.bannerImg = this.columnBanner || require('@/assets/images/article-banner.png')
}
}).catch(err => {})
// 浏览量+1
// this.$post(`${this.api.articlePreview}?contentId=${this.id}`).then(({ data }) => {}).catch(err => {})
},
// 获取banner 规则:当前文章有上传的,用上传的,没有上传的话,如果栏目有图片,读取栏目的(上级没有读上上级,以此类推)都没有的读取默认的
getBanner(data) {
for (const e of data) {
if (e.columnBanner) this.columnBanner = e.columnBanner
if (e.id == this.columnId) {
break
} else {
this.getBanner(e.children)
}
}
},
}
};
</script>
<style lang="scss" scoped>
.wrap {
background: url(../../assets/images/publish1.png) no-repeat;
}
.content {
width: 1084px;
padding-top: 25px;
background: url(../../assets/images/publish2.png) bottom right/auto no-repeat;
}
.breadcrumb {
margin-bottom: 25px;
}
.article {
display: flex;
justify-content: space-between;
.left {
width: 846px;
padding: 30px;
margin-right: 16px;
background: #fff;
.name {
font-size: 24px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 33px;
}
.val {
margin-bottom: 38px;
font-size: 16px;
color: #333;
line-height: 30px;
}
}
h2 {
padding-bottom: 27px;
margin-bottom: 40px;
font-size: 36px;
font-family: PingFangSC-Medium, PingFang SC;
color: #333;
line-height: 50px;
border-bottom: 1px solid #ddd;
}
.right {
width: 222px;
background: #fff;
.texts {
padding: 15px;
}
.name {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
line-height: 20px;
color: #666666;
}
.val {
margin: 5px 0 36px;
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 20px;
}
}
}
@media (max-width: 1420px) {
.content {
width: 98%;
}
}
</style>