From 6dabc4d0b76bd3ee7debc33bc2ff7fb17b383c24 Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Tue, 14 Jul 2026 00:54:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=85=E5=AE=B9=E5=BA=93?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 默认每页20条 - 列表上部也添加分页控件,方便翻页 --- static/css/library.css | 13 +++++++++++++ static/js/library.js | 10 ++++++++-- templates/library.html | 10 ++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/static/css/library.css b/static/css/library.css index 208d7b5..1c98faf 100644 --- a/static/css/library.css +++ b/static/css/library.css @@ -263,6 +263,19 @@ color: #4caf50; } +/* 上部分页 */ +.pagination-top { + display: flex; + align-items: center; + gap: 10px; + margin-left: auto; +} + +.pagination-top span { + font-size: 14px; + color: #666; +} + .article-summary { font-size: 14px; color: #666; diff --git a/static/js/library.js b/static/js/library.js index 9fd53bd..bd62171 100644 --- a/static/js/library.js +++ b/static/js/library.js @@ -4,7 +4,7 @@ const API_BASE = ''; // 状态 let articles = []; let currentPage = 1; -let pageSize = 100; +let pageSize = 20; // 默认每页20条 let totalCount = 0; let selectedIds = new Set(); let currentArticleId = null; @@ -157,8 +157,14 @@ function displayArticles() { // 更新分页 function updatePagination() { const totalPages = Math.ceil(totalCount / pageSize); - document.getElementById('page-info').textContent = `第 ${currentPage} / ${totalPages || 1} 页`; + // 更新上部分页 + document.getElementById('page-info-top').textContent = `第 ${currentPage} / ${totalPages || 1} 页`; + document.getElementById('prev-btn-top').disabled = currentPage <= 1; + document.getElementById('next-btn-top').disabled = currentPage >= totalPages; + + // 更新下部分页 + document.getElementById('page-info').textContent = `第 ${currentPage} / ${totalPages || 1} 页`; document.getElementById('prev-btn').disabled = currentPage <= 1; document.getElementById('next-btn').disabled = currentPage >= totalPages; } diff --git a/templates/library.html b/templates/library.html index 1840015..6a72c32 100644 --- a/templates/library.html +++ b/templates/library.html @@ -36,9 +36,9 @@ @@ -69,6 +69,12 @@ 批量删除 + +
+ + 第 1 页 + +