From c10b1e130ccbc94e6481a43e8e2d35cfc8fcf83b Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 26 十二月 2025 18:05:06 +0800
Subject: [PATCH] feat:显示问题
---
app/utils/request.js | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/app/utils/request.js b/app/utils/request.js
index bea5d40..f2fad21 100644
--- a/app/utils/request.js
+++ b/app/utils/request.js
@@ -39,6 +39,10 @@
}
const code = res.data.code || 200
const msg = errorCode[code] || res.data.msg || errorCode['default']
+
+ // 鐗规畩澶勭悊锛歝heckDuplicate 鎺ュ彛鍗充娇杩斿洖閿欒鐮佷篃瑕佽繘鍏� then 鍒嗘敮
+ const isCheckDuplicateApi = config.url && config.url.includes('/task/checkDuplicate')
+
if (code === 401) {
showConfirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�?').then(res => {
if (res.confirm) {
@@ -49,10 +53,26 @@
})
reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�')
} else if (code === 500) {
- toast(msg)
+ // checkDuplicate 鎺ュ彛涓嶆樉绀� toast锛岃涓氬姟浠g爜鑷繁澶勭悊
+ if (!isCheckDuplicateApi) {
+ toast(msg)
+ }
+ // checkDuplicate 鎺ュ彛杩斿洖瀹屾暣鍝嶅簲锛屼笉 reject
+ if (isCheckDuplicateApi) {
+ resolve(res.data)
+ return
+ }
reject('500')
} else if (code !== 200) {
- toast(msg)
+ // checkDuplicate 鎺ュ彛涓嶆樉绀� toast锛岃涓氬姟浠g爜鑷繁澶勭悊
+ if (!isCheckDuplicateApi) {
+ toast(msg)
+ }
+ // checkDuplicate 鎺ュ彛杩斿洖瀹屾暣鍝嶅簲锛屼笉 reject
+ if (isCheckDuplicateApi) {
+ resolve(res.data)
+ return
+ }
reject(code)
}
resolve(res.data)
--
Gitblit v1.9.1