优化内容库分页
- 默认每页20条 - 列表上部也添加分页控件,方便翻页
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user