|
|
@ -167,7 +167,8 @@ export default { |
|
|
|
label: 'columnName' |
|
|
|
label: 'columnName' |
|
|
|
}, |
|
|
|
}, |
|
|
|
news: [], |
|
|
|
news: [], |
|
|
|
hots: [] |
|
|
|
hots: [], |
|
|
|
|
|
|
|
deepestId: '' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -206,7 +207,6 @@ export default { |
|
|
|
convokeType: null |
|
|
|
convokeType: null |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.getLeftColumn() |
|
|
|
|
|
|
|
this.getInfo() |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
} |
|
|
|
this.getColumn() |
|
|
|
this.getColumn() |
|
|
@ -221,6 +221,7 @@ export default { |
|
|
|
if (!data.columnBanner) data.columnBanner = require('@/assets/images/column-banner.png') |
|
|
|
if (!data.columnBanner) data.columnBanner = require('@/assets/images/column-banner.png') |
|
|
|
this.info = data |
|
|
|
this.info = data |
|
|
|
this.showNav = this.showNavIds.includes(data.listStyleId) |
|
|
|
this.showNav = this.showNavIds.includes(data.listStyleId) |
|
|
|
|
|
|
|
this.getLeftColumn() |
|
|
|
this.getClassification() |
|
|
|
this.getClassification() |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -243,24 +244,46 @@ export default { |
|
|
|
}).catch(err => {}) |
|
|
|
}).catch(err => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 递归查询是否每个层级的栏目都是同一列表样式,如果是,则查询全部栏目下的文章,否则查询当前栏目下的 |
|
|
|
// 递归查询是否每个层级的栏目都是同一列表样式,如果是,则查询全部栏目下的文章,否则查询当前栏目下的 |
|
|
|
handleColumn(data, id) { |
|
|
|
handleColumn(data, parent) { |
|
|
|
for (const e of data) { |
|
|
|
for (const e of data) { |
|
|
|
|
|
|
|
if (this.info.typeId === 4) { // 子级优先 |
|
|
|
|
|
|
|
if (e.children.length) { |
|
|
|
|
|
|
|
this.handleColumn(e.children) |
|
|
|
|
|
|
|
} else if (!this.deepestId) { |
|
|
|
|
|
|
|
this.deepestId = e.id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { // 常规栏目 |
|
|
|
|
|
|
|
if (e.id == this.id) { |
|
|
|
this.allColumnId.push(e.id) |
|
|
|
this.allColumnId.push(e.id) |
|
|
|
if (e.listStyleId !== id) { |
|
|
|
e.children.length && this.handleColumn(e.children, 1) |
|
|
|
|
|
|
|
} else if (parent) { |
|
|
|
|
|
|
|
if (e.listStyleId !== this.info.listStyleId) { |
|
|
|
this.sameStyle = 0 |
|
|
|
this.sameStyle = 0 |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.allColumnId.push(e.id) |
|
|
|
|
|
|
|
e.children.length && this.handleColumn(e.children, parent) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
e.children.length && this.handleColumn(e.children, parent) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.handleColumn(e.children, id) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 左边栏目 |
|
|
|
// 左边栏目 |
|
|
|
getLeftColumn() { |
|
|
|
getLeftColumn() { |
|
|
|
this.$post(`${this.api.oneLevelChecksThemAll}?id=${this.id}`).then(({ data }) => { |
|
|
|
this.$post(`${this.api.oneLevelChecksThemAll}?id=${this.id}`).then(({ data }) => { |
|
|
|
const fromColumn = this.$route.query.column // 有column标识的,说明是通过点击左侧导航跳转过来的,这种情况只查询该栏目下的文章 |
|
|
|
const fromColumn = this.$route.query.column // 有column标识的,说明是通过点击左侧导航跳转过来的,这种情况只查询该栏目下的文章 |
|
|
|
|
|
|
|
const { typeId } = this.info |
|
|
|
this.sameStyle = 1 |
|
|
|
this.sameStyle = 1 |
|
|
|
this.allColumnId = [] |
|
|
|
this.allColumnId = [] |
|
|
|
data.length && this.handleColumn(data, data[0].listStyleId) |
|
|
|
this.deepestId = '' |
|
|
|
this.getArticle(this.sameStyle && !fromColumn ? this.allColumnId : [+this.$route.query.id]) |
|
|
|
data.length && this.handleColumn(data) |
|
|
|
|
|
|
|
let id = this.sameStyle && typeId === 1 ? this.allColumnId : [+this.$route.query.id] |
|
|
|
|
|
|
|
if (typeId === 4 && !fromColumn) { |
|
|
|
|
|
|
|
id = [this.deepestId] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.getArticle(id) |
|
|
|
this.columns = data |
|
|
|
this.columns = data |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
const el = this.$refs.leftColumn |
|
|
|
const el = this.$refs.leftColumn |
|
|
@ -339,8 +362,9 @@ export default { |
|
|
|
// 子级优先栏目,并且有子级 |
|
|
|
// 子级优先栏目,并且有子级 |
|
|
|
const el = this.$refs.leftColumn |
|
|
|
const el = this.$refs.leftColumn |
|
|
|
if (el) { |
|
|
|
if (el) { |
|
|
|
this.$refs.leftColumn.store.nodesMap[to.id].expanded = !this.$refs.leftColumn.store.nodesMap[to.id].expanded // |
|
|
|
const exp = el.store.nodesMap[to.id].expanded |
|
|
|
this.getArticle([to.children[0].id]) |
|
|
|
el.store.nodesMap[to.id].expanded = !exp // 展开收缩子级 |
|
|
|
|
|
|
|
el.setCurrentKey(this.id) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -367,7 +391,6 @@ export default { |
|
|
|
...this.form |
|
|
|
...this.form |
|
|
|
}).then(({ data }) => { |
|
|
|
}).then(({ data }) => { |
|
|
|
this.articles = Util.removeTag(data.records) |
|
|
|
this.articles = Util.removeTag(data.records) |
|
|
|
console.log("🚀 ~ file: index.vue:369 ~ getArticle ~ this.articles", this.articles) |
|
|
|
|
|
|
|
this.total = +data.total |
|
|
|
this.total = +data.total |
|
|
|
// 如果栏目那勾选了“只有一篇文章时,以详情方式展示”,并且只有一篇文章,则跳转到详情页 |
|
|
|
// 如果栏目那勾选了“只有一篇文章时,以详情方式展示”,并且只有一篇文章,则跳转到详情页 |
|
|
|
// this.total == 1 && this.info.showWithDetails && this.$router.push(`/article?articleId=${this.articles[0].id}&id=${this.articles[0].columnId}`) |
|
|
|
// this.total == 1 && this.info.showWithDetails && this.$router.push(`/article?articleId=${this.articles[0].id}&id=${this.articles[0].columnId}`) |
|
|
|