zhengnaiwen_citu 4 kuukautta sitten
vanhempi
commit
5587941319
1 muutettua tiedostoa jossa 7 lisäystä ja 9 poistoa
  1. 7 9
      src/config/axios/service.js

+ 7 - 9
src/config/axios/service.js

@@ -272,20 +272,18 @@ service.interceptors.response.use(
       // 未注册过的手机号将code码返回
       return Promise.reject(data)
     }
-    if (code !== 200) {
-      const _index = errorData.findIndex(e => e.url === config.url && e.time === +config.headers.timestamp)
-      if (_index > -1) {
-        const _item = errorData.splice(_index, 1)
-        // 保存错误信息
+    const _index = errorData.findIndex(e => e.url === config.url && e.time === +config.headers.timestamp)
+    if (_index > -1) {
+      const _item = errorData.splice(_index, 1)
+      // 保存错误信息
+      if (code === 400) {
         sendError({ content: JSON.stringify(_item.content), mark: _item.time + '' })
       }
+    }
+    if (code !== 200) {
       Snackbar.error(msg)
       return Promise.reject(msg)
     }
-    const _index = errorData.findIndex(e => e.url === config.url && e.time === +config.headers.timestamp)
-    if (_index > -1) {
-      errorData.splice(_index, 1)
-    }
     // 请求成功后触发获取积分
     if (response.config.headers?.Authorization) {
       const url = getSuffixAfterPrefix(response.config.url)