From 2885a97a79ce0ac8ef69ac3f978e3814376c4552 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期一, 20 十月 2025 14:28:59 +0800
Subject: [PATCH] 优化报错逻辑
---
components/mold.vue | 36 ++++++++++++------------------------
1 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/components/mold.vue b/components/mold.vue
index 80c67ad..de5a74d 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -275,18 +275,12 @@
headers: { 'Content-Type': 'application/json' }
});
if (res.data && res.data.outMsg) {
- if (res.data.outMsg === '閲嶅涓婁笅鍒�') {
- uni.showToast({
- title: res.data.outMsg,
- icon: 'error'
- });
- return; // 鎶ラ敊鏃朵笉鍐嶇户缁�
- } else {
- uni.showToast({
- title: res.data.outMsg,
- icon: 'none'
- });
- }
+ const isRepeat = res.data.outMsg === '閲嶅涓婁笅鍒�';
+ uni.showToast({
+ title: res.data.outMsg,
+ icon: isRepeat ? 'error' : 'none'
+ });
+ if (isRepeat) return; // 鎶ラ敊鏃朵笉鍐嶇户缁�
} else if (res.status === 0) {
uni.showToast({
title: '涓嬪垁鎻愪氦鎴愬姛',
@@ -336,18 +330,12 @@
headers: { 'Content-Type': 'application/json' }
});
if (res.data && res.data.outMsg) {
- if (res.data.outMsg === '閲嶅涓婁笅鍒�') {
- uni.showToast({
- title: res.data.outMsg,
- icon: 'error'
- });
- return; // 鎶ラ敊鏃朵笉鍐嶇户缁�
- } else {
- uni.showToast({
- title: res.data.outMsg,
- icon: 'none'
- });
- }
+ const isRepeat = res.data.outMsg === '閲嶅涓婁笅鍒�';
+ uni.showToast({
+ title: res.data.outMsg,
+ icon: isRepeat ? 'error' : 'none'
+ });
+ if (isRepeat) return; // 鎶ラ敊鏃朵笉鍐嶇户缁�
} else if (res.status === 0) {
uni.showToast({
title: '涓嬪垁鎻愪氦鎴愬姛',
--
Gitblit v1.9.3