分页组件添加功能计算未加载的项的数目,click查看捐款记录跳转到捐款列表页面

This commit is contained in:
WindowBird 2025-08-29 16:29:27 +08:00
parent a79bd2c500
commit 13d2323190
2 changed files with 19 additions and 9 deletions

View File

@ -36,6 +36,7 @@ export function createPagination(options = {}) {
currentPage: 1, currentPage: 1,
pageSize, pageSize,
totalPages: 0, totalPages: 0,
remainingItems: 0,
}, },
// 上拉加载相关 // 上拉加载相关
@ -94,6 +95,10 @@ export function createPagination(options = {}) {
currentPage: this.winB_QueryParams.pageNum, currentPage: this.winB_QueryParams.pageNum,
pageSize, pageSize,
totalPages: Math.ceil(total / pageSize), totalPages: Math.ceil(total / pageSize),
remainingItems: Math.max(
0,
total - this.winB_QueryParams.pageNum * pageSize,
),
}; };
// 检查是否还有更多数据 // 检查是否还有更多数据

View File

@ -38,7 +38,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="record" <view class="record" @click="goDonationRecord"
>查看捐款记录 >查看捐款记录
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</view> </view>
@ -71,7 +71,7 @@
</view> </view>
</view> </view>
<view v-if="winB_NoMore === false" class="more" @click="loadMore" <view v-if="winB_NoMore === false" class="more" @click="loadMore"
>查看更多{{ remainingItems }}条进展 >查看更多{{ winB_Pagination.remainingItems }}条进展
</view> </view>
<view v-else class="more">到底了</view> <view v-else class="more">到底了</view>
</view> </view>
@ -243,13 +243,18 @@ export default {
loadMore() { loadMore() {
this.winB_LoadMore(); this.winB_LoadMore();
}, },
}, goDonationRecord() {
computed: { // ID
remainingItems() { uni.navigateTo({
return ( url: `/pages/institutionalStructure/donationRecord?formedId=${this.formedId}`,
this.winB_Pagination.total - fail: (err) => {
this.winB_Pagination.currentPage * this.winB_Pagination.pageSize console.error("跳转失败:", err);
); uni.showToast({
title: "页面跳转失败",
icon: "none",
});
},
});
}, },
}, },
}; };