Commit ba5c0dda by zhanghaozhe

学习页面跳视频播放页面

parent f26c16f0
...@@ -41,7 +41,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { ...@@ -41,7 +41,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
} }
// Tools like Cloud9 rely on this. // Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 80;
const HOST = process.env.HOST || '0.0.0.0'; const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) { if (process.env.HOST) {
......
.course-base-item {
width: 47.8%;
margin-top: 15px;
margin-bottom: 5px;
position: relative;
img {
width: 100%;
height: 119px;
min-height: 119px;
}
.course-title {
font-size: 14px;
color: $color_333;
line-height: 19px;
margin-top: 9px;
}
}
import React from 'react'
import './course-base.scss'
const Course = (props) => {
return (
<li className={`course-base-item ${props.className}`} onClick={props.handleClick.bind(this, props.id)}>
{props.top}
<img src={props.img} alt=""/>
<p className="course-title">{props.title}</p>
{props.bottom}
</li>
);
};
export default Course;
import React from 'react';
import './index.scss'
const VList = (props) => {
return (
<li className='v-list-base-item' onClick={props.handleClick.bind(this, props.id)}>
<div className="content">
<div className="cover">
{props.status}
<img src={props.img} alt=""/>
</div>
{props.info}
</div>
{props.tab}
</li>
);
};
export default VList;
\ No newline at end of file
.v-list-base-item {
height: 127px;
padding: 10px 10px 0;
.content {
display: flex;
height: 100%;
padding-bottom: 10px;
border-bottom: 1px solid $sp_e7eaf1;
.cover {
flex: 0 0 auto;
margin-right: 16px;
position: relative;
img {
width: 150px;
height: 108px;
border-radius: 3px;
}
}
.course-status {
width: 100%;
height: 24px;
position: absolute;
bottom: -1px;
border-radius: 0 0 3px 3px;
text-align: center;
line-height: 24px;
color: $white;
font-size: 13px;
}
}
}
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import { Course, Tag } from '../../../common' import { Tag } from '../../../common'
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'
...@@ -47,6 +48,10 @@ class FreeCourse extends PureComponent { ...@@ -47,6 +48,10 @@ class FreeCourse extends PureComponent {
}) })
} }
handleClick = id => {
this.props.history.push(`/play?id=${id}`)
}
getFreeCourses = () => { getFreeCourses = () => {
return http.get(`${api.home}/m/free_course/${this.state.page}/${this.state.num}`) return http.get(`${api.home}/m/free_course/${this.state.page}/${this.state.num}`)
} }
...@@ -80,6 +85,8 @@ class FreeCourse extends PureComponent { ...@@ -80,6 +85,8 @@ class FreeCourse extends PureComponent {
bottom={Bottom} bottom={Bottom}
key={item['live_id']} key={item['live_id']}
className={'live'} className={'live'}
handleClick={this.handleClick}
id={index}
/> />
) )
}) })
...@@ -89,6 +96,7 @@ class FreeCourse extends PureComponent { ...@@ -89,6 +96,7 @@ class FreeCourse extends PureComponent {
<Course <Course
img={item.logo} img={item.logo}
title={item['video_course_name']} title={item['video_course_name']}
handleClick={this.handleClick}
bottom={ bottom={
<Bottom audience={item['play_times']} className={'tag-category'} text={item.category}/> <Bottom audience={item['play_times']} className={'tag-category'} text={item.category}/>
} }
......
import React, { PureComponent } from "react" import React, { PureComponent } from "react"
import { VList } from '@/common' import VList from '@/common/v-list-base'
import './my-courses.scss' import './my-courses.scss'
import { isToday, format } from "date-fns" import { isToday, format } from "date-fns"
import { connect } from "react-redux" import { connect } from "react-redux"
...@@ -72,10 +72,10 @@ class MyCourses extends PureComponent { ...@@ -72,10 +72,10 @@ class MyCourses extends PureComponent {
list; list;
handleClick = id => { handleClick = id => {
this.props.history.push(`/detail?id=${id}`) this.props.history.push(`/play/video?id=${id}`)
} }
addCourseClick = () => { addCourseClick = () => {
console.log(2); this.props.history.push('/classify')
} }
componentDidMount() { componentDidMount() {
......
...@@ -197,7 +197,7 @@ class Video extends Component { ...@@ -197,7 +197,7 @@ class Video extends Component {
render() { render() {
let {match} = this.props let {match, location} = this.props
const {video_catalog, activeIndex, isAuth, salePrice} = this.state const {video_catalog, activeIndex, isAuth, salePrice} = this.state
return ( return (
<div className='play'> <div className='play'>
...@@ -235,7 +235,10 @@ class Video extends Component { ...@@ -235,7 +235,10 @@ class Video extends Component {
</div> </div>
</div> </div>
<Switch> <Switch>
<Redirect exact from={'/play'} to={'/play/video'}/> <Redirect exact from={'/play'} to={{
pathname: '/play/video',
search: location.search
}}/>
<Route path={`${match.path}/video`} render={props => { <Route path={`${match.path}/video`} render={props => {
return <VideoCatalog return <VideoCatalog
activeIndex={this.state.activeIndex} activeIndex={this.state.activeIndex}
......
...@@ -26,6 +26,14 @@ class Recommendation extends PureComponent { ...@@ -26,6 +26,14 @@ class Recommendation extends PureComponent {
componentDidMount() { componentDidMount() {
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.courseId}?num=${this.state.num}`)
.then(res => { .then(res => {
const data = res.data const data = res.data
......
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