|
|
@@ -44,9 +44,11 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view class="c-box-list" v-if="activityList.length">
|
|
|
- <template v-for="item in activityList" :key="item.id">
|
|
|
- <NonprofitActivety :item="item"></NonprofitActivety>
|
|
|
- </template>
|
|
|
+ <up-list @scrolltolower="scrolltolower" style="height: 100%;">
|
|
|
+ <up-list-item v-for="(item, index) in activityList" :key="item.id">
|
|
|
+ <NonprofitActivety :item="item" :index="index"></NonprofitActivety>
|
|
|
+ </up-list-item>
|
|
|
+ </up-list>
|
|
|
</view>
|
|
|
<view class="dataEmpty" v-else>
|
|
|
<page-empty></page-empty>
|
|
|
@@ -72,7 +74,14 @@
|
|
|
const typeList = ref([])
|
|
|
const tlIndex = ref(0)
|
|
|
const scrollLeft = ref(0)
|
|
|
+ const isOver = ref(false)
|
|
|
const activityList = ref([])
|
|
|
+ const queryParams = ref({
|
|
|
+ page:1,
|
|
|
+ limit:10,
|
|
|
+ categoryId:'',
|
|
|
+ userId:''
|
|
|
+ })
|
|
|
|
|
|
const bannerClick = e => {
|
|
|
let banner = bannarOrigin.value[e];
|
|
|
@@ -90,6 +99,7 @@
|
|
|
}
|
|
|
|
|
|
const changeType = (item,index) => {
|
|
|
+ queryParams.value.categoryId = item.id;
|
|
|
tlIndex.value = index;
|
|
|
if(typeList.value.length>4){
|
|
|
if(index<3) scrollLeft.value = 0
|
|
|
@@ -97,7 +107,14 @@
|
|
|
scrollLeft.value = (index-2)*172/2;
|
|
|
}
|
|
|
}
|
|
|
- getActivityList(item.id)
|
|
|
+ initList();
|
|
|
+ getActivityList();
|
|
|
+ }
|
|
|
+
|
|
|
+ const initList = () => {
|
|
|
+ queryParams.value.page = 1;
|
|
|
+ isOver.value = false;
|
|
|
+ activityList.value = [];
|
|
|
}
|
|
|
|
|
|
const toTurnPage = (url,needLogin) => {
|
|
|
@@ -122,16 +139,21 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- const getActivityList = (categoryId) => {
|
|
|
- let userId = '';
|
|
|
- if(uni.getStorageSync('userInfo')) userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
|
|
|
- proxy.$api.get('/core/activity/page',{page:1,limit:2,categoryId,userId}).then(({data:res})=>{
|
|
|
+ const scrolltolower = () => {
|
|
|
+ if(isOver.value) return
|
|
|
+ getActivityList()
|
|
|
+ }
|
|
|
+
|
|
|
+ const getActivityList = () => {
|
|
|
+ proxy.$api.get('/core/activity/page',queryParams.value).then(({data:res})=>{
|
|
|
if(res.code!==0) return proxy.$showToast(res.msg)
|
|
|
- activityList.value = res.data.list;
|
|
|
+ activityList.value = [...activityList.value,...res.data.list];
|
|
|
activityList.value.forEach(a=>{
|
|
|
let cc = calculateCountdown(a?.signupEndTime);
|
|
|
a.endTimeText = cc===-1?a?.signupEndTime:(`还有${cc.days}天${cc.hours}小时${cc.minutes}分钟`)
|
|
|
})
|
|
|
+ queryParams.value.page++;
|
|
|
+ if(res.data.list.length===0) isOver.value = true;
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -162,15 +184,18 @@
|
|
|
});
|
|
|
},200)
|
|
|
nextTick(()=>{
|
|
|
- getActivityList('')
|
|
|
+ getActivityList()
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
|
|
|
onMounted(()=>{
|
|
|
+ if(uni.getStorageSync('userInfo')){
|
|
|
+ queryParams.value.userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
|
|
|
+ }
|
|
|
getSwiperList()
|
|
|
getTypeList()
|
|
|
- getActivityList('')
|
|
|
+ getActivityList()
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
@@ -269,6 +294,7 @@
|
|
|
width: 100%;
|
|
|
flex: 1;
|
|
|
overflow-y: auto;
|
|
|
+ margin-top: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|