This commit is contained in:
cjw
2026-02-16 01:32:13 +08:00
parent c7de90d774
commit 8cc92601a7
5 changed files with 42 additions and 4 deletions
+26 -1
View File
@@ -143,7 +143,9 @@ async function uploadFile() {
async function pollTaskStatus(taskId) {
try {
const response = await fetch(`/status/${taskId}`);
const response = await fetch(`/status/${taskId}`, {
method: 'POST'
});
const task = await response.json();
console.log('任务状态:', task.status);
@@ -566,6 +568,29 @@ function hideError() {
errorMessage.style.display = 'none';
}
// 通过POST请求跳转到历史页面
async function goToHistory() {
try {
const response = await fetch('/history', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
if (response.ok) {
// 如果返回的是HTML页面,直接重定向
window.location.href = '/history';
} else {
throw new Error('跳转失败');
}
} catch (error) {
console.error('跳转到历史页面失败:', error);
// 如果POST失败,尝试直接GET跳转
window.location.href = '/history';
}
}
// 添加显示函数
function displayCavityData(cavityData) {
const cavityDiv = document.getElementById('cavityData');