|
|
|
@ -44,9 +44,15 @@ |
|
|
|
</ad-swipers> |
|
|
|
</view> |
|
|
|
<tabs :current="active" @change="changeActive" :bar-width="60"> |
|
|
|
<tab name="全部"></tab> |
|
|
|
<!-- <tab name="全部"></tab> --> |
|
|
|
<tab v-for="(item, index) in categoryList" :key="index" :name="item.name"></tab> |
|
|
|
</tabs> |
|
|
|
|
|
|
|
<tabs v-if="categoryList2.length" :current="active2" @change="changeActive2" :bar-width="60"> |
|
|
|
<!-- <tab name="全部"></tab> --> |
|
|
|
<tab v-for="(item, index) in categoryList2" :key="index" :name="item.name"></tab> |
|
|
|
</tabs> |
|
|
|
|
|
|
|
<view class="main"> |
|
|
|
<view class="article-list"> |
|
|
|
<view class="article-item bg-white" v-for="(item, index) in newsList" :key="index" > |
|
|
|
@ -83,8 +89,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import Organ from "../../components/components/organ.vue" |
|
|
|
import Team from "../../components/components/team.vue" |
|
|
|
// import Organ from "../../components/components/organ.vue" |
|
|
|
// import Team from "../../components/components/team.vue" |
|
|
|
|
|
|
|
import { |
|
|
|
mapGetters, |
|
|
|
@ -96,16 +102,17 @@ |
|
|
|
} from '@/api/store'; |
|
|
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins"; |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
Organ, |
|
|
|
Team |
|
|
|
}, |
|
|
|
// components: { |
|
|
|
// Organ, |
|
|
|
// Team |
|
|
|
// }, |
|
|
|
mixins: [MescrollMixin], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
current:1, |
|
|
|
currentNav:1, |
|
|
|
active: 0, |
|
|
|
active2: 0, |
|
|
|
upOption: { |
|
|
|
auto: false, |
|
|
|
empty: { |
|
|
|
@ -114,7 +121,9 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
cid:0, |
|
|
|
cid2:0, |
|
|
|
categoryList: [], |
|
|
|
categoryList2: [], |
|
|
|
newsList: [], |
|
|
|
type: -1, |
|
|
|
cate_type:0, |
|
|
|
@ -123,15 +132,15 @@ |
|
|
|
|
|
|
|
async onShow() { |
|
|
|
console.log(111) |
|
|
|
this.categoryList = [], |
|
|
|
this.type = 0; |
|
|
|
this.cate_type = 0; |
|
|
|
// this.categoryList = [], |
|
|
|
// this.type = 0; |
|
|
|
// this.cate_type = 0; |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: '资料库' |
|
|
|
}); |
|
|
|
this.cid = 0 |
|
|
|
this.current = 1 |
|
|
|
this.currentNav = 1 |
|
|
|
// this.cid = 0 |
|
|
|
// this.current = 1 |
|
|
|
// this.currentNav = 1 |
|
|
|
|
|
|
|
let queryString = uni.getStorageSync("params") |
|
|
|
uni.removeStorageSync("params") |
|
|
|
@ -153,15 +162,21 @@ |
|
|
|
if(p_index !=undefined && p_index!=""){ |
|
|
|
this.current = parseInt(p_index) |
|
|
|
this.currentNav = parseInt(p_index) |
|
|
|
}else{ |
|
|
|
this.current = 1 |
|
|
|
this.currentNav = 1 |
|
|
|
} |
|
|
|
|
|
|
|
if(p_cate !=undefined && p_cate!=""){ |
|
|
|
this.cid = parseInt(p_cate) |
|
|
|
}else{ |
|
|
|
this.cid = 0 |
|
|
|
} |
|
|
|
|
|
|
|
if(cate_type !=undefined && cate_type!=""){ |
|
|
|
this.cate_type = parseInt(cate_type) |
|
|
|
this.active = 0 |
|
|
|
this.active2 = 0 |
|
|
|
if(this.cate_type == 1){ |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: '全国案例' |
|
|
|
@ -169,9 +184,18 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else if(queryString == ""){ |
|
|
|
this.cid = 0 |
|
|
|
this.current = 1 |
|
|
|
this.currentNav = 1 |
|
|
|
this.categoryList = [], |
|
|
|
this.type = 0; |
|
|
|
this.cate_type = 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log("this.cate_type :",this.cate_type,this.cate_type ) |
|
|
|
console.log("this.active :",this.current,this.currentNav ) |
|
|
|
// 选择城市后是否刷新 |
|
|
|
await this.downCallback(); |
|
|
|
}, |
|
|
|
@ -190,26 +214,50 @@ |
|
|
|
|
|
|
|
methods: { |
|
|
|
changeNav(index){ |
|
|
|
if(index == 1){ |
|
|
|
this.current = index |
|
|
|
this.currentNav = index |
|
|
|
console.log("此时数据:",this.currentNav) |
|
|
|
this.mescroll.resetUpScroll(); |
|
|
|
}else if(index == 3){ |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
url: "/bundle_b/pages/resource_list/ogran_list" |
|
|
|
}); |
|
|
|
} |
|
|
|
else if(index == 4){ |
|
|
|
uni.navigateTo({ |
|
|
|
url: "/bundle_b/pages/resource_list/team_list" |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
changeActive(e) { |
|
|
|
this.active2 = 0 ; |
|
|
|
this.active = e; |
|
|
|
this.newsList = [] // 先置空列表,显示加载进度 |
|
|
|
this.mescroll.resetUpScroll() // 再刷新列表数据 |
|
|
|
}, |
|
|
|
changeActive2(e) { |
|
|
|
this.active2 = e; |
|
|
|
this.newsList = [] // 先置空列表,显示加载进度 |
|
|
|
this.mescroll.resetUpScroll() // 再刷新列表数据 |
|
|
|
}, |
|
|
|
async downCallback() { |
|
|
|
await this.getCategoryListFun(); |
|
|
|
console.log("后续值",this.categoryList) |
|
|
|
console.log("后续值2",this.cid) |
|
|
|
this.mescroll.resetUpScroll(); |
|
|
|
}, |
|
|
|
upCallback(page) { |
|
|
|
const { type, active, categoryList } = this |
|
|
|
const { cityInfo,type, active, categoryList } = this |
|
|
|
console.log("active:",categoryList[this.active]) |
|
|
|
let city_id=0 |
|
|
|
if(cityInfo.id !=null && cityInfo.id!=undefined && cityInfo.id>0){ |
|
|
|
city_id = cityInfo.id |
|
|
|
} |
|
|
|
getResourceList({ |
|
|
|
type: this.type, |
|
|
|
cid: this.active ? categoryList[active-1].id : '', |
|
|
|
cid: this.active ? categoryList[this.active].id : '', |
|
|
|
cid2: this.active2 ? this.categoryList2[this.active2].id : '', |
|
|
|
city_id:city_id, |
|
|
|
page_size:page.size, |
|
|
|
page_no:page.num, |
|
|
|
cate_type: this.cate_type, |
|
|
|
@ -225,8 +273,44 @@ |
|
|
|
}).catch(() => { |
|
|
|
this.mescroll.endErr() |
|
|
|
}) |
|
|
|
this.getCategoryListFun2(); |
|
|
|
}, |
|
|
|
|
|
|
|
async getCategoryListFun2() { |
|
|
|
console.log("获取子分类开始",this.active) |
|
|
|
this.categoryList2 = []; |
|
|
|
console.log("当前分类",this.categoryList[this.active].id) |
|
|
|
|
|
|
|
const { |
|
|
|
code, |
|
|
|
data |
|
|
|
} = await getResourceCategoryList({ |
|
|
|
pid: this.active ? this.categoryList[this.active].id : 999, |
|
|
|
}) |
|
|
|
|
|
|
|
if (code == 1 && data.length>0) { |
|
|
|
this.categoryList2 = [{ |
|
|
|
name: '全部', |
|
|
|
id: '' |
|
|
|
}, ...data] |
|
|
|
} |
|
|
|
let item = {} |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
// 在DOM更新之后使用Vue.set来更新数组 |
|
|
|
this.categoryList2.forEach((item, index) => { |
|
|
|
this.$set(this.categoryList2, index, item); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.categoryList2.forEach((item, index) => { |
|
|
|
if(this.cid2>0 && item.id == this.cid2){ |
|
|
|
this.active2 = index+1 |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async getCategoryListFun() { |
|
|
|
this.categoryList = []; |
|
|
|
console.log("当前分类",this.categoryList) |
|
|
|
@ -242,7 +326,10 @@ |
|
|
|
}) |
|
|
|
|
|
|
|
if (code == 1) { |
|
|
|
this.categoryList = data |
|
|
|
this.categoryList = [{ |
|
|
|
name: '全部', |
|
|
|
id: '' |
|
|
|
}, ...data] |
|
|
|
} |
|
|
|
let item = {} |
|
|
|
|
|
|
|
@ -270,7 +357,14 @@ |
|
|
|
|
|
|
|
this.categoryList.forEach((item, index) => { |
|
|
|
if(this.cid>0 && item.id == this.cid){ |
|
|
|
console.log("当前值:{}",this.cate_type) |
|
|
|
if(this.cate_type == 0){ |
|
|
|
this.active = index+1 |
|
|
|
}else{ |
|
|
|
this.active = index |
|
|
|
} |
|
|
|
console.log("当前值:{}",this.active) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|