diff --git a/api/assets.js b/api/assets.js index 21f7c61..da86cac 100644 --- a/api/assets.js +++ b/api/assets.js @@ -1512,13 +1512,17 @@ async function fetchPointsConvertList(pagination, requestOptions, interval) { ); } -async function fetchPointsConvertHistoryListData(month, requestOptions) { +async function fetchPointsConvertHistoryListData( + month, + pagination, + requestOptions, +) { return fetchPayload( createRequestOptions({ url: serviceConfig.ENDPOINTS.pointsConvertHistoryList, - data: { + data: buildPagingRequestData({ month: month, - }, + }, pagination), }, requestOptions), "积分兑换列表加载失败", ); @@ -1621,10 +1625,24 @@ export async function fetchCouponRedeemLinkData(requestOptions) { }; } -export async function fetchPointsConvertHome(month, requestOptions) { +export async function fetchPointsConvertHome( + month, + paginationOrRequestOptions, + requestOptions, +) { + const params = resolvePagingArguments( + paginationOrRequestOptions, + requestOptions, + ); + const pagination = params.pagination; + const mergedRequestOptions = params.requestOptions; const result = await Promise.all([ - fetchHomeBalanceData(requestOptions), - fetchPointsConvertHistoryListData(month, requestOptions), + fetchHomeBalanceData(mergedRequestOptions), + fetchPointsConvertHistoryListData( + month, + pagination, + mergedRequestOptions, + ), ]); const balances = normalizeBalances(result[0]); const records = buildPointsHistoryRecords(result[1]).map(function (item) { @@ -1637,6 +1655,7 @@ export async function fetchPointsConvertHome(month, requestOptions) { return { availablePoints: formatHomeNumber(balances.points, 0), records: records, + pagination: buildPaginationMeta(result[1], pagination), }; } diff --git a/pages.json b/pages.json index 0fda7c9..615be90 100644 --- a/pages.json +++ b/pages.json @@ -40,7 +40,8 @@ "path": "pages/assets/points-convert", "style": { "navigationStyle": "custom", - "backgroundColor": "#191E32" + "backgroundColor": "#191E32", + "enablePullDownRefresh": true } }, { diff --git a/pages/assets/points-convert.vue b/pages/assets/points-convert.vue index ed7dc28..171a7dd 100644 --- a/pages/assets/points-convert.vue +++ b/pages/assets/points-convert.vue @@ -154,6 +154,12 @@ export default { this.hasShown = true; }, + onPullDownRefresh() { + this.resetPagingState(); + this.loadPage(false, 1, { + isPullRefresh: true, + }); + }, onReachBottom() { this.loadMore(); }, @@ -241,9 +247,12 @@ export default { this.resetPagingState(); this.loadPage(true, 1); }, - async loadPage(showLoading, targetPage) { + async loadPage(showLoading, targetPage, extraOptions) { const page = Number(targetPage || 1); const isLoadMore = page > 1; + const options = + extraOptions && typeof extraOptions === "object" ? extraOptions : {}; + const isPullRefresh = Boolean(options.isPullRefresh); if (isLoadMore && this.loadingMore) { return; @@ -294,6 +303,10 @@ export default { if (isLoadMore) { this.loadingMore = false; } + + if (isPullRefresh && typeof uni !== "undefined" && uni.stopPullDownRefresh) { + uni.stopPullDownRefresh(); + } } }, loadMore() { diff --git a/unpackage/dist/build/web/index.html b/unpackage/dist/build/web/index.html deleted file mode 100644 index f3a9a62..0000000 --- a/unpackage/dist/build/web/index.html +++ /dev/null @@ -1,2 +0,0 @@ -