Commit aded84d4 by zhanghaozhe

video

parent 28f7a32d
...@@ -6,5 +6,6 @@ export { default as HeaderBar } from './HeaderBar' ...@@ -6,5 +6,6 @@ export { default as HeaderBar } from './HeaderBar'
export { default as CallApp } from './CallApp' export { default as CallApp } from './CallApp'
export { default as Captcha } from './Captcha' export { default as Captcha } from './Captcha'
export { default as ClearableInput } from "./ClearableInput"; export { default as ClearableInput } from "./ClearableInput";
export { default as Loading } from './Loading'
...@@ -10,6 +10,7 @@ import { Toast } from 'antd-mobile'; ...@@ -10,6 +10,7 @@ import { Toast } from 'antd-mobile';
import videojs from 'video.js' import videojs from 'video.js'
import 'video.js/dist/video-js.min.css' import 'video.js/dist/video-js.min.css'
import { Modal } from "antd-mobile"; import { Modal } from "antd-mobile";
import { Loading } from '@/common'
let alert = Modal.alert let alert = Modal.alert
...@@ -31,7 +32,8 @@ class Video extends Component { ...@@ -31,7 +32,8 @@ class Video extends Component {
isAuth: true, isAuth: true,
course: null, course: null,
salePrice: null, salePrice: null,
vCourseId: null vCourseId: null,
isLoading: true
} }
...@@ -58,6 +60,10 @@ class Video extends Component { ...@@ -58,6 +60,10 @@ class Video extends Component {
} }
componentDidUpdate(prevProps, prevState) {
console.log(this.video);
}
componentWillUnmount() { componentWillUnmount() {
if (this.player) { if (this.player) {
...@@ -90,13 +96,16 @@ class Video extends Component { ...@@ -90,13 +96,16 @@ class Video extends Component {
course: data.data.course, course: data.data.course,
courseId: data.data.course['course_id'], courseId: data.data.course['course_id'],
vCourseId: data.data.course['v_course_id'], vCourseId: data.data.course['v_course_id'],
title: data.data.course['course_title'] title: data.data.course['course_title'],
isLoading: false
}), }),
() => { () => {
if (this.lessonAvailable()) { if (this.lessonAvailable()) {
if (this.hasAuth(this.state.activeIndex)) { if (this.hasAuth(this.state.activeIndex)) {
this.initializePlayer() Promise.resolve().then(() => {
this.playWithAuth() this.initializePlayer()
this.playWithAuth()
})
} else { } else {
this.getCoursePrice(); this.getCoursePrice();
} }
...@@ -205,38 +214,40 @@ class Video extends Component { ...@@ -205,38 +214,40 @@ class Video extends Component {
return ( return (
<div className='play'> <div className='play'>
<HeaderBar title={this.state.title} arrow={true}/> <HeaderBar title={this.state.title} arrow={true}/>
<div className="video"> <Loading isLoading={this.state.isLoading}>
<video className={'video-js'} ref={el => this.video = el}> <div className="video">
<source src={'/'} type='application/x-mpegURL'/> <video className={'video-js'} ref={el => this.video = el}>
</video> <source src={'/'} type='application/x-mpegURL'/>
{ </video>
!isAuth && ( {
<div className="purchase-box"> !isAuth && (
<div className='hint'>您尚未购买该课时,请购买后学习。</div> <div className="purchase-box">
<div className='btns'> <div className='hint'>您尚未购买该课时,请购买后学习。</div>
<button type='button' className='purchase-class'>¥{salePrice} 购买课程</button> <div className='btns'>
<button type='button' <button type='button' className='purchase-class'>¥{salePrice} 购买课程</button>
className='purchase-episode'>¥{video_catalog.length && video_catalog[activeIndex]['class_price']} 购买单集 <button type='button'
</button> className='purchase-episode'>¥{video_catalog.length && video_catalog[activeIndex]['class_price']} 购买单集
</button>
</div>
</div> </div>
</div> )
) }
}
</div>
<div className='tab'>
<div>
<NavLink to={`${match.url}/video`}
replace
activeClassName='active'
>视频</NavLink>
</div> </div>
<div> <div className='tab'>
<NavLink to={`${match.url}/datum`} <div>
replace <NavLink to={`${match.url}/video`}
activeClassName='active' replace
>资料</NavLink> activeClassName='active'
>视频</NavLink>
</div>
<div>
<NavLink to={`${match.url}/datum`}
replace
activeClassName='active'
>资料</NavLink>
</div>
</div> </div>
</div> </Loading>
<Switch> <Switch>
<Redirect exact from={'/play'} to={{ <Redirect exact from={'/play'} to={{
pathname: '/play/video', pathname: '/play/video',
......
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