Commit a66e5df4 by zhanghaozhe

直播状态

parent a5373bf5
...@@ -10,10 +10,14 @@ ...@@ -10,10 +10,14 @@
left: 0; left: 0;
} }
.tag-starting { .tag-soon {
background: $red; background: $red;
color: $white; color: $white;
} }
.tag-soon {
background: $active;
color: $white;
}
.tag-category { .tag-category {
background: #E0B97B; background: #E0B97B;
......
...@@ -4,7 +4,7 @@ import Course from '@/common/course-base' ...@@ -4,7 +4,7 @@ import Course from '@/common/course-base'
import { http, api } from '@/utils' import { http, api } from '@/utils'
import { Toast } from "antd-mobile"; import { Toast } from "antd-mobile";
import classnames from 'classnames' import classnames from 'classnames'
import {isEmpty} from 'lodash' import { isEmpty } from 'lodash'
import './free-courses.scss' import './free-courses.scss'
...@@ -61,6 +61,15 @@ class FreeCourse extends PureComponent { ...@@ -61,6 +61,15 @@ class FreeCourse extends PureComponent {
return http.get(`${api.home}/m/live/free_list`) return http.get(`${api.home}/m/live/free_list`)
} }
toLive = live => {
const {room_id, live_status} = live
if (live_status) {
window.location.assign(`http://www-test.julyedu.com/live/m_room/${room_id}`)
} else {
Toast.info('直播即将开始,敬请期待', 2, null, false)
}
}
render() { render() {
return ( return (
<ul className='free-courses'> <ul className='free-courses'>
...@@ -76,17 +85,20 @@ class FreeCourse extends PureComponent { ...@@ -76,17 +85,20 @@ class FreeCourse extends PureComponent {
<div className="time">{`${item['live_start_time']}`}</div> <div className="time">{`${item['live_start_time']}`}</div>
</div> </div>
) )
const LiveStatus = (
item['live_status'] ? <Tag className={'tag-soon top'}>即将开始</Tag> :
<Tag className={'tag-playing top'}>正在直播</Tag>
)
return ( return (
<Course <Course
img={item['live_cover']} img={item['live_cover']}
title={item['live_title']} title={item['live_title']}
top={ top={LiveStatus}
<Tag className={'tag-starting top'}>即将开始</Tag>
}
bottom={Bottom} bottom={Bottom}
key={item['live_id']} key={item['live_id']}
className={'live'} className={'live'}
handleClick={this.handleClick} handleClick={this.toLive.bind(this, item)}
id={index} id={index}
/> />
) )
......
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