@@ -60,7 +76,7 @@
animationEffect="fadeInUp"
backgroundColor="rgba(0, 0, 0, 0)">
-
+
豆瓣: {{props.data.rate}}
@@ -102,7 +118,11 @@ export default {
recommandations: [],
sites: [],
viewMode: 'picture',
- loading: false
+ loading: false,
+ types: [],
+ selectedTypes: [],
+ areas: [],
+ selectedAreas: []
}
},
components: {
@@ -149,6 +169,14 @@ export default {
},
methods: {
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE']),
+ showCard (cardData) {
+ var filteredByAreas = this.selectedAreas.length === 0 || this.selectedAreas.includes(cardData.detail.area)
+ var filteredByTypes = this.selectedTypes.length === 0 || this.selectedTypes.includes(cardData.detail.type)
+ return filteredByAreas && filteredByTypes
+ },
+ typeChangeEvent () {
+ this.$refs.waterfall.refresh()
+ },
sortByType (a, b) {
return a.detail.type.localeCompare(b.detail.type)
},
@@ -254,8 +282,13 @@ export default {
this.recommandations.sort(function (a, b) {
return b.detail.year - a.detail.year
})
+ this.getFilterData()
})
},
+ getFilterData () {
+ this.types = [...new Set(this.recommandations.map(ele => ele.detail.type))].filter(x => x)
+ this.areas = [...new Set(this.recommandations.map(ele => ele.detail.area))].filter(x => x)
+ },
getViewMode () {
setting.find().then(res => {
this.viewMode = res.recommandationViewMode