From 6eebb13501deb7721f15770a1fbd3613b37eae22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 31 Dec 2019 11:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=81=9C=E7=95=99=E6=8A=A550?= =?UTF-8?q?1=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index b0d0b2f3f..ad6a30608 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -14,6 +14,17 @@ broadcastChannelOnmessage('refreshPage', () => { window.location.reload() }) +window.addEventListener('pageshow', function(event) { + if(event.persisted) { // ios 有效, android 和 pc 每次都是 false + window.location.reload(); + } else { // ios 除外 + if(sessionStorage.getItem('refresh') === 'true') { + window.location.reload(); + } + } + sessionStorage.removeItem('refresh'); +}); + function locationurl(list){ if (window.location.port === "3007") { @@ -224,10 +235,16 @@ export function initAxiosInterceptors(props) { } if (response.data.status === 501) { - window.location.reload() - notification.warning({ - description:response.data.message || '访问异常,请求不合理', + notification.open({ + message:"提示", + description:response.data.message?response.data.message+",将在1秒钟后刷新页面" : '访问异常,请求不合理,将在1秒钟后刷新页面', + style: { + zIndex: 99999999 + } }) + window.setTimeout(function () { + window.location.reload() + }, 1500); }