From fe21d23b147ed5cec22b4f76a88840b05495d4ad Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 18 六月 2022 22:33:59 +0800 Subject: [PATCH] 2022-06-18 --- src/api/index.js | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index c47a9cc..bdaed71 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -48,7 +48,7 @@ } sessionStorage.clear() - sessionStorage.setItem('loginError', JSON.stringify({request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) + sessionStorage.setItem('loginError', JSON.stringify({url: res.config ? res.config.url : '', request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') window.location.reload() } @@ -59,23 +59,29 @@ if (window.debugger === true) { response.data.ErrCode = 'E' return Promise.resolve(response.data) - } else { + } else if (!sessionStorage.getItem('loginError')) { setCurrentUrl(response) } } else { return Promise.resolve(response.data) } }, (error) => { - if (error && error.response) { - notification.error({ - className: 'notification-custom-error', - bottom: 0, - message: '鐘舵�佺爜-' + error.response.status + '锛岃鑱旂郴绠$悊鍛�', - placement: 'bottomRight', - duration: 15 - }) + let response = error.response + + if (response) { + if (!response.data || !response.data.errors) { // 杩囨护鏃疯鎶ラ敊淇℃伅 + notification.error({ + className: 'notification-custom-error', + bottom: 0, + message: '鐘舵�佺爜-' + response.status + '锛岃鑱旂郴绠$悊鍛�', + placement: 'bottomRight', + duration: 15 + }) + } + return Promise.reject(response) + } else { + return Promise.reject() } - return Promise.reject(error.response) }) class Api { @@ -671,7 +677,15 @@ } }) param.sign = md5(values) - param.t = new Date().getTime() + param.t = new Date().getTime(); + + ['arr_field', 'LText_field', 'custom_script', 'LText1', 'LText', 'LText2', 'DateCount'].forEach(key => { + if (param[key]) { + let val = param[key] + delete param[key] + param[key] = val + } + }) return param } -- Gitblit v1.8.0