diff --git a/static/app.js b/static/app.js index 70eb3c0..0b2d2ee 100644 --- a/static/app.js +++ b/static/app.js @@ -305,5 +305,115 @@ async function loadRecent() { } } +// ========== 历史记录面板 ========== + +const historyOverlay = document.getElementById('history-overlay'); +const historyList = document.getElementById('history-list'); + +// 打开历史面板 +document.getElementById('view-all').addEventListener('click', () => { + historyOverlay.classList.add('active'); + loadHistory(); +}); + +// 关闭历史面板 +document.getElementById('close-history').addEventListener('click', () => { + historyOverlay.classList.remove('active'); +}); + +// 点击遮罩关闭 +historyOverlay.addEventListener('click', (e) => { + if (e.target === historyOverlay) { + historyOverlay.classList.remove('active'); + } +}); + +async function loadHistory() { + try { + const res = await fetch(`${API_BASE}/api/din?limit=100`); + const records = await res.json(); + + if (records.length === 0) { + historyList.innerHTML = '