From 787502b88d4453813ac716c3b27ff1976d537bc8 Mon Sep 17 00:00:00 2001 From: shufeng2012 <277665039@qq.com> Date: Fri, 24 Jul 2026 09:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E8=8A=82=E7=82=B9=E5=90=8E=E6=B2=A1=E6=9C=89=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/public/js/dnfs.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/static/public/js/dnfs.js b/static/public/js/dnfs.js index 52aa2cb..e857cb5 100644 --- a/static/public/js/dnfs.js +++ b/static/public/js/dnfs.js @@ -5,7 +5,7 @@ */ async function getNode(token, id) { try { - obj = { "pid": String(id) } + obj = { "pid": id } jsonBody = JSON.stringify(obj) console.log(jsonBody) const res = await fetch('/get_notes', { @@ -55,7 +55,7 @@ async function getNode(token, id) { async function addNode(token, pid, title, content) { try { obj = { - "pid": String(pid), + "pid": pid, "title": title, "content": content } @@ -82,9 +82,11 @@ async function addNode(token, pid, title, content) { } if (!res.ok) { - throw new Error(result.message || `添加节点失败(HTTP ${res.status})`); + throw new Error(`添加节点失败(HTTP ${res.status})`); } + input_note_title.value = ""; + input_note_content.value = ""; getNode(token, stack[stack.length - 1]).then(load_notes); //if (result.success) { @@ -105,7 +107,7 @@ async function addNode(token, pid, title, content) { async function deleteNode(token, id) { try { - obj = {"id": String(id)}; + obj = {"id": id}; jsonBody = JSON.stringify(obj); console.log(jsonBody); @@ -169,8 +171,8 @@ input_note_submit.addEventListener('click', function(event) { var title = input_note_title.value var content = input_note_content.value var pid = (stack.length == 0) ? 0 : stack[stack.length - 1]; - alert(stack.length) - alert(pid) + //alert(stack.length) + //alert(pid) addNode(token, pid, title, content).then(result => { alert(result.message); })