Fix:2695 【非遗文化】非遗未显示推荐数据

This commit is contained in:
linxi
2024-11-27 09:13:56 +08:00
parent 338c63d634
commit 3944c961d9
+7 -5
View File
@@ -101,7 +101,8 @@ export default {
actived: 0, actived: 0,
contents: [], contents: [],
recommendList: [], recommendList: [],
keyword: '' keyword: '',
categoryId: ''
} }
}, },
onLoad(opts) { onLoad(opts) {
@@ -116,23 +117,24 @@ export default {
getIch(this.id).then(res => { getIch(this.id).then(res => {
this.ichData = res.data this.ichData = res.data
this.contents = res.data.categories[0] && res.data.categories[0].contents || [] this.contents = res.data.categories[0] && res.data.categories[0].contents || []
this.categoryId = res.data.categories[0].ichCategoryId
this.getRecommend() this.getRecommend()
}) })
}, },
getRecommend() { getRecommend() {
const params = { const params = {
ichDataId: this.ichData.id, ichDataId: this.ichData.id,
keyword: this.keyword keyword: this.keyword,
categoryId: this.categoryId
} }
getIchRecommend(params).then(res => { getIchRecommend(params).then(res => {
this.recommendList = res.data.filter(e => { this.recommendList = res.data
return this.contents.map(el => el.ichContentId).includes(e.id)
}) || []
}) })
}, },
handleTab(index, item) { handleTab(index, item) {
this.actived = index this.actived = index
this.contents = item.contents this.contents = item.contents
this.categoryId = item.ichCategoryId
this.getRecommend() this.getRecommend()
}, },
toDetails(id) { toDetails(id) {