Commit 3910aab1 authored by 张瑶's avatar 张瑶

feat: 重定向传递generateType参数,修复client=undefined问题

parent 12c539fd
Pipeline #42883 passed with stages
in 1 minute 36 seconds
...@@ -332,8 +332,10 @@ const BasicLayout = props => { ...@@ -332,8 +332,10 @@ const BasicLayout = props => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { if (!Cookies.get('token')) {
let client = props.global && props.global.client; let client = props.global && props.global.client;
client = client !== 'undefined' || !_.isNull(client) || !_.isUndefined(client) ? client: 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
history.replace(`/user/login?client=${client}`); let generateType = props.global.get('generateType');
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
history.replace(`/user/login?client=${client}${generateType}`);
props.logout(); props.logout();
return; return;
} }
......
...@@ -21,23 +21,21 @@ class SecurityLayout extends React.Component { ...@@ -21,23 +21,21 @@ class SecurityLayout extends React.Component {
} }
render() { render() {
const { isReady } = this.state; const { isReady } = this.state;
const { children, global, loading } = this.props; const { children, global, loading } = this.props;
const isLogin = Cookies.get('token') !== null && global.token !== null; const isLogin = Cookies.get('token') !== null && global.token !== null;
// const queryString = stringify({ // const queryString = stringify({
// redirect: window.location.href, // redirect: window.location.href,
// }); // });
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) { if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
debugger
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
let client = global.client || Cookies.get('city'); let client = global.client || Cookies.get('city');
client = client !== 'undefined' || !_.isNull(client) || !_.isUndefined(client) ? client: 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
// event.emit(?'event:initConfig'); // event.emit(?'event:initConfig');
let generateType = global.generateType;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
return ( return (
<Redirect to={`/user/login?client=${client}`} render={() => window.location.reload()}/> <Redirect to={`/user/login?client=${client}${generateType}`} render={() => window.location.reload()}/>
); );
} }
......
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