|
|
@ -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 |
|
|
|
}, |
|
|
|
}, |
|
|
@ -183,6 +188,9 @@ export default { |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.filter() |
|
|
|
this.filter() |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
keyword() { |
|
|
|
|
|
|
|
this.init() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
@ -190,8 +198,17 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
init() { |
|
|
|
init() { |
|
|
|
|
|
|
|
// 全局搜索 |
|
|
|
|
|
|
|
if (this.keyword) { |
|
|
|
|
|
|
|
this.form = { |
|
|
|
|
|
|
|
classificationId: null, |
|
|
|
|
|
|
|
title: this.keyword, |
|
|
|
|
|
|
|
convokeType: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
this.getLeftColumn() |
|
|
|
this.getLeftColumn() |
|
|
|
this.getInfo() |
|
|
|
this.getInfo() |
|
|
|
|
|
|
|
} |
|
|
|
this.getColumn() |
|
|
|
this.getColumn() |
|
|
|
this.getNews() |
|
|
|
this.getNews() |
|
|
|
this.getLabel() |
|
|
|
this.getLabel() |
|
|
@ -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()] |
|
|
|