fix: qsso error bug

This commit is contained in:
suxiaoxin 2017-08-25 19:17:57 +08:00
parent 7653d07704
commit 72fc6e6d7c

View File

@ -42,7 +42,7 @@ const HomeGuest = () => (
</Col>
<Col lg={15} xs={0} className="col-img">
<div className="img-container">
<img className="img" src={getImgPath('./image/demo-img', 'jpg')}/>
<img className="img" src={getImgPath('/image/demo-img', 'jpg')} />
</div>
</Col>
</Row>
@ -172,8 +172,15 @@ class Home extends Component {
constructor(props) {
super(props)
}
componentWillMount() {
if (this.props.login) {
this.props.history.push('/group/261')
}
}
componentDidMount() {
if(window.QSSO) window.QSSO.attach('qsso-login','/api/user/login_by_token')
if (window.QSSO && document.getElementById('qsso-login')) window.QSSO.attach('qsso-login', '/api/user/login_by_token')
}
static propTypes = {
introList: PropTypes.array,
@ -185,10 +192,9 @@ class Home extends Component {
this.props.changeMenuItem('/group');
}
render() {
const { login } = this.props;
return (
<div className="home-main">
{login? this.props.history.push('/group') : <HomeGuest introList={this.props.introList}/>}
<HomeGuest introList={this.props.introList} />
<div className="row-tip">
<div className="container">
<div className="tip-title">