This commit is contained in:
cjw
2026-02-16 01:52:25 +08:00
parent 5c8765326a
commit 0f0e397110
2 changed files with 9 additions and 22 deletions
+8 -21
View File
@@ -568,27 +568,14 @@ function hideError() {
errorMessage.style.display = 'none'; errorMessage.style.display = 'none';
} }
// 通过POST请求跳转到历史页面 // 跳转到历史页面
async function goToHistory() { function goToHistory() {
try { // 创建表单进行POST请求跳转,更安全
const response = await fetch('/history', { const form = document.createElement('form');
method: 'POST', form.method = 'POST';
headers: { form.action = '/history';
'Content-Type': 'application/json' document.body.appendChild(form);
} form.submit();
});
if (response.ok) {
// 如果返回的是HTML页面,直接重定向
window.location.href = '/history';
} else {
throw new Error('跳转失败');
}
} catch (error) {
console.error('跳转到历史页面失败:', error);
// 如果POST失败,尝试直接GET跳转
window.location.href = '/history';
}
} }
// 添加显示函数 // 添加显示函数
+1 -1
View File
@@ -117,7 +117,7 @@
<div style="display: flex; justify-content: space-between; align-items: center;"> <div style="display: flex; justify-content: space-between; align-items: center;">
<p>PythonOCC 可用: {{ pythonocc_available }} | 服务版本: 3.0.0</p> <p>PythonOCC 可用: {{ pythonocc_available }} | 服务版本: 3.0.0</p>
<div> <div>
<button class="upload-btn" onclick="goToHistory()" style="background: linear-gradient(135deg, #666, #555); margin-left: 10px;"> <button class="upload-btn" onclick="goToHistory()" style="margin-left: 10px;">
📋 查看历史记录 📋 查看历史记录
</button> </button>
</div> </div>