Commit af13f5fa authored by 崔佳豪's avatar 崔佳豪

fix: 登录缓存client参数

parent 0e2aedb8
Pipeline #58513 passed with stages
...@@ -276,7 +276,7 @@ const Layout = (props) => { ...@@ -276,7 +276,7 @@ const Layout = (props) => {
const tk = Cookies.get('token') || props.global.token; const tk = Cookies.get('token') || props.global.token;
const isLogin = tk !== null && tk !== 'undefined' && tk !== (void 0); const isLogin = tk !== null && tk !== 'undefined' && tk !== (void 0);
if (!isLogin) { 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'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null; let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
generateType = generateType =
......
...@@ -57,7 +57,7 @@ class SecurityLayout extends React.Component { ...@@ -57,7 +57,7 @@ class SecurityLayout extends React.Component {
// redirect: pathname + search, // redirect: pathname + search,
// }); // });
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); 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'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let { generateType } = global; let { generateType } = global;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : ''; generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
......
...@@ -966,6 +966,7 @@ class Login { ...@@ -966,6 +966,7 @@ class Login {
path: '/', path: '/',
}); });
} }
sessionStorage.setItem('client', self.globalConfig.client);
self.isSignIn = true; self.isSignIn = true;
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
self.getUserInfoAndConfig(); self.getUserInfoAndConfig();
......
...@@ -72,7 +72,7 @@ export const AppInitState = () => { ...@@ -72,7 +72,7 @@ export const AppInitState = () => {
const getClient = () => { 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'; const client = value && value !== 'undefined' ? value : 'city';
return client; return client;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment