directory-browser.html•6.95 kB
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>评估结果目录浏览器</title>
<style>
body {
margin: 0;
background: #f5f5f5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.container {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
}
.header {
margin-bottom: 30px;
}
.header h1 {
margin: 0 0 10px 0;
color: #333;
}
.header p {
margin: 5px 0;
color: #666;
}
.directory-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.directory-card {
border: 1px solid #ddd;
border-radius: 8px;
padding: 16px;
background: white;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
transition: box-shadow 0.2s;
display: flex;
align-items: center;
justify-content: space-between;
}
.directory-card:hover {
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.directory-info {
display: flex;
align-items: center;
gap: 20px;
flex: 1;
}
.directory-name {
margin: 0;
font-size: 18px;
font-weight: bold;
min-width: 280px;
}
.directory-name a {
text-decoration: none;
color: #007bff;
display: flex;
align-items: center;
gap: 8px;
}
.directory-name a:hover {
color: #0056b3;
}
.stats-grid {
display: flex;
gap: 16px;
align-items: center;
}
.stat-item {
padding: 8px 12px;
border-radius: 6px;
text-align: center;
min-width: 60px;
}
.stat-value {
font-size: 16px;
font-weight: bold;
margin-bottom: 2px;
}
.stat-label {
font-size: 11px;
opacity: 0.8;
}
.total { background: #f8f9fa; color: #333; }
.good { background: #d4edda; color: #155724; }
.bad { background: #f8d7da; color: #721c24; }
.view-button {
background: #007bff;
color: white;
padding: 8px 16px;
border-radius: 4px;
text-decoration: none;
font-size: 14px;
display: inline-block;
transition: background-color 0.2s;
}
.view-button:hover {
background: #0056b3;
}
.meta-info {
font-size: 12px;
color: #888;
margin-top: 8px;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: #666;
}
.empty-state h3 {
margin-bottom: 10px;
color: #999;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>📁 评估结果目录浏览器</h1>
<p><strong>路径:</strong> <span id="root-path">{{ROOT_PATH}}</span></p>
<p><strong>找到 <span id="total-dirs">{{TOTAL_DIRS}}</span> 个评估结果目录</strong></p>
</div>
<div id="directory-list" class="directory-list">
<!-- 目录列表将通过JavaScript动态生成 -->
</div>
<div id="empty-state" class="empty-state" style="display: none;">
<h3>📂 没有找到评估结果目录</h3>
<p>请确保目录中包含有效的 summary.json 文件</p>
</div>
</div>
<script>
// 数据将通过后端注入到 window.directoryData
function renderDirectories() {
const data = window.directoryData;
if (!data) {
console.error('No directory data found');
return;
}
// 更新页面信息
document.getElementById('root-path').textContent = data.rootPath;
document.getElementById('total-dirs').textContent = data.directories.length;
const container = document.getElementById('directory-list');
const emptyState = document.getElementById('empty-state');
if (data.directories.length === 0) {
container.style.display = 'none';
emptyState.style.display = 'block';
return;
}
// 按创建时间倒序排列
const sortedDirectories = [...data.directories].sort((a, b) => {
const timeA = a.summary.create_time || '';
const timeB = b.summary.create_time || '';
return timeB.localeCompare(timeA); // 倒序
});
// 生成目录卡片 - 一行布局
container.innerHTML = sortedDirectories.map(dir => `
<div class="directory-card">
<div class="directory-info">
<h3 class="directory-name">
<a href="${dir.name}.html">
📊 ${dir.name}
</a>
</h3>
<div class="stats-grid">
<div class="stat-item total">
<div class="stat-value">${dir.summary.total || 0}</div>
<div class="stat-label">总数</div>
</div>
<div class="stat-item good">
<div class="stat-value">${dir.summary.num_good || 0}</div>
<div class="stat-label">通过</div>
</div>
<div class="stat-item bad">
<div class="stat-value">${dir.summary.num_bad || 0}</div>
<div class="stat-label">失败</div>
</div>
</div>
<div class="meta-info" style="font-size: 12px; color: #888; min-width: 200px;">
创建: ${dir.summary.create_time || 'N/A'} |
评分: ${typeof dir.summary.score === 'number' ? dir.summary.score.toFixed(1) : '0.0'}%
</div>
</div>
<a href="${dir.name}.html" class="view-button">查看详情 →</a>
</div>
`).join('');
}
// 页面加载完成后渲染
document.addEventListener('DOMContentLoaded', renderDirectories);
</script>
</body>
</html>