From 50e1aed63cfa4e201c2f3410b96fd624ed3d9a21 Mon Sep 17 00:00:00 2001 From: taiyi Date: Sun, 7 Jun 2026 11:01:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8B=E5=8F=91=E5=B7=A5=E5=8E=82?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=87=E6=A1=88=E4=B8=BA=E7=A9=BA=E6=97=B6?= =?UTF-8?q?=E9=98=BB=E6=AD=A2=E4=B8=8B=E5=8F=91=E5=B9=B6=E6=94=B9=E5=96=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文案生成失败时不再静默继续,改为 toast 提示错误信息, 并在点击下发前校验 textContent 非空,避免空内容触发后端 500。 Co-Authored-By: Claude Opus 4.7 (1M context) --- .../mini-app/pages/manager/supplier-text/supplier-text.js | 7 ++++++- frontend/mini-manager/pages/supplier-text.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/mini-app/pages/manager/supplier-text/supplier-text.js b/frontend/mini-app/pages/manager/supplier-text/supplier-text.js index c244705..6125052 100644 --- a/frontend/mini-app/pages/manager/supplier-text/supplier-text.js +++ b/frontend/mini-app/pages/manager/supplier-text/supplier-text.js @@ -95,7 +95,8 @@ Page({ that.setData({ textContent: data.text_content, templateType: data.template_type, actionLoading: false }); } }).catch(function (error) { - that.setData({ textContent: "", actionLoading: false, message: error.message || "加载失败" }); + that.setData({ textContent: "", actionLoading: false }); + wx.showToast({ title: error.message || "加载失败", icon: "none" }); }); }, @@ -106,6 +107,10 @@ Page({ handleCopyAndSend: function () { var that = this; if (!that.data.currentOrderId || !that.data.currentSupplierId) return; + if (!that.data.textContent || !that.data.textContent.trim()) { + wx.showToast({ title: "文案内容为空,无法下发", icon: "none" }); + return; + } wx.showModal({ title: "确认下发", content: "即将复制文案到剪贴板,并将订单 " + that.data.currentOrderNo + " 状态变更为待发厂。", diff --git a/frontend/mini-manager/pages/supplier-text.js b/frontend/mini-manager/pages/supplier-text.js index c244705..6125052 100644 --- a/frontend/mini-manager/pages/supplier-text.js +++ b/frontend/mini-manager/pages/supplier-text.js @@ -95,7 +95,8 @@ Page({ that.setData({ textContent: data.text_content, templateType: data.template_type, actionLoading: false }); } }).catch(function (error) { - that.setData({ textContent: "", actionLoading: false, message: error.message || "加载失败" }); + that.setData({ textContent: "", actionLoading: false }); + wx.showToast({ title: error.message || "加载失败", icon: "none" }); }); }, @@ -106,6 +107,10 @@ Page({ handleCopyAndSend: function () { var that = this; if (!that.data.currentOrderId || !that.data.currentSupplierId) return; + if (!that.data.textContent || !that.data.textContent.trim()) { + wx.showToast({ title: "文案内容为空,无法下发", icon: "none" }); + return; + } wx.showModal({ title: "确认下发", content: "即将复制文案到剪贴板,并将订单 " + that.data.currentOrderNo + " 状态变更为待发厂。",