This commit is contained in:
luke 2025-06-22 07:53:32 +08:00
parent 4f0abb304c
commit 2d21940215
4 changed files with 93 additions and 20 deletions

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "渠道应用开发部知识库",
"version": "2.0.9",
"version": "2.0.10",
"description": "通过关键词快速搜索内部文档",
"permissions": ["storage"],
"host_permissions": [

View File

@ -1,16 +1,17 @@
## 修订记录
| 时间 | 版本 | 修订人 | 说明 |
|------------|--------|---------|------------------------------|
| 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工作区配置化 |
| 2025.06.06 | V2.0.3 | Luke.Ye | 添加跳转页面权限校验 |
| 2025.06.09 | V2.0.4 | Luke.Ye | 优化es搜索展示页面 |
| 2025.06.10 | V2.0.5 | Luke.Ye | 移除自动请求智能助手逻辑 |
| 2025.06.16 | V2.0.6 | Luke.Ye | 添加上传文件到对象存储功能 |
| 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.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工作区配置化 |
| 2025.06.06 | V2.0.3 | Luke.Ye | 添加跳转页面权限校验 |
| 2025.06.09 | V2.0.4 | Luke.Ye | 优化es搜索展示页面 |
| 2025.06.10 | V2.0.5 | Luke.Ye | 移除自动请求智能助手逻辑 |
| 2025.06.16 | V2.0.6 | Luke.Ye | 添加上传文件到对象存储功能 |
| 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 | 搜索结果页分页展示优化 |

View File

@ -116,21 +116,51 @@ document.addEventListener("DOMContentLoaded", async () => {
function renderPagination() {
const pagination = document.createElement("div");
pagination.className = "pagination";
// 上一页按钮(始终显示)
const prev = document.createElement("button");
prev.textContent = "上一页";
if (currentPage > 1) {
const prev = document.createElement("button");
prev.textContent = "上一页";
prev.onclick = () => fetchResults(lastKeywords, currentPage - 1);
pagination.appendChild(prev);
} else {
prev.disabled = true;
}
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) {
const next = document.createElement("button");
next.textContent = "下一页";
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;

View File

@ -220,4 +220,46 @@ body.fullscreen .container {
box-sizing: border-box;
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;
}