This commit is contained in:
cjw
2026-02-16 16:25:32 +08:00
parent 008f3f24f3
commit 49d6e0376a
5 changed files with 157 additions and 174 deletions
+11 -34
View File
@@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分析结果 - STP文件几何分析工具</title>
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/style.css?v=10">
<style>
.result-container {
max-width: 1200px;
@@ -106,20 +106,12 @@
display: grid;
gap: 10px;
}
.data-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
border-bottom: 1px solid #f5f5f5;
}
.data-label {
font-weight: bold;
color: #666;
}
.data-value {
color: #333;
text-align: right;
@@ -181,38 +173,23 @@
</div>
<script>
// 从URL获取任务ID
const pathParts = window.location.pathname.split('/');
const taskId = pathParts[pathParts.length - 1];
// 页面加载完成后获取任务数据
// 从模板获取任务数据
const task = {{ task | tojson | safe }};
// 页面加载完成后显示任务数据
document.addEventListener('DOMContentLoaded', function() {
loadTaskData(taskId);
});
async function loadTaskData(taskId) {
try {
const response = await fetch(`/status/${taskId}`);
if (!response.ok) {
throw new Error('获取任务数据失败');
}
const task = await response.json();
if (task && task.task_id) {
displayTaskInfo(task);
displayResults(task);
} catch (error) {
} else {
document.getElementById('taskInfo').innerHTML = `
<div class="error-message">
<h3>❌ 加载失败</h3>
<p>${error.message}</p>
<button class="upload-btn" onclick="loadTaskData('${taskId}')">
重试
</button>
<p>无法获取任务数据</p>
</div>
`;
}
}
});
function displayTaskInfo(task) {
const taskInfo = document.getElementById('taskInfo');