任务归档改为默认显示10条,加载更多按钮显示剩余数,去掉折叠头
This commit is contained in:
@@ -78,16 +78,6 @@ body {
|
|||||||
.search-bar input:focus { border-color: #2a5299; }
|
.search-bar input:focus { border-color: #2a5299; }
|
||||||
.search-cancel { background: none; border: none; color: #2a5299; font-size: 14px; padding: 6px 4px; cursor: pointer; flex: none; }
|
.search-cancel { background: none; border: none; color: #2a5299; font-size: 14px; padding: 6px 4px; cursor: pointer; flex: none; }
|
||||||
.search-tip { color: #8891a5; font-size: 12px; padding: 2px 4px 8px; }
|
.search-tip { color: #8891a5; font-size: 12px; padding: 2px 4px 8px; }
|
||||||
.done-head {
|
|
||||||
display: flex; align-items: center; justify-content: center; gap: 4px;
|
|
||||||
color: #77818f; font-size: 13px; padding: 10px 0 12px; cursor: pointer; user-select: none;
|
|
||||||
}
|
|
||||||
.done-head:active { color: #445; }
|
|
||||||
.done-head .chev {
|
|
||||||
width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2;
|
|
||||||
stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s;
|
|
||||||
}
|
|
||||||
.done-head.open .chev { transform: rotate(180deg); }
|
|
||||||
.load-more {
|
.load-more {
|
||||||
width: 100%; background: none; border: 1px dashed #ccd2dd; border-radius: 10px;
|
width: 100%; background: none; border: 1px dashed #ccd2dd; border-radius: 10px;
|
||||||
color: #667; font-size: 13px; padding: 9px; margin-bottom: 10px; cursor: pointer;
|
color: #667; font-size: 13px; padding: 9px; margin-bottom: 10px; cursor: pointer;
|
||||||
|
|||||||
@@ -284,10 +284,10 @@
|
|||||||
<div class="toast hidden" id="toast"></div>
|
<div class="toast hidden" id="toast"></div>
|
||||||
|
|
||||||
<!-- 发版时更新 v 参数,避免移动端浏览器缓存旧 JS -->
|
<!-- 发版时更新 v 参数,避免移动端浏览器缓存旧 JS -->
|
||||||
<script src="/js/core.js?v=20260901l"></script>
|
<script src="/js/core.js?v=20260901m"></script>
|
||||||
<script src="/js/tasks.js?v=20260901l"></script>
|
<script src="/js/tasks.js?v=20260901m"></script>
|
||||||
<script src="/js/skills.js?v=20260901l"></script>
|
<script src="/js/skills.js?v=20260901m"></script>
|
||||||
<script src="/js/models.js?v=20260901l"></script>
|
<script src="/js/models.js?v=20260901m"></script>
|
||||||
<script src="/js/settings.js?v=20260901l"></script>
|
<script src="/js/settings.js?v=20260901m"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -54,11 +54,10 @@ function showList() {
|
|||||||
}, { passive: true });
|
}, { passive: true });
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// ---------- 会话列表(活跃 + 归档折叠 + 搜索) ----------
|
// ---------- 会话列表(活跃 + 归档分页 + 搜索) ----------
|
||||||
const DONE_PAGE = 20; // 归档每页条数
|
const DONE_PAGE = 10; // 归档每页条数
|
||||||
let activeRows = []; // 当前活跃会话(含排队/保持)
|
let activeRows = []; // 当前活跃会话(含排队/保持)
|
||||||
let searchMode = false; // 搜索模式:列表区显示搜索结果
|
let searchMode = false; // 搜索模式:列表区显示搜索结果
|
||||||
let doneExpanded = false; // 归档区是否展开
|
|
||||||
let doneRows = []; // 已加载的归档行
|
let doneRows = []; // 已加载的归档行
|
||||||
let doneTotal = 0; // 归档总数
|
let doneTotal = 0; // 归档总数
|
||||||
let doneCursor = null; // 下一页游标 {updated_at, id}
|
let doneCursor = null; // 下一页游标 {updated_at, id}
|
||||||
@@ -81,19 +80,15 @@ function sessionCard(s) {
|
|||||||
function renderSessionList() {
|
function renderSessionList() {
|
||||||
const el = $('session-list');
|
const el = $('session-list');
|
||||||
let html = activeRows.map(sessionCard).join('');
|
let html = activeRows.map(sessionCard).join('');
|
||||||
if (doneTotal) {
|
html += doneRows.map(sessionCard).join('');
|
||||||
html += '<div class="done-head' + (doneExpanded ? ' open' : '') + '" onclick="ui.toggleDone()">' +
|
if (!activeRows.length && !doneTotal) {
|
||||||
'已完成/已终止 (' + doneTotal + ')' +
|
|
||||||
'<svg class="chev" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"></polyline></svg></div>';
|
|
||||||
if (doneExpanded) {
|
|
||||||
html += doneRows.map(sessionCard).join('');
|
|
||||||
if (doneRows.length < doneTotal) {
|
|
||||||
html += '<button class="load-more" onclick="ui.loadMoreDone()"' + (doneLoading ? ' disabled' : '') + '>加载更多</button>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!activeRows.length) {
|
|
||||||
html += '<div class="empty-tip">还没有任务,点右上角 + 新建</div>';
|
html += '<div class="empty-tip">还没有任务,点右上角 + 新建</div>';
|
||||||
}
|
}
|
||||||
|
const remain = doneTotal - doneRows.length;
|
||||||
|
if (remain > 0) {
|
||||||
|
// 括号内是剩余未展示的归档数,如总共 100、已显 10 则显示「加载更多(90)」
|
||||||
|
html += '<button class="load-more" onclick="ui.loadMoreDone()"' + (doneLoading ? ' disabled' : '') + '>加载更多(' + remain + ')</button>';
|
||||||
|
}
|
||||||
el.innerHTML = html;
|
el.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +535,6 @@ const ui = {
|
|||||||
logout() { location.href = '/logout'; },
|
logout() { location.href = '/logout'; },
|
||||||
toggleSearch() { toggleSearch(); },
|
toggleSearch() { toggleSearch(); },
|
||||||
doSearch() { doSearch(); },
|
doSearch() { doSearch(); },
|
||||||
toggleDone() { doneExpanded = !doneExpanded; renderSessionList(); },
|
|
||||||
loadMoreDone() { return loadMoreDone(); },
|
loadMoreDone() { return loadMoreDone(); },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user