|
|
|
@ -77,7 +77,7 @@ export default { |
|
|
|
|
methods: { |
|
|
|
|
// 获取文章详情 |
|
|
|
|
getInfo () { |
|
|
|
|
this.id && this.$post(`${this.api.findArticle}?id=${this.id}`).then(({ data }) => { |
|
|
|
|
this.id && this.$post(`${this.api.findArticle}?id=${this.id}`).then(async ({ data }) => { |
|
|
|
|
// 设置面包屑 |
|
|
|
|
const { columnName, path, id } = this.$route.query |
|
|
|
|
this.routes = [ |
|
|
|
@ -102,14 +102,21 @@ export default { |
|
|
|
|
this.$router.replace((temId === 25 ? '/article/activity' : '/publish/show') + path) |
|
|
|
|
} else { |
|
|
|
|
if (temId == 69) this.isParty = 1 // 组织架构(articleTemplate=69)是另一套主题,加个class即可 |
|
|
|
|
if (temId == 72) this.isPeople = 1 // 人物详情(articleTemplate=72)要隐藏除了正文以外的所有字段 |
|
|
|
|
if (temId == 72) this.isPeople = 1 // 人物详情(articleTemplate=72)要隐藏除了正文和摘要以外的所有字段 |
|
|
|
|
data.releaseTime = data.releaseTime.split(' ')[0] |
|
|
|
|
this.form = data |
|
|
|
|
this.columnId = data.columnId |
|
|
|
|
// 如果没上传banner |
|
|
|
|
if (!data.bannerImg) { |
|
|
|
|
this.getBanner(this.$refs.right.columns) |
|
|
|
|
this.form.bannerImg = this.gotBanner && this.columnBanner || require('@/assets/images/article-banner.png') |
|
|
|
|
const columns = await this.$post(this.api.listWithTree, { |
|
|
|
|
siteId: this.site, |
|
|
|
|
columnName: '', |
|
|
|
|
templateId: '', |
|
|
|
|
typeId: '', |
|
|
|
|
isSort: 1 |
|
|
|
|
}) |
|
|
|
|
this.getBanner(columns.data) |
|
|
|
|
this.form.bannerImg = this.gotBanner ? this.columnBanner || require('@/assets/images/article-banner.png') : '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 浏览量+1 |
|
|
|
@ -128,10 +135,10 @@ export default { |
|
|
|
|
}) |
|
|
|
|
.catch((res) => { }); |
|
|
|
|
}, |
|
|
|
|
// 获取banner 规则:当前文章有上传的,用上传的,没有上传的话,如果栏目有图片,读取栏目的(上级没有读上上级,以此类推)都没有的读取默认的 |
|
|
|
|
// 获取banner 规则:当前文章有上传的话,用上传的,没有上传的话,如果所属栏目有图片,读取栏目的(所属栏目没有的话读上级,上级没有就上上级,以此类推)都没有的话读取默认的 |
|
|
|
|
getBanner (data) { |
|
|
|
|
for (const e of data) { |
|
|
|
|
if (e.columnBanner) this.columnBanner = e.columnBanner |
|
|
|
|
if (e.columnBanner && !this.gotBanner) this.columnBanner = e.columnBanner |
|
|
|
|
if (e.id == this.columnId) { |
|
|
|
|
this.gotBanner = 1 |
|
|
|
|
break |
|
|
|
|