From 8e4e3de974cfd1f0a28a46db296f68e13aa42279 Mon Sep 17 00:00:00 2001 From: ABAPPLO <1134226402@qq.com> Date: Thu, 27 Aug 2026 19:17:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20KOC=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=B1=95=E7=A4=BA=EF=BC=88=E6=AF=8F=E9=A1=B5?= =?UTF-8?q?15=E4=B8=AA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin-app.tsx | 85 +++++++++++++++++++++++++++++++++++++++++++---- app/globals.css | 43 ++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 7 deletions(-) diff --git a/app/admin-app.tsx b/app/admin-app.tsx index 607c48a..39d441a 100644 --- a/app/admin-app.tsx +++ b/app/admin-app.tsx @@ -3171,6 +3171,22 @@ function ScreenshotTaskTable({ distributions }: { distributions: Distribution[] ); } +const RESOURCE_PAGE_SIZE = 15; + +function pageList(current: number, total: number): Array { + if (total <= 7) { + return Array.from({ length: total }, (_, index) => index + 1); + } + const items: Array = [1]; + const start = Math.max(2, current - 1); + const end = Math.min(total - 1, current + 1); + if (start > 2) items.push("gap"); + for (let page = start; page <= end; page += 1) items.push(page); + if (end < total - 1) items.push("gap"); + items.push(total); + return items; +} + function ResourcesPage({ accounts, distributions, @@ -3188,6 +3204,7 @@ function ResourcesPage({ const [platformFilter, setPlatformFilter] = useState("全部平台"); const [ipFilter, setIpFilter] = useState(""); const [sourceFilter, setSourceFilter] = useState(""); + const [page, setPage] = useState(1); const [importOpen, setImportOpen] = useState(false); const [importMode, setImportMode] = useState<"bulk" | "single">("bulk"); const [importFile, setImportFile] = useState(null); @@ -3307,11 +3324,21 @@ function ResourcesPage({ platformFilter !== "全部平台" || Boolean(ipFilter.trim()) || Boolean(sourceFilter.trim()); + const totalPages = Math.max( + 1, + Math.ceil(filteredAccounts.length / RESOURCE_PAGE_SIZE), + ); + const currentPage = Math.min(page, totalPages); + const pagedAccounts = filteredAccounts.slice( + (currentPage - 1) * RESOURCE_PAGE_SIZE, + currentPage * RESOURCE_PAGE_SIZE, + ); const clearFilters = () => { setQuery(""); setPlatformFilter("全部平台"); setIpFilter(""); setSourceFilter(""); + setPage(1); }; const closeImport = () => { if (importWorking || singleWorking) return; @@ -3569,7 +3596,10 @@ function ResourcesPage({
@@ -3577,7 +3607,10 @@ function ResourcesPage({ @@ -3590,7 +3623,10 @@ function ResourcesPage({ setQuery(event.target.value)} + onChange={(event) => { + setQuery(event.target.value); + setPage(1); + }} placeholder="搜索账号名称 / 账号ID / 当前联系人 / 标签" type="search" value={query} @@ -3601,7 +3637,10 @@ function ResourcesPage({ setIpFilter(event.target.value)} + onChange={(event) => { + setIpFilter(event.target.value); + setPage(1); + }} placeholder="搜索IP地区" type="search" value={ipFilter} @@ -3615,7 +3654,10 @@ function ResourcesPage({ setSourceFilter(event.target.value)} + onChange={(event) => { + setSourceFilter(event.target.value); + setPage(1); + }} placeholder="搜索合作来源" type="search" value={sourceFilter} @@ -3634,7 +3676,7 @@ function ResourcesPage({ 清空筛选
- 共 {filteredAccounts.length} 个结果 + 共 {filteredAccounts.length} 个结果{totalPages > 1 ? ` · 第 ${currentPage}/${totalPages} 页` : ""}
}
- {filteredAccounts.map(({ account, sources, partnerManagedOnly }) => { + {pagedAccounts.map(({ account, sources, partnerManagedOnly }) => { const profileLink = resourceProfileLink(account); const accountTags = (account.tags || "") .split(/[,,、;;|]/) @@ -3762,6 +3804,35 @@ function ResourcesPage({
)} + {totalPages > 1 && ( +
+ + {pageList(currentPage, totalPages).map((item, index) => + item === "gap" ? ( + … + ) : ( + + ), + )} + +
+ )} {editAccount && (
diff --git a/app/globals.css b/app/globals.css index 9b237bc..5c67e68 100644 --- a/app/globals.css +++ b/app/globals.css @@ -2577,6 +2577,49 @@ a { font-size: 11px; } +.resource-pagination { + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + padding-top: 18px; +} + +.resource-pagination button { + min-width: 30px; + height: 30px; + padding: 0 10px; + border: 1px solid transparent; + border-radius: 8px; + color: #66736f; + background: transparent; + font-size: 11px; + font-weight: 600; + cursor: pointer; +} + +.resource-pagination button:hover:not(:disabled) { + background: #f0f4f2; +} + +.resource-pagination button.active { + color: #34443f; + background: white; + border-color: #dce2de; + box-shadow: 0 1px 3px rgb(18 31 28 / 0.08); +} + +.resource-pagination button:disabled { + color: #b7c1bd; + cursor: default; +} + +.resource-pagination .gap { + color: #9aa4a0; + font-size: 11px; + padding: 0 2px; +} + .resource-import-modal { width: min(780px, calc(100vw - 32px)); max-height: min(86vh, 820px);