优化搜索结果页面
This commit is contained in:
parent
81cf6467b3
commit
90255f9db0
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "渠道应用开发部知识库",
|
"name": "渠道应用开发部知识库",
|
||||||
"version": "2.0.3",
|
"version": "2.0.4",
|
||||||
"description": "通过关键词快速搜索内部文档",
|
"description": "通过关键词快速搜索内部文档",
|
||||||
"permissions": ["storage"],
|
"permissions": ["storage"],
|
||||||
"host_permissions": [
|
"host_permissions": [
|
||||||
|
|||||||
@ -7,4 +7,5 @@
|
|||||||
| 2025.06.03 | V2.0.1 | Luke.Ye | 完成llm token过期时间的配置化 |
|
| 2025.06.03 | V2.0.1 | Luke.Ye | 完成llm token过期时间的配置化 |
|
||||||
| 2025.06.03 | V2.0.2 | Luke.Ye | 支持LLM工作区配置化 |
|
| 2025.06.03 | V2.0.2 | Luke.Ye | 支持LLM工作区配置化 |
|
||||||
| 2025.06.06 | V2.0.3 | Luke.Ye | 添加跳转页面权限校验 |
|
| 2025.06.06 | V2.0.3 | Luke.Ye | 添加跳转页面权限校验 |
|
||||||
|
| 2025.06.09 | V2.0.4 | Luke.Ye | 优化es搜索展示页面 |
|
||||||
|
|
||||||
|
|||||||
@ -179,6 +179,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
const filename = doc.filename || doc.title || "未知文件";
|
const filename = doc.filename || doc.title || "未知文件";
|
||||||
const filepath = doc.filepath?.replace(/^import-data\//, "").replace(/\.md$/, ".html") || "";
|
const filepath = doc.filepath?.replace(/^import-data\//, "").replace(/\.md$/, ".html") || "";
|
||||||
|
const mtime = doc.mtime ? formatLocalTime(doc.mtime) : ""; // 格式化时间
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = `${fileBaseUrl}/${filepath || filename}`;
|
link.href = `${fileBaseUrl}/${filepath || filename}`;
|
||||||
link.target = "_blank";
|
link.target = "_blank";
|
||||||
@ -188,8 +189,17 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
snippet.className = "summary";
|
snippet.className = "summary";
|
||||||
snippet.innerHTML = doc.summary?.slice(0, 300) + "...";
|
snippet.innerHTML = doc.summary?.slice(0, 300) + "...";
|
||||||
|
|
||||||
|
// 元信息行
|
||||||
|
const metaRow = document.createElement("div");
|
||||||
|
metaRow.className = "es-meta-row";
|
||||||
|
metaRow.innerHTML = `
|
||||||
|
<span class="es-filepath" title="${filepath}">${filepath}</span>
|
||||||
|
<span class="es-updatetime">${mtime ? "更新时间:" + mtime : ""}</span>
|
||||||
|
`;
|
||||||
|
|
||||||
li.appendChild(link);
|
li.appendChild(link);
|
||||||
li.appendChild(snippet);
|
li.appendChild(snippet);
|
||||||
|
li.appendChild(metaRow);
|
||||||
resultBox.appendChild(li);
|
resultBox.appendChild(li);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -7,3 +7,15 @@ function log(...args) {
|
|||||||
function delay(ms) {
|
function delay(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatLocalTime(ts) {
|
||||||
|
if (!ts) return "";
|
||||||
|
const date = new Date(Number(ts));
|
||||||
|
if (isNaN(date.getTime())) return "";
|
||||||
|
// 格式:2024-06-01 13:47
|
||||||
|
return date.getFullYear() + "-" +
|
||||||
|
String(date.getMonth() + 1).padStart(2, "0") + "-" +
|
||||||
|
String(date.getDate()).padStart(2, "0") + " " +
|
||||||
|
String(date.getHours()).padStart(2, "0") + ":" +
|
||||||
|
String(date.getMinutes()).padStart(2, "0");
|
||||||
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#results .summary {
|
#results .summary {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #444;
|
color: #444;
|
||||||
margin-top: 4px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination {
|
.pagination {
|
||||||
@ -97,3 +97,25 @@
|
|||||||
.tag-history .tag:hover {
|
.tag-history .tag:hover {
|
||||||
background-color: #dcdcdc;
|
background-color: #dcdcdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 搜索结果项小号元信息行 */
|
||||||
|
.es-meta-row {
|
||||||
|
color: #9198ad;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
align-items: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.es-filepath {
|
||||||
|
max-width: 320px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.es-updatetime {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user