fix: 修复历史记录页面 renderPagination 未定义错误
Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
BIN
assets/image_20260713143207366.png
Normal file
BIN
assets/image_20260713143207366.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -2251,6 +2251,42 @@
|
|||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 渲染分页控件
|
||||||
|
function renderPagination(page, pageSize, total) {
|
||||||
|
const container = document.getElementById('history-pagination');
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
const totalPages = Math.ceil(total / pageSize);
|
||||||
|
if (totalPages <= 1) {
|
||||||
|
container.innerHTML = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let html = '<div class="pagination">';
|
||||||
|
|
||||||
|
// 上一页
|
||||||
|
if (page > 1) {
|
||||||
|
html += `<button onclick="loadHistoryWithDate(${page - 1})">上一页</button>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页码
|
||||||
|
for (let i = 1; i <= totalPages; i++) {
|
||||||
|
if (i === page) {
|
||||||
|
html += `<button class="active">${i}</button>`;
|
||||||
|
} else {
|
||||||
|
html += `<button onclick="loadHistoryWithDate(${i})">${i}</button>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下一页
|
||||||
|
if (page < totalPages) {
|
||||||
|
html += `<button onclick="loadHistoryWithDate(${page + 1})">下一页</button>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</div>';
|
||||||
|
container.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
// 加载历史记录(无日期筛选)
|
// 加载历史记录(无日期筛选)
|
||||||
async function loadHistory(page = 1) {
|
async function loadHistory(page = 1) {
|
||||||
loadHistoryWithDate(page);
|
loadHistoryWithDate(page);
|
||||||
|
|||||||
Reference in New Issue
Block a user