From d4e717201b013ff94058d46a9b85931eeff01500 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Sun, 28 Nov 2021 16:12:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9B=B4=E4=B8=BA=E6=88=90?= =?UTF-8?q?=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 34 ++++++++++++++++++++++++++++++++-- src/pages/order/list/list.js | 2 +- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index 46b6585f..7fe58f74 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -87,9 +87,39 @@ const req = (method, url, params, responseType) => { let http = fetch(url, obj).then(res =>{ window.timeshow=res.headers.get('Date-Time'); - return res.json() + console.log(res); + if(res.status==200){ + return res.json() + }else{ + switch (res.status) { + // 401: 未登录 + case 401: + Notify.clear(); + Notify.error( "当前信息过期请重新登录"); + setTimeout(() => { + window.location.href='./login'; + }, 3000) + break; + case 417: + Notify.clear(); + Notify.error( res.statusText); + break; + + case 500: + Notify.clear(); + Notify.error( res.statusText); + break; + default: + Notify.clear(); + Notify.error( res.statusText); + break; + } + } + + console.log(res); + } ); - return http.then(response => response).catch(error => console.error('Error:', error)); + return http.then(response =>response).catch(error => console.error('Error:', error)); } export const handelResponse = (res, cb, errCb) => { diff --git a/src/pages/order/list/list.js b/src/pages/order/list/list.js index a562f525..7a5b141e 100644 --- a/src/pages/order/list/list.js +++ b/src/pages/order/list/list.js @@ -562,7 +562,7 @@ componentDidUpdate(prevProps,prevState){ // rowData.status==3? this.againinvestFn(e,rowData)}>再次充值:null } { - rowData.status==1? this.deleteFn(e,rowData)} >改为成功:null + rowData.status==1? this.changeSuccessFn(e,rowData)} >改为成功:null }