TalentService-mobile/pages/member/member.vue
2025-01-02 18:07:30 +08:00

144 lines
3.1 KiB
Vue

<template>
<view class="activity-list">
<!-- <lwTopnav bgColor="#fff" lwColor="#000" :isShow="false" lwTitle="成员单位一览"></lwTopnav> -->
<u-tabs class="utabs" :list="list" :is-scroll="true" :current="current" @change="change"></u-tabs>
<view style="height: 80rpx;"></view>
<scroll-view class="result-list" scroll-y>
<u-empty marginTop="200" v-if="dataList==null||dataList.length===0" mode="list"></u-empty>
<view style="margin-top: -30rpx;padding-top: 30rpx;" v-else>
<Dynamics :list="dataList" />
</view>
<view class="tip" v-if="isFinish">
~~已加载全部内容~~
</view>
</scroll-view>
</view>
</template>
<script>
import lwTopnav from "@/components/lw-topnav/lw-topnav";
import Dynamics from "@/pages/home/component/dynamics.vue";
export default {
components:{
lwTopnav,Dynamics
},
data() {
return {
// 导航栏列表
list:[],
// 列表
dataList:[],
form:{
moduleName: '',
labelName: '',
size: 10,
current: 1
},
module:{
moduleName: '',
id: 0,
},
current: 0,
isFinish: false
}
},
onLoad(options) {
this.module = {
moduleName: options.moduleName,
id: options.id,
};
this.init();
},
// 滑动到底
onReachBottom() {
this.onreachBottom();
},
methods: {
// 上拉刷新
onPullDownRefresh() {
try{
this.form = {
moduleName: this.module.moduleName,
labelName: this.list[this.current].name,
size: 10,
current: 1
};
this.isFinish = false;
this.getDate();
}catch(e){}
finally{
uni.stopPullDownRefresh();
}
},
// 初始化
async init(){
let listLabelRes = await this.$api.getChildLabel(this.module.id);
if(listLabelRes?.success){
this.list = listLabelRes.data;
}
this.form.moduleName = this.module.moduleName;
this.form.labelName = this.list[this.current].name;
this.getDate();
},
// 获取成员单位一览列表
async getDate(){
let that = this;
let res = await this.$api.getArticleList(this.form);
if(res?.success){
const { size, current, total, records } = res.data;
if(current === 1) that.dataList = records;
else that.dataList.push(...records);
that.isFinish = current*size >= total;
}
},
// scroll-view到底部加载更多
onreachBottom() {
console.log(123,this.isFinish)
if(this.isFinish) return;
this.form.current++;
this.getDate();
},
// tabs切换
change(index){
this.current = index;
this.form = {
moduleName: this.module.moduleName,
labelName: this.list[index].name,
size: 10,
current: 1
};
this.isFinish = false;
this.getDate();
}
}
}
</script>
<style scoped lang="scss">
.activity-list{
.utabs{
width: 100%;
z-index: 2;
position: fixed;
}
.result-list{
min-height: 50vh;
padding: 0;
// background-color: #f9f9f9;
view{
width: 100%;
padding: 0 25rpx;
background-color: #fff;
}
.tip{
width: 100%;
font-size: 28rpx;
color: #c7c7c7;
text-align: center;
margin-bottom: 20rpx;
}
}
}
</style>