opt
This commit is contained in:
parent
4f0abb304c
commit
2d21940215
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "渠道应用开发部知识库",
|
||||
"version": "2.0.9",
|
||||
"version": "2.0.10",
|
||||
"description": "通过关键词快速搜索内部文档",
|
||||
"permissions": ["storage"],
|
||||
"host_permissions": [
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
## 修订记录
|
||||
| 时间 | 版本 | 修订人 | 说明 |
|
||||
|------------|--------|---------|------------------------------|
|
||||
|------------|---------|---------|------------------------------|
|
||||
| 2025.06.02 | V2.0.0 | Luke.Ye | 完成插件配置化改造 |
|
||||
| 2025.06.03 | V2.0.1 | Luke.Ye | 完成llm token过期时间的配置化 |
|
||||
| 2025.06.03 | V2.0.2 | Luke.Ye | 支持LLM工作区配置化 |
|
||||
@ -13,4 +13,5 @@
|
||||
| 2025.06.17 | V2.0.7 | Luke.Ye | 完成上传记录展示 |
|
||||
| 2025.06.19 | V2.0.8 | Luke.Ye | 对象存储上传优化,适配后端新接口 |
|
||||
| 2025.06.20 | V2.0.9 | Luke.Ye | 上传记录页面支持删除历史记录(会同时清空对象存储和ES) |
|
||||
| 2025.06.22 | V2.0.10 | Luke.Ye | 搜索结果页分页展示优化 |
|
||||
|
||||
|
||||
@ -116,21 +116,51 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
function renderPagination() {
|
||||
const pagination = document.createElement("div");
|
||||
pagination.className = "pagination";
|
||||
if (currentPage > 1) {
|
||||
|
||||
// 上一页按钮(始终显示)
|
||||
const prev = document.createElement("button");
|
||||
prev.textContent = "上一页";
|
||||
if (currentPage > 1) {
|
||||
prev.onclick = () => fetchResults(lastKeywords, currentPage - 1);
|
||||
pagination.appendChild(prev);
|
||||
} else {
|
||||
prev.disabled = true;
|
||||
}
|
||||
if (currentPage < totalPages) {
|
||||
pagination.appendChild(prev);
|
||||
|
||||
// 显示页码:前后最多各2个,加当前页(共5个)
|
||||
const maxPages = 5;
|
||||
let start = Math.max(1, currentPage - 2);
|
||||
let end = Math.min(totalPages, start + maxPages - 1);
|
||||
if (end - start < maxPages - 1) {
|
||||
start = Math.max(1, end - maxPages + 1);
|
||||
}
|
||||
|
||||
for (let i = start; i <= end; i++) {
|
||||
const pageBtn = document.createElement("button");
|
||||
pageBtn.textContent = i;
|
||||
if (i === currentPage) {
|
||||
pageBtn.className = "active-page";
|
||||
} else {
|
||||
pageBtn.onclick = () => fetchResults(lastKeywords, i);
|
||||
}
|
||||
pagination.appendChild(pageBtn);
|
||||
}
|
||||
|
||||
// 下一页按钮(始终显示)
|
||||
const next = document.createElement("button");
|
||||
next.textContent = "下一页";
|
||||
if (currentPage < totalPages) {
|
||||
next.onclick = () => fetchResults(lastKeywords, currentPage + 1);
|
||||
pagination.appendChild(next);
|
||||
} else {
|
||||
next.disabled = true;
|
||||
}
|
||||
pagination.appendChild(next);
|
||||
|
||||
resultBox.appendChild(pagination);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function fetchResults(rawInput, page) {
|
||||
currentPage = page;
|
||||
lastKeywords = rawInput;
|
||||
|
||||
@ -221,3 +221,45 @@ body.fullscreen .container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 分页按钮通用样式 */
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 16px;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.pagination button {
|
||||
padding: 6px 12px;
|
||||
font-size: 14px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
min-width: 36px;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background-color: #e6f0ff;
|
||||
}
|
||||
|
||||
.pagination button:disabled {
|
||||
background-color: #eaeaea;
|
||||
color: #999;
|
||||
border-color: #ccc;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* 当前页高亮样式 */
|
||||
.pagination .active-page {
|
||||
background-color: #007bff !important;
|
||||
color: white !important;
|
||||
border-color: #007bff !important;
|
||||
font-weight: bold;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user