index.js 1.57 KB
Newer Older
1 2 3
import React, { Component } from 'react'
import './study.scss'

zhanghaozhe committed
4
import { NavLink, Route, Switch, Redirect } from "react-router-dom"
zhanghaozhe committed
5 6
import MyCourses from "./myCourses"
import FreeCourses from './freeCourses'
zhanghaozhe committed
7 8
import WithTab from '@/HOCs/WithTab'
import WithFullSize from '@/HOCs/WithFullSize'
zhanghaozhe committed
9
import { compose } from 'redux'
10

baiguangyao committed
11 12 13

class Study extends Component {

zhanghaozhe committed
14
    state = {
zhanghaozhe committed
15
        position: {}
zhanghaozhe committed
16 17
    }

baiguangyao committed
18
    render() {
19
        const {match} = this.props;
baiguangyao committed
20
        return (
21
            <section id='study'>
zhanghaozhe committed
22 23
                <div className='tab'>
                    <div>
zhanghaozhe committed
24 25 26 27
                        <NavLink to={`${match.url}/my-course`}
                                 replace
                                 activeClassName='active'
                        >我的课程</NavLink>
zhanghaozhe committed
28 29
                    </div>
                    <div>
zhanghaozhe committed
30 31 32 33
                        <NavLink to={`${match.url}/free-course`}
                                 replace
                                 activeClassName='active'
                        >免费课程</NavLink>
zhanghaozhe committed
34 35
                    </div>
                </div>
zhanghaozhe committed
36
                <div className="study-container">
zhanghaozhe committed
37
                    <Switch>
zhanghaozhe committed
38
                        <Redirect exact from='/study' to='study/my-course'/>
zhanghaozhe committed
39 40
                        <Route path={`${this.props.match.path}/my-course`} component={MyCourses}/>
                        <Route path={`${this.props.match.path}/free-course`} component={FreeCourses}/>
zhanghaozhe committed
41 42
                    </Switch>
                </div>
43
            </section>
baiguangyao committed
44 45 46 47 48
        )
    }

}

zhanghaozhe committed
49 50 51 52
export default compose(
    WithFullSize,
    WithTab
)(Study)