From af13f5fa97d60fb6b4da4c1fd931b83efd235999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E4=BD=B3=E8=B1=AA?= <15927252954@163.com> Date: Thu, 25 Aug 2022 09:54:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E5=BD=95=E7=BC=93=E5=AD=98clie?= =?UTF-8?q?nt=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/BasicLayout.js | 2 +- src/layouts/SecurityLayout.js | 2 +- src/pages/user/login/login.js | 1 + src/render.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index bb908352..8c1d041f 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -276,7 +276,7 @@ const Layout = (props) => { const tk = Cookies.get('token') || props.global.token; const isLogin = tk !== null && tk !== 'undefined' && tk !== (void 0); if (!isLogin) { - let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null; + let client = props?.global?.client || sessionStorage.getItem('client') || null; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null; generateType = diff --git a/src/layouts/SecurityLayout.js b/src/layouts/SecurityLayout.js index 9be2d903..1f46d33a 100644 --- a/src/layouts/SecurityLayout.js +++ b/src/layouts/SecurityLayout.js @@ -57,7 +57,7 @@ class SecurityLayout extends React.Component { // redirect: pathname + search, // }); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); - let client = global.client || Cookies.get('client'); + let client = global.client || sessionStorage.getItem('client'); client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; let { generateType } = global; generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : ''; diff --git a/src/pages/user/login/login.js b/src/pages/user/login/login.js index b95eada1..494f74f9 100644 --- a/src/pages/user/login/login.js +++ b/src/pages/user/login/login.js @@ -966,6 +966,7 @@ class Login { path: '/', }); } + sessionStorage.setItem('client', self.globalConfig.client); self.isSignIn = true; self.updateConfig && self.updateConfig(self.globalConfig); self.getUserInfoAndConfig(); diff --git a/src/render.js b/src/render.js index 0328e40a..e783580e 100644 --- a/src/render.js +++ b/src/render.js @@ -72,7 +72,7 @@ export const AppInitState = () => { const getClient = () => { - const value = params.getParams('client') || Cookies.get('client'); + const value = params.getParams('client') || sessionStorage.getItem('client'); const client = value && value !== 'undefined' ? value : 'city'; return client; } -- 2.17.1