Commit 354acf13 by zhanghaozhe

视频播放页

parent 24890872
......@@ -4,6 +4,7 @@ import Course from '@/common/course-base'
import { http, api } from '@/utils'
import { Toast } from "antd-mobile";
import classnames from 'classnames'
import {isEmpty} from 'lodash'
import './free-courses.scss'
......@@ -40,7 +41,7 @@ class FreeCourse extends PureComponent {
let data = res.data
if (data.code == 200) {
this.setState({
live: data.data
live: isEmpty(data.data) ? [] : data.data
})
} else {
Toast.info(data.msg, 2, null, false)
......
......@@ -22,7 +22,7 @@ class Video extends Component {
state = {
title: '视频',
title: '',
courseId: null,
video_catalog: [],
datum: [],
......@@ -30,7 +30,8 @@ class Video extends Component {
activeIndex: 0,
isAuth: true,
course: null,
salePrice: null
salePrice: null,
vCourseId: null
}
......@@ -87,7 +88,9 @@ class Video extends Component {
video_catalog: data.data['lessons'],
currentVideoSrc: data.data['lessons'][state.activeIndex]['play_url'],
course: data.data.course,
courseId: data.data.course['course_id']
courseId: data.data.course['course_id'],
vCourseId: data.data.course['v_course_id'],
title: data.data.course['course_title']
}),
() => {
if (this.lessonAvailable()) {
......@@ -201,7 +204,7 @@ class Video extends Component {
const {video_catalog, activeIndex, isAuth, salePrice} = this.state
return (
<div className='play'>
<HeaderBar title={this.state.title}/>
<HeaderBar title={this.state.title} arrow={true}/>
<div className="video">
<video className={'video-js'} ref={el => this.video = el}>
<source src={'/'} type='application/x-mpegURL'/>
......@@ -251,7 +254,7 @@ class Video extends Component {
}}/>
</Switch>
<Route render={props => {
return this.state.courseId ? <Recommendation {...props} courseId={this.state.courseId}/>
return this.state.vCourseId ? <Recommendation {...props} vCourseId={this.state.vCourseId}/>
: null
}}/>
</div>
......
......@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import './recommendation.scss'
import { http, api } from '@/utils'
import { Toast } from "antd-mobile";
import {VList} from '@/common';
import VList from '@/common/v-list-base';
......@@ -29,12 +29,8 @@ class Recommendation extends PureComponent {
this.getRecommendation()
}
componentDidUpdate(prevProps, prevState) {
console.log(prevProps, this.props);
}
getRecommendation = () => {
http.get(`${api.home}/m/play/recommend_course/${this.props.courseId}?num=${this.state.num}`)
http.get(`${api.home}/m/play/recommend_course/${this.props.vCourseId}?num=${this.state.num}`)
.then(res => {
const data = res.data
if(data.code === 200){
......@@ -51,7 +47,7 @@ class Recommendation extends PureComponent {
handleClick = id => {
console.log(id)
this.props.history.push(`/detail?id=${id}`)
}
render() {
......
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