TalentService-mobile/pages/activity/activityList.vue

116 lines
2.6 KiB
Vue
Raw Permalink Normal View History

2024-10-27 00:26:19 +08:00
<template>
<view class="activity-list">
<lwTopnav bgColor="#fff" lwColor="#000" :isShow="false" lwTitle="人才活动"></lwTopnav>
2024-11-12 17:34:05 +08:00
<u-tabs style="position: fixed;width: 100%;" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
<scroll-view class="result-list" scroll-y>
<u-empty marginTop="200" v-if="dataList==null||dataList.length===0" mode="list"></u-empty>
2024-10-27 00:26:19 +08:00
<view style="margin-top: -30rpx;padding-top: 30rpx;" v-else>
<Dynamics :list="dataList" />
</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
},
2024-11-12 17:34:05 +08:00
props:{
moduleList:{
type: Array,
default: []
}
},
2024-10-27 00:26:19 +08:00
data() {
return {
2024-11-12 17:34:05 +08:00
// 导航栏列表
list:[],
2024-10-31 21:24:54 +08:00
// 列表
2024-11-20 09:32:05 +08:00
dataList:[],
2024-10-31 21:24:54 +08:00
form:{
2024-11-12 17:34:05 +08:00
moduleName: '',
labelName: '',
2024-10-31 21:24:54 +08:00
size: 10,
current: 1
},
2024-11-12 17:34:05 +08:00
current: 0,
2024-10-31 21:24:54 +08:00
isFinish: false
2024-10-27 00:26:19 +08:00
}
},
onLoad() {
uni.setNavigationBarTitle({
title: '人才活动'
})
},
methods: {
2024-11-12 17:34:05 +08:00
// 上拉刷新
onRefresh(){
this.form = {
moduleName: this.moduleList[4].moduleName,
labelName: this.list[this.current].name,
size: 10,
current: 1
};
this.isFinish = false;
this.getDate();
},
// 初始化
async init(){
let listLabelRes = await this.$api.getLabel(this.moduleList[4].id);
if(listLabelRes?.success){
this.list = listLabelRes.data;
}
this.form.moduleName = this.moduleList[4].moduleName;
this.form.labelName = this.list[this.current].name;
this.getDate();
},
2024-10-31 21:24:54 +08:00
// 获取最新政策列表
async getDate(){
let res = await this.$api.getArticleList(this.form);
if(res?.success){
const { size, current, total, records } = res.data;
if(current === 1) this.dataList = records;
else this.dataList.push(...records);
this.isFinish = current*size >= total;
}
},
2024-10-27 00:26:19 +08:00
// scroll-view到底部加载更多
onreachBottom() {
2024-10-31 21:24:54 +08:00
if(this.isFinish) return;
this.form.current++;
this.getDate();
2024-11-12 17:34:05 +08:00
},
// tabs切换
change(index){
this.current = index;
this.form = {
moduleName: this.moduleList[4].moduleName,
labelName: this.list[index].name,
size: 10,
current: 1
};
this.isFinish = false;
this.getDate();
2024-10-27 00:26:19 +08:00
}
}
}
</script>
<style scoped lang="scss">
.activity-list{
.result-list{
2024-11-12 17:34:05 +08:00
min-height: 50vh;
2024-10-27 00:26:19 +08:00
padding: 0;
2024-11-12 17:34:05 +08:00
margin-top: 85rpx;
// background-color: #f9f9f9;
2024-10-27 00:26:19 +08:00
view{
width: 100%;
padding: 0 25rpx;
background-color: #fff;
}
}
}
</style>