From d18e80016b2bf72c6dc844a467609a19237c3302 Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Tue, 14 Jul 2026 12:33:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=A4=84=E7=90=86=E5=90=AF=E5=8A=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 首页点击处理现在使用新的处理监控流程 - 处理启动后自动跳转到处理监控页面 - 首页添加'处理监控'入口按钮 - 修复错误消息显示 undefined 的问题 --- static/js/app.js | 21 +++++++++++++-------- templates/index.html | 3 +++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index 570088a..b915c97 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -396,30 +396,35 @@ async function processProduct(productName, category, subcategory) { return; } + showToast('正在启动处理...', ''); + try { - const response = await fetch(`${API_BASE}/api/products/process`, { + const response = await fetch(`${API_BASE}/api/process/start`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ product_name: productName, - category: category, - subcategory: subcategory + category: category || '', + subcategory: subcategory || '' }) }); const data = await response.json(); if (data.success) { - showToast(data.message, 'success'); - if (data.new_products && data.new_products.length > 0) { - showToast(`发现 ${data.new_products.length} 个新产品`, 'success'); - } + showToast('处理流程已启动', 'success'); + // 跳转到处理监控页面 + setTimeout(() => { + window.location.href = '/process'; + }, 1000); } else { - showToast('处理失败: ' + data.error || data.message, 'error'); + const errorMsg = data.error || data.message || '未知错误'; + showToast('处理失败: ' + errorMsg, 'error'); } refreshData(); } catch (error) { + console.error('处理产品失败:', error); showToast('处理产品失败', 'error'); } } diff --git a/templates/index.html b/templates/index.html index c3fe40c..90debf5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,6 +13,9 @@

参数数据自动化管理系统

+ + 处理监控 +