Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
251aeb05e8
@ -0,0 +1,23 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
// 登录后才能跳转
|
||||
class LinkAfterLogin extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
checkAuth = () => {
|
||||
if (this.props.checkIfLogin()) {
|
||||
this.props.history.push(this.props.to)
|
||||
} else {
|
||||
this.props.showLoginDialog()
|
||||
}
|
||||
}
|
||||
render() {
|
||||
return(
|
||||
<a {...this.props} onClick={this.checkAuth}>{this.props.children}</a>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default LinkAfterLogin;
|
Loading…
Reference in new issue