From a4b14a35a2209a30e53472e6333b13aa4a55b0eb Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期二, 30 十二月 2025 22:14:25 +0800
Subject: [PATCH] feat:增加创建任务

---
 app/utils/request.js |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/app/utils/request.js b/app/utils/request.js
index bea5d40..fd6c1d7 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)
@@ -66,7 +86,7 @@
         } else if (message.includes('Request failed with status code')) {
           message = '绯荤粺鎺ュ彛' + message.substr(message.length - 3) + '寮傚父'
         }
-        toast(message)
+        // toast(message)
         reject(error)
       })
   })

--
Gitblit v1.9.1