From 8add3ceaa4c2e2f07ce01217393a750281977467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Sun, 6 Sep 2026 01:46:49 +0800 Subject: [PATCH] =?UTF-8?q?task-272(=E9=AA=8C=E6=94=B6=E5=8F=8D=E9=A6=88):?= =?UTF-8?q?=20=E5=88=86=E7=BB=84/=E8=BD=AF=E4=BB=B6=E7=89=88=E6=9C=AC/?= =?UTF-8?q?=E7=B1=BB=E7=9B=AE=E6=90=9C=E7=B4=A2=E8=A1=A8=E8=A1=A5=E9=BD=90?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E7=BB=84=E4=BB=B6(prev/next=20=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E7=94=B1=20locale=20=E6=8F=90=E4=BE=9B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/account/GroupsPage.vue | 14 ++++- .../src/pages/asin/ProductCategoryPage.vue | 11 ++-- .../records/RecordsSoftwareVersionPage.vue | 16 ++++- .../tests/align-pagination.test.ts | 58 +++++++++++++++++++ 4 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 admin-frontend-vue/tests/align-pagination.test.ts diff --git a/admin-frontend-vue/src/pages/account/GroupsPage.vue b/admin-frontend-vue/src/pages/account/GroupsPage.vue index 0e5ea66a..fc51646d 100644 --- a/admin-frontend-vue/src/pages/account/GroupsPage.vue +++ b/admin-frontend-vue/src/pages/account/GroupsPage.vue @@ -16,6 +16,15 @@ const editingGroup = ref(null) const summary = computed(() => shopGroupSummary(rows.value)) const isSuperAdmin = computed(() => session.isSuperAdmin) const currentUserId = computed(() => session.user?.id ?? null) +// 客户端分页:全量拉取后按页切片展示。 +const page = ref(1) +const pageSize = 10 +const total = computed(() => rows.value.length) +const pagedRows = computed(() => rows.value.slice((page.value - 1) * pageSize, page.value * pageSize)) + +function changePage(p: number) { + page.value = p +} function canEditOf(group: ShopGroupItem): boolean { if (isSuperAdmin.value) return true @@ -87,7 +96,7 @@ onMounted(loadGroups) - + @@ -113,6 +122,9 @@ onMounted(loadGroups) + { searchLoading.value = true try { const result = await searchProductCategories(keyword.value, page, PRODUCT_CATEGORY_DEFAULT_PAGE_SIZE) - searchRows.value = page === 1 ? result.items : [...searchRows.value, ...result.items] + // 分页换页模式:每页独立展示当前页结果(对齐列表统一分页交互)。 + searchRows.value = result.items searchTotal.value = result.total searchPage.value = result.page searchHasMore.value = result.hasMore @@ -158,8 +159,8 @@ function reset(): void { void loadTree() } -function loadMore(): void { - void runSearch(searchPage.value + 1) +function searchChangePage(p: number): void { + void runSearch(p) } function openCreate(parent: ProductCategoryNode | null) { @@ -350,8 +351,8 @@ onMounted(loadTree) -
- 加载更多搜索结果 + diff --git a/admin-frontend-vue/src/pages/records/RecordsSoftwareVersionPage.vue b/admin-frontend-vue/src/pages/records/RecordsSoftwareVersionPage.vue index 90838097..3468460e 100644 --- a/admin-frontend-vue/src/pages/records/RecordsSoftwareVersionPage.vue +++ b/admin-frontend-vue/src/pages/records/RecordsSoftwareVersionPage.vue @@ -1,7 +1,7 @@