fix: 下发工厂页面文案为空时阻止下发并改善错误提示
文案生成失败时不再静默继续,改为 toast 提示错误信息, 并在点击下发前校验 textContent 非空,避免空内容触发后端 500。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
60194d8208
commit
50e1aed63c
@ -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 + " 状态变更为待发厂。",
|
||||
|
||||
@ -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 + " 状态变更为待发厂。",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user