Commit 6fccff3b by zhanghaozhe

直播底部修改

parent fb665f8d
...@@ -25,8 +25,8 @@ class FreeCourse extends PureComponent { ...@@ -25,8 +25,8 @@ class FreeCourse extends PureComponent {
componentDidMount() { componentDidMount() {
this.getFreeCourses() this.getFreeCourses()
.then(res => { .then(res => {
if (res.data.code == 200) { let data = res.data
const data = res.data if (data.code == 200) {
this.setState({ this.setState({
courses: data.data, courses: data.data,
}) })
...@@ -36,12 +36,13 @@ class FreeCourse extends PureComponent { ...@@ -36,12 +36,13 @@ class FreeCourse extends PureComponent {
}) })
this.getFreeLive() this.getFreeLive()
.then(res => { .then(res => {
if (res.data.code == 200) { let data = res.data
if (data.code == 200) {
this.setState({ this.setState({
live: res.data.data live: data.data
}) })
} else { } else {
Toast.info(res.data.msg) Toast.info(data.msg, 2, null, false)
} }
}) })
} }
...@@ -58,19 +59,6 @@ class FreeCourse extends PureComponent { ...@@ -58,19 +59,6 @@ class FreeCourse extends PureComponent {
return ( return (
<ul className='free-courses'> <ul className='free-courses'>
{ {
this.state.courses.map((item, index) => (
<Course
img={item.logo}
title={item['video_course_name']}
bottom={
<Bottom audience={item['play_times']} className={'tag-category'} text={item.category}/>
}
id={item['v_course_id']}
key={index}
/>
))
}
{
this.state.live.map((item, index) => { this.state.live.map((item, index) => {
const Bottom = ( const Bottom = (
<div className="bottom"> <div className="bottom">
...@@ -79,12 +67,12 @@ class FreeCourse extends PureComponent { ...@@ -79,12 +67,12 @@ class FreeCourse extends PureComponent {
return <i key={index} className={classnames('column', `column-${index + 1}`)}/> return <i key={index} className={classnames('column', `column-${index + 1}`)}/>
})} })}
</div> </div>
<div className="time">{`直播:${item['live_start_time']}`}</div> <div className="time">{`${item['live_start_time']}`}</div>
</div> </div>
) )
return ( return (
<Course <Course
img={item['live_img']} img={item['live_cover']}
title={item['live_title']} title={item['live_title']}
top={ top={
<Tag className={'tag-starting top'}>即将开始</Tag> <Tag className={'tag-starting top'}>即将开始</Tag>
...@@ -96,6 +84,19 @@ class FreeCourse extends PureComponent { ...@@ -96,6 +84,19 @@ class FreeCourse extends PureComponent {
) )
}) })
} }
{
this.state.courses.map((item, index) => (
<Course
img={item.logo}
title={item['video_course_name']}
bottom={
<Bottom audience={item['play_times']} className={'tag-category'} text={item.category}/>
}
id={item['v_course_id']}
key={index}
/>
))
}
</ul> </ul>
) )
} }
......
...@@ -7,6 +7,7 @@ import FreeCourses from './freeCourses' ...@@ -7,6 +7,7 @@ import FreeCourses from './freeCourses'
import WithTab from '@/HOCs/WithTab' import WithTab from '@/HOCs/WithTab'
import WithFullSize from '@/HOCs/WithFullSize' import WithFullSize from '@/HOCs/WithFullSize'
import { compose } from 'redux' import { compose } from 'redux'
import PrivateRoute from '@/router/privateRoute'
class Study extends Component { class Study extends Component {
...@@ -45,11 +46,11 @@ class Study extends Component { ...@@ -45,11 +46,11 @@ class Study extends Component {
<Switch> <Switch>
<Redirect exact from='/study' to='study/my-course'/> <Redirect exact from='/study' to='study/my-course'/>
<Route path={`${this.props.match.path}/my-course`} component={MyCourses}/> <Route path={`${this.props.match.path}/my-course`} component={MyCourses}/>
{/*<PrivateRoute path={`${this.props.match.path}/my-course`} component={MyCourses}/>*/}
<Route path={`${this.props.match.path}/free-course`} component={FreeCourses}/> <Route path={`${this.props.match.path}/free-course`} component={FreeCourses}/>
{/*<Route path={`${this.props.match.path}/my-course`} render={props => { {/*<Route path={`${this.props.match.path}/my-course`} render={props => {
<MyCourses storeScrollPosition={this.storeScrollPosition}/> <MyCourses storeScrollPosition={this.storeScrollPosition}/>
}}/>*/} }}/>*/}
<Route path={`${this.props.match.path}/free-course`} component={FreeCourses}/>
</Switch> </Switch>
</div> </div>
</section> </section>
......
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