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 |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/app/utils/request.js b/app/utils/request.js
index 860f0ef..f2fad21 100644
--- a/app/utils/request.js
+++ b/app/utils/request.js
@@ -11,8 +11,10 @@
   // 鏄惁闇�瑕佽缃� token
   const isToken = (config.headers || {}).isToken === false
   config.header = config.header || {}
-  if (getToken() && !isToken) {
-    config.header['Authorization'] = 'Bearer ' + getToken()
+  const token = getToken()
+  // 鍙湁褰搕oken瀛樺湪涓斾笉涓虹┖瀛楃涓叉椂鎵嶆坊鍔犲埌header
+  if (token && token.trim() !== '' && !isToken) {
+    config.header['Authorization'] = 'Bearer ' + token
   }
   // get璇锋眰鏄犲皠params鍙傛暟
   if (config.params) {
@@ -37,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) {
@@ -47,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