修复一些bug

This commit is contained in:
2025-11-09 20:28:17 +08:00
parent 48bb1b3c12
commit e650a087ca
3 changed files with 79 additions and 3 deletions

View File

@@ -99,7 +99,7 @@
<p>您确定要删除这条数据吗?此操作不可撤销。</p>
<div class="modal-actions">
<button onclick="closeDeleteModal()" class="btn btn-secondary">取消</button>
<form id="deleteForm" method="POST" style="display: inline;">
<form id="deleteForm" method="POST" style="display: inline;" onsubmit="handleDeleteSubmit(event)">
<button type="submit" class="btn btn-danger">确认删除</button>
</form>
</div>
@@ -470,6 +470,23 @@ function closeDeleteModal() {
document.getElementById('deleteModal').style.display = 'none';
}
// 处理删除表单提交
function handleDeleteSubmit(event) {
// 关闭模态框
closeDeleteModal();
// 显示删除中的提示
const submitButton = event.target.querySelector('button[type="submit"]');
const originalText = submitButton.textContent;
submitButton.textContent = '删除中...';
submitButton.disabled = true;
// 提交表单后自动刷新页面
setTimeout(function() {
window.location.reload();
}, 1000); // 1秒后刷新页面给服务器处理时间
}
// 点击模态框外部关闭
window.onclick = function(event) {
const imageModal = document.getElementById('imageModal');