|
|
@ -115,6 +115,7 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
import { mapState } from 'vuex' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import Breadcrumb from '@/components/breadcrumb' |
|
|
|
import Breadcrumb from '@/components/breadcrumb' |
|
|
@ -151,7 +152,6 @@ export default { |
|
|
|
classifications: [], |
|
|
|
classifications: [], |
|
|
|
labels: [], |
|
|
|
labels: [], |
|
|
|
columns: [], |
|
|
|
columns: [], |
|
|
|
all: null, |
|
|
|
|
|
|
|
infoColumns: [], |
|
|
|
infoColumns: [], |
|
|
|
sameStyle: 1, |
|
|
|
sameStyle: 1, |
|
|
|
allColumnId: [], |
|
|
|
allColumnId: [], |
|
|
@ -170,6 +170,11 @@ export default { |
|
|
|
hots: [] |
|
|
|
hots: [] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
|
|
...mapState('content', [ |
|
|
|
|
|
|
|
'keyword' |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
}, |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
Breadcrumb |
|
|
|
Breadcrumb |
|
|
|
}, |
|
|
|
}, |
|
|
@ -179,22 +184,34 @@ export default { |
|
|
|
this.init() |
|
|
|
this.init() |
|
|
|
}, |
|
|
|
}, |
|
|
|
'form.title': function(val) { |
|
|
|
'form.title': function(val) { |
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.filter() |
|
|
|
this.filter() |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
keyword() { |
|
|
|
|
|
|
|
this.init() |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.init() |
|
|
|
this.init() |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
init() { |
|
|
|
init() { |
|
|
|
this.getLeftColumn() |
|
|
|
// 全局搜索 |
|
|
|
this.getInfo() |
|
|
|
if (this.keyword) { |
|
|
|
this.getColumn() |
|
|
|
this.form = { |
|
|
|
this.getNews() |
|
|
|
classificationId: null, |
|
|
|
this.getLabel() |
|
|
|
title: this.keyword, |
|
|
|
|
|
|
|
convokeType: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.getLeftColumn() |
|
|
|
|
|
|
|
this.getInfo() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.getColumn() |
|
|
|
|
|
|
|
this.getNews() |
|
|
|
|
|
|
|
this.getLabel() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取栏目详情 |
|
|
|
// 获取栏目详情 |
|
|
|
getInfo() { |
|
|
|
getInfo() { |
|
|
@ -316,12 +333,26 @@ export default { |
|
|
|
// 长页栏目直接获取path |
|
|
|
// 长页栏目直接获取path |
|
|
|
this.$router.push(`/${to.path}?id=${to.id}`).catch(err => {}) |
|
|
|
this.$router.push(`/${to.path}?id=${to.id}`).catch(err => {}) |
|
|
|
} else if (left && (typeId === 1 || (typeId === 4 && !to.children.length))) { |
|
|
|
} else if (left && (typeId === 1 || (typeId === 4 && !to.children.length))) { |
|
|
|
// 常规栏目跳转到column页 |
|
|
|
// 常规栏目,或者没有子级的子级优先栏目,跳转到column页 |
|
|
|
this.$router.push(`/column?id=${to.id + (left && (to.level !== 1 || !this.sameStyle) ? '&column=1' : '')}`).catch(err => {}) |
|
|
|
this.$router.push(`/column?id=${to.id + ((to.level !== 1 || !this.sameStyle) ? '&column=1' : '')}`).catch(err => {}) |
|
|
|
|
|
|
|
} else if (left && typeId === 4 && to.children.length) { |
|
|
|
|
|
|
|
// 子级优先栏目,并且有子级 |
|
|
|
|
|
|
|
const el = this.$refs.leftColumn |
|
|
|
|
|
|
|
if (el) { |
|
|
|
|
|
|
|
this.$refs.leftColumn.store.nodesMap[to.id].expanded = !this.$refs.leftColumn.store.nodesMap[to.id].expanded // |
|
|
|
|
|
|
|
this.getArticle([to.children[0].id]) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 查询文章列表 |
|
|
|
// 查询文章列表 |
|
|
|
getArticle(columnIds) { |
|
|
|
getArticle(columnIds) { |
|
|
|
|
|
|
|
// 全局搜索只需要传关键字和站点id |
|
|
|
|
|
|
|
if (this.keyword) { |
|
|
|
|
|
|
|
this.loaded = true |
|
|
|
|
|
|
|
this.page = 1 |
|
|
|
|
|
|
|
columnIds = [] |
|
|
|
|
|
|
|
this.labelId = [] |
|
|
|
|
|
|
|
} |
|
|
|
const labelName = [] |
|
|
|
const labelName = [] |
|
|
|
// 获取标签名称 |
|
|
|
// 获取标签名称 |
|
|
|
this.labels.map(e => { |
|
|
|
this.labels.map(e => { |
|
|
@ -329,13 +360,14 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.$post(this.api.newlyPublishedArticles, { |
|
|
|
this.$post(this.api.newlyPublishedArticles, { |
|
|
|
siteId: this.$route.query.siteId || this.site, |
|
|
|
siteId: this.$route.query.siteId || this.site, |
|
|
|
columnIds: columnIds.length ? columnIds : [this.id], |
|
|
|
columnIds, |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize, |
|
|
|
pageSize: this.pageSize, |
|
|
|
labelName, |
|
|
|
labelName, |
|
|
|
...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}`) |
|
|
@ -351,9 +383,9 @@ export default { |
|
|
|
// 筛选 |
|
|
|
// 筛选 |
|
|
|
filter() { |
|
|
|
filter() { |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.isFilter = !!(this.form.classificationId || this.form.title || this.form.convokeType || this.lableId.length) |
|
|
|
this.isFilter = !!(this.form.classificationId || this.form.title || this.form.convokeType || this.lableId.length) // 是否在筛选 |
|
|
|
let id = [] |
|
|
|
let id = [] |
|
|
|
if (this.isFilter || this.all) { |
|
|
|
if (this.isFilter) { |
|
|
|
this.getIds(this.columns, id) |
|
|
|
this.getIds(this.columns, id) |
|
|
|
} else if (this.columns.length) { |
|
|
|
} else if (this.columns.length) { |
|
|
|
id = [this.columns[0].id] |
|
|
|
id = [this.columns[0].id] |
|
|
@ -364,7 +396,7 @@ export default { |
|
|
|
this.page = val |
|
|
|
this.page = val |
|
|
|
this.isFilter = !!(this.form.classificationId || this.form.title || this.form.convokeType || this.lableId.length) |
|
|
|
this.isFilter = !!(this.form.classificationId || this.form.title || this.form.convokeType || this.lableId.length) |
|
|
|
let id = [] |
|
|
|
let id = [] |
|
|
|
if (this.isFilter || this.all) { |
|
|
|
if (this.isFilter) { |
|
|
|
this.getIds(this.columns, id) |
|
|
|
this.getIds(this.columns, id) |
|
|
|
} else if (this.columns.length) { |
|
|
|
} else if (this.columns.length) { |
|
|
|
id = [this.$refs.leftColumn.getCurrentKey()] |
|
|
|
id = [this.$refs.leftColumn.getCurrentKey()] |
|
|
|