fix(pagination): 统一表格分页与密钥查询交互

统一各中心表格的分页样式与切换行为,保留密钥筛选条件和兑换码搜索分页。

验证:871 项单测、ESLint、Prettier 和本地浏览器验收通过。
This commit is contained in:
zhanjunhao
2026-11-20 12:52:45 +08:00
parent 83de6cfcbf
commit 6d06971bb4
32 changed files with 416 additions and 401 deletions
+2 -40
View File
@@ -1051,55 +1051,17 @@ export const createCardProPagination = ({
total,
onPageChange,
onPageSizeChange,
isMobile = false,
pageSizeOpts = [10, 20, 50, 100],
showSizeChanger = true,
showRange = true,
preventPageChangeOnPageSizeChange = false,
t = i18next.t.bind(i18next),
}) => {
if (!total || total <= 0) return null;
const unified =
typeof window !== 'undefined' &&
/^\/(console|org)(\/|$)/.test(window.location?.pathname || '');
const start = (currentPage - 1) * pageSize + 1;
const end = Math.min(currentPage * pageSize, total);
const totalText = t('显示第 {{start}} 条 - 第 {{end}} 条,共 {{total}} 条', {
start,
end,
total,
});
return (
<>
{/* 桌面端左侧总数信息 */}
{!unified && !isMobile && showRange && (
<span
className='text-sm select-none'
style={{ color: 'var(--ui-color-text-2)' }}
>
{totalText}
</span>
)}
{/* 右侧分页控件 */}
total > 0 && (
<Pagination
className={!isMobile && (unified || !showRange) ? 'ml-auto' : undefined}
currentPage={currentPage}
pageSize={pageSize}
total={total}
pageSizeOpts={pageSizeOpts}
showSizeChanger={showSizeChanger}
onPageSizeChange={onPageSizeChange}
onPageChange={onPageChange}
preventPageChangeOnPageSizeChange={preventPageChangeOnPageSizeChange}
size={unified || isMobile ? 'small' : 'default'}
showQuickJumper={isMobile}
showTotal={unified ? (total) => t('共 {{total}} 条', { total }) : true}
/>
</>
)
);
};