// static/history.js // 页面加载完成后加载历史记录 document.addEventListener('DOMContentLoaded', function() { loadHistory(); }); async function loadHistory() { const fileList = document.getElementById('fileList'); try { const response = await fetch('/api/history', { method: 'POST' }); if (!response.ok) { throw new Error('获取历史记录失败'); } const data = await response.json(); if (data.files && data.files.length > 0) { displayFileList(data.files); } else { fileList.innerHTML = `
还没有上传过STP文件
${error.message}
正在加载记录详情...
暂无详细记录
❌ 加载失败: ${error.message}