deving
This commit is contained in:
+26
-1
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user