You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
3.6 KiB
154 lines
3.6 KiB
<template>
|
|
<view class="explore">
|
|
<!-- 搜索 -->
|
|
<view >
|
|
<router-link
|
|
:to="{path: '/bundle_b/pages/community_search/community_search'}">
|
|
<u-search disabled
|
|
placeholder="请输入搜索内容" height="64" focus
|
|
></u-search>
|
|
</router-link>
|
|
</view>
|
|
|
|
<view class="content" v-if="type==1">
|
|
<tabs :current="current" @change="changeTabs" height="100" >
|
|
<tab v-for="(item, index) in tabList1" :key="index" :name="item.name">
|
|
<lists :cateId="item.id" :typeId="1" :i="index" :index="current"></lists>
|
|
</tab>
|
|
</tabs>
|
|
</view>
|
|
<view class="content" v-if="type==0">
|
|
<tabs :current="current" @change="changeTabs" height="100" >
|
|
<tab v-for="(item, index) in tabList" :key="index" :name="item.name">
|
|
<lists :cateId="item.id" :typeId="0" :i="index" :index="current"></lists>
|
|
</tab>
|
|
</tabs>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getCommunityCate2,
|
|
getCommunityArticleLists
|
|
} from '@/api/community.js';
|
|
import Lists from "./lists.vue"
|
|
export default {
|
|
components: {
|
|
Lists
|
|
},
|
|
props: {
|
|
active: {
|
|
type: Number
|
|
},
|
|
cid:{
|
|
type: Number
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
tabList: [{
|
|
name: '全部',
|
|
id: ''
|
|
}],
|
|
tabList1: [{
|
|
name: '全部',
|
|
id: ''
|
|
}],
|
|
current: 0.,
|
|
type:this.active == 2?0:1,
|
|
cate_id : 0,
|
|
}
|
|
},
|
|
watch: {
|
|
cid(){
|
|
|
|
},
|
|
active() {
|
|
|
|
if(this.active == 1){
|
|
this.type =1;
|
|
}else if(this.active == 2){
|
|
this.type =0;
|
|
}
|
|
console.log("当前类型:",this.type)
|
|
if(this.active == 1 || this.active == 2){
|
|
this.current = 0 ;
|
|
this.initRecommendTopic()
|
|
// this.mescroll.resetUpScroll()
|
|
}
|
|
|
|
}
|
|
},
|
|
|
|
created() {
|
|
this.initRecommendTopic()
|
|
},
|
|
onShow() {
|
|
console.log(1111)
|
|
let cid = uni.getStorageSync("cid")
|
|
uni.removeStorageSync("cid")
|
|
|
|
if(cid!=undefined){
|
|
this.cate_id = parseInt(cid)
|
|
}
|
|
|
|
},
|
|
methods: {
|
|
initMescroll(event) {
|
|
this.isInit = true; // 标记为true
|
|
this.mescroll = event;
|
|
|
|
},
|
|
handleCancel() {
|
|
this.keyword = '';
|
|
},
|
|
// 切换标签导航
|
|
changeTabs(event) {
|
|
this.current = event;
|
|
this.type =this.type;
|
|
this.cid = 0;
|
|
},
|
|
// 初始化获取话题
|
|
initRecommendTopic() {
|
|
|
|
getCommunityCate2({'type':this.type}).then(res => {
|
|
if( res.code === 1 ) {
|
|
if(this.type == 1){
|
|
this.tabList1 = [{
|
|
name: '全部',
|
|
id: ''
|
|
}, ...res.data]
|
|
}else{
|
|
this.tabList = [{
|
|
name: '全部',
|
|
id: ''
|
|
}, ...res.data]
|
|
}
|
|
console.log("cate数据:",this.cid)
|
|
this.tabList1.forEach((item, index) => {
|
|
if(this.cid>0 && item.id == this.cid){
|
|
this.current = index
|
|
}
|
|
})
|
|
} else {
|
|
this.$toast({ title: res.msg })
|
|
}
|
|
})
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.explore {
|
|
|
|
// pb
|
|
.content {
|
|
height: calc(100vh - 92px - var(--window-bottom));
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
</style>
|
|
|