From 6f136a31f10024eefa3c994b0bd9c796355770d8 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Fri, 17 Apr 2026 13:13:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=80=E6=9C=89=20API=20=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=94=B9=E4=B8=BA=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=20/api=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=8C=89=E9=92=AE=E6=97=A0?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/static/app.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/web/static/app.js b/web/static/app.js index 7ef8433..a17f5f4 100644 --- a/web/static/app.js +++ b/web/static/app.js @@ -98,7 +98,7 @@ function toggleScheduler() { if (btn.classList.contains('stopped')) { // 当前已停止,启动 - fetch(API_BASE + '/api/scheduler/start', {method: 'POST'}) + fetch('/api/scheduler/start', {method: 'POST'}) .then(function(res) { return res.json(); }) .then(function(data) { if (data.success) { @@ -115,7 +115,7 @@ function toggleScheduler() { .catch(function(e) { showToast('错误: ' + e.message, 3000); }); } else { // 当前运行中,停止 - fetch(API_BASE + '/api/scheduler/stop', {method: 'POST'}) + fetch('/api/scheduler/stop', {method: 'POST'}) .then(function(res) { return res.json(); }) .then(function(data) { if (data.success) { @@ -148,27 +148,27 @@ function updateToggleButton(running) { } function captureNow() { - fetch(API_BASE + '/api/capture', {method: 'POST'}) + fetch('/api/capture', {method: 'POST'}) .then(function(res) { return res.json(); }) .then(function(data) { if (data.success) { - showToast('Captured! ID: ' + data.image_id, 1500); + showToast('拍照成功!ID: ' + data.image_id, 1500); refreshAll(); } else { - showToast('Failed: ' + data.error, 3000); + showToast('拍照失败: ' + data.error, 3000); } }) - .catch(function(e) { showToast('Error: ' + e.message, 3000); }); + .catch(function(e) { showToast('错误: ' + e.message, 3000); }); } function analyzeUnanalyzed() { - fetch(API_BASE + '/api/analyze/unanalyzed', {method: 'POST'}) + fetch('/api/analyze/unanalyzed', {method: 'POST'}) .then(function(res) { return res.json(); }) .then(function(data) { - showToast('Analyzed ' + data.results.length + ' images', 1500); + showToast('分析了 ' + data.results.length + ' 张图片', 1500); refreshAll(); }) - .catch(function(e) { showToast('Error: ' + e.message, 3000); }); + .catch(function(e) { showToast('错误: ' + e.message, 3000); }); } // Images