diff --git a/src/pages/management/CustomerDataCharts.vue b/src/pages/management/CustomerDataCharts.vue index bf484e0..c18e8ac 100644 --- a/src/pages/management/CustomerDataCharts.vue +++ b/src/pages/management/CustomerDataCharts.vue @@ -80,6 +80,7 @@ class="rank-refresh" :refresh-timeout="30000" @refresh="refreshCustomerRegistrationRank" + @scrolltolower="loadNextRankPage" >
@@ -89,7 +90,7 @@ theme="card" >
-
- 上一页 - - 下一页 -
+
{ } return `范围:${rankDateFilterLabel.value}|${rankRegistrationEventFilterLabel.value}`; }); -const paginatedCustomerRegistrationRankList = computed(() => { - const startIndex = (rankPageIndex.value - 1) * rankPageSize; - return customerRegistrationRankList.value.slice(startIndex, startIndex + rankPageSize); +const visibleCustomerRegistrationRankList = computed(() => { + return customerRegistrationRankList.value.slice(0, rankPageIndex.value * rankPageSize); }); const rankPageCount = computed(() => Math.max(1, Math.ceil(customerRegistrationRankList.value.length / rankPageSize))); -const rankPaginationVisible = computed(() => 1 < rankPageCount.value); +const rankCanLoadMore = computed(() => rankPageIndex.value < rankPageCount.value); watch(chartList, async () => { await nextTick(); @@ -524,6 +510,7 @@ async function loadCustomerRegistrationRank(force = false): Promise { const token = rankRequestToken + 1; rankRequestToken = token; + rankPageIndex.value = 1; rankLoading.value = true; let request = force ? undefined : rankPendingRequestMap.get(cacheKey); if (!request) { @@ -563,12 +550,11 @@ async function refreshCustomerRegistrationRank(): Promise { } } -function changeRankPage(offset: number): void { - const nextPage = rankPageIndex.value + offset; - if (nextPage < 1 || rankPageCount.value < nextPage) { +function loadNextRankPage(): void { + if (!rankCanLoadMore.value || rankLoading.value) { return; } - rankPageIndex.value = nextPage; + rankPageIndex.value += 1; } async function selectRankDateFilter(value: DropdownValue): Promise { @@ -1035,16 +1021,11 @@ function parseRankDateTime(value: string, isEnd: boolean): Date { } } - .rank-pagination { - gap: .75rem; - display: flex; - align-items: center; - justify-content: center; - - .page { - color: #52607a; - font-size: .875rem; - } + .rank-load-state { + padding: .25rem 0; + color: #52607a; + font-size: .875rem; + text-align: center; } .chart-section { @@ -1147,10 +1128,8 @@ function parseRankDateTime(value: string, isEnd: boolean): Date { background: rgba(30, 41, 59, .9); } - .rank-pagination { - .page { - color: #94a3b8; - } + .rank-load-state { + color: #94a3b8; } }