Commit d5bdf898 by FE

click vip to course detail modify in my page

parent 17bb8938
...@@ -7,10 +7,14 @@ import {WithTab} from '@/HOCs' ...@@ -7,10 +7,14 @@ import {WithTab} from '@/HOCs'
import {Link} from "react-router-dom" import {Link} from "react-router-dom"
import {connect} from "react-redux" import {connect} from "react-redux"
import {HeaderBar} from "@/common" import {HeaderBar} from "@/common"
import {getCourses} from './../detail/actions';
const Item = List.Item; const Item = List.Item;
const Brief = Item.Brief; const Brief = Item.Brief;
@connect(state => ({
user: state.user
}))
class My extends PureComponent { class My extends PureComponent {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -24,6 +28,14 @@ class My extends PureComponent { ...@@ -24,6 +28,14 @@ class My extends PureComponent {
this.props.history.push('/passport') this.props.history.push('/passport')
} }
toCourseDetail = (id) => {
const { dispatch, history } = this.props;
dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`);
return false;
}));
}
render() { render() {
const {user} = this.props const {user} = this.props
const uid = user && user.data && user.data.uid const uid = user && user.data && user.data.uid
...@@ -64,7 +76,8 @@ class My extends PureComponent { ...@@ -64,7 +76,8 @@ class My extends PureComponent {
</Link> </Link>
{ {
(isVIP === 0 || !isVIP) && (isVIP === 0 || !isVIP) &&
<Link className="my-isvip" to={`/detail?id=139`}></Link> <a href="javascript:;" className="my-isvip" onClick={() => this.toCourseDetail(139)}></a>
// <Link className="my-isvip" to={`/detail?id=139`}></Link>
} }
</List> </List>
} }
...@@ -127,7 +140,4 @@ class My extends PureComponent { ...@@ -127,7 +140,4 @@ class My extends PureComponent {
} }
export default connect( export default WithTab(My);
state => ({user: state.user}),
null
)(WithTab(My))
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