fix(dnfs): 移动请求期间禁用按钮防止重复提交

后端 update_note 走 AI 审核耗时较长,confirmMove 期间禁用移动条
与表单按钮,finally 统一恢复
This commit is contained in:
qing committed 2026-07-29 14:37:27 +08:00
1 parent 751866d9c1
commit 3bc4f9720f
1 file changed
+18 -5
+18 -5
View File
@@ -363,7 +363,8 @@ function renderMoveBar() {
movebar.appendChild(cancel_btn);
}
/* by qing — 执行移动:把待移动节点挂到当前层(stack 顶,根为 0) */
/* by qing — 执行移动:把待移动节点挂到当前层(stack 顶,根为 0)。
* 后端 update_note 会走 AI 内容审核,耗时较长,期间禁用移动条与表单按钮防止重复提交 */
async function confirmMove() {
if (moving_node == null) {
return;
@@ -377,10 +378,22 @@ async function confirmMove() {
alert('该节点已在当前层');
return;
}
var result = await moveNode(moving_node.id, target_pid, moving_node.title, moving_node.content);
if (result != null) {
moving_node = null;
renderMoveBar();
// 防重复点击:请求进行中禁用按钮(成功/失败都在 finally 恢复)
movebar.querySelectorAll('button').forEach(function(b) { b.disabled = true; });
input_note_submit.disabled = true;
input_note_clear.disabled = true;
delete_note.disabled = true;
try {
var result = await moveNode(moving_node.id, target_pid, moving_node.title, moving_node.content);
if (result != null) {
moving_node = null;
renderMoveBar();
}
} finally {
movebar.querySelectorAll('button').forEach(function(b) { b.disabled = false; });
input_note_submit.disabled = false;
input_note_clear.disabled = false;
delete_note.disabled = false;
}
}