Commit aa3624c9 by xuzhenghua

test

parent f81ee884
......@@ -105,18 +105,19 @@ class OutLine extends Component {
{
// 已购买直播结束已上传视频:正常播放按钮,点击播放课程
!introduce.is_aist && item.class_status === 2 &&
<i className='iconfont icondanseshixintubiao-23 icon-right-22'></i>
<Link to={`/play?id=${introduce.v_course_id}`} className='iconfont icondanseshixintubiao-23 icon-right-22'></Link>
}
{
// 返现课程 是返现课程 未开课 已开课 是返现课程 未开课 已开课 已练习
introduce.is_aist && item.is_open &&
<i className='aist aist_open'></i>
introduce.is_aist && item.is_open && introduce.is_baoming === 1 &&
<Link to={`/play?id=${introduce.v_course_id}`} className='aist aist_open'></Link>
}
{
// 返现课程 是返现课程 未开课 已开课 是返现课程 未开课 已开课 已练习
introduce.is_aist && !item.is_open &&
introduce.is_aist && (!item.is_open || introduce.is_baoming === 0) &&
<i className='aist aist_close'></i>
}
</h2>
......@@ -145,20 +146,20 @@ class OutLine extends Component {
{
<>
{
introduce.is_aist && item.practice.title !== "" && !item.is_open &&
introduce.is_aist && item.practice.title !== "" && (!item.is_open || introduce.is_baoming === 0) &&
<span className='camp camp_test' key={index}>
<span>课后练习:{item.practice.title}</span>
<i className='exam exam_close' />
</span>
}
{
introduce.is_aist && item.practice.title !== "" && item.is_open && !item.practice.is_tested &&
introduce.is_aist && item.practice.title !== "" && item.is_open && introduce.is_baoming === 1 && !item.practice.is_tested &&
<Link to={`/campTest?keshi_id=${item.video_id}&qid=${item.practice.qid}`} className='camp camp_test' key={index}>
<span>课后练习:{item.practice.title}</span>
</Link>
}
{
introduce.is_aist && item.practice.title !== "" && item.is_open && item.practice.is_tested &&
introduce.is_aist && item.practice.title !== "" && item.is_open && introduce.is_baoming === 1 && item.practice.is_tested &&
<Link to={`/campResolve?keshi_id=${item.video_id}&qid=${item.practice.qid}`} className='camp camp_test' key={index}>
<span>课后练习:{item.practice.title}</span>
<i className='exam exam_open' />
......
......@@ -98,7 +98,7 @@ class Order extends Component {
Toast.info('请完善报名信息!');
}
if(this.props.location.state && this.props.location.state.group === 1) {
http.post(`${API['base-api']}/pdd/m`, {course_id: getParam("id")}).then(res => {
http.post(`${API['base-api']}/pdd/m`, {course_id: getParam("id"),ischeck:this.state.useBalance}).then(res => {
if(res.data.errno === 200) {
sessionStorage.removeItem('orderUseCacheObj');
if (res.data.data.is_free === 1) {
......@@ -404,7 +404,7 @@ class Order extends Component {
{
useBalance ? (
<>
<span style={{ color: '#FF2121', fontSize: '15px', marginRight: "6px" }}>{`-${offset}`}</span>
<span style={{ color: '#FF2121', fontSize: '15px', marginRight: "6px" }}>{`-¥${offset}`}</span>
<i className={`iconfont icondanseshixintubiao-5 balance-used`} onClick={throttle(this.useBalance, 600)}></i>
</>
) : (
......
......@@ -167,9 +167,9 @@ export default class PayOrder extends Component {
}
componentDidMount() {
http.post(`${API.home}/m/order/detail`, { order_id: this.state.orderId }).then((res) => {
http.post(`${API['base-api']}/m/order/detail`, { order_id: this.state.orderId }).then((res) => {
console.log(res);
if (res.data.code !== 200) {
if (res.data.errno !== 200) {
Toast.info(res.data.msg, 2);
return;
}
......
import React, { Component } from 'react'
import React, {Component} from 'react'
import HeaderBar from '@/common/HeaderBar'
import './video.scss'
import { NavLink, Route, Redirect, Switch } from 'react-router-dom'
import { http, api, getParam } from '@/utils'
import {NavLink, Route, Redirect, Switch} from 'react-router-dom'
import {http, api, getParam} from '@/utils'
import Recommendation from './recommendation'
import VideoCatalog from './video-catalog'
import DatumCatalog from './datum-catalog'
import { Toast } from 'antd-mobile'
import {Toast} from 'antd-mobile'
import videojs from 'video.js'
import 'video.js/dist/video-js.min.css'
import { Modal } from "antd-mobile"
import { Loading } from '@/common'
import { connect } from "react-redux"
import {Modal} from "antd-mobile"
import {Loading} from '@/common'
import {connect} from "react-redux"
import jsCookie from 'js-cookie'
import io from 'socket.io-client'
import Single from "@/components/detail/single";
......@@ -106,7 +106,7 @@ class Video extends Component {
}
// 直接购买
tobuy=()=>{
tobuy = () => {
http.get(`${API['base-api']}/m/cart/addtopreorder/[${getParam('id')}]`).then((res) => {
if (res.data.errno === 0) {
this.props.history.push(`/order?id=${getParam('id')}`, {simple: 1})
......@@ -131,7 +131,7 @@ class Video extends Component {
setupRecord = () => {
this.recordSocket = io(API.record,{
this.recordSocket = io(API.record, {
transports: ['websocket']
})
this.recordSocket.on('seek', time => {
......@@ -295,29 +295,25 @@ class Video extends Component {
}
selectVideo = index => {
if (this.hasAuth()) {
if (index === this.state.activeIndex) {
return
}
this.setState({
activeIndex: index
},
() => {
if(this.hasAuth()){
this.setPlayerSrc(this.state.videoList[index]['play_url'])
this.sendLastRecord()
this.playVideo()
}
)
clearInterval(this.timer)
if (this.ws) {
this.countSchedule()
this.setupTimer()
}
}
this.setState({
activeIndex: index
})
)
}
......@@ -343,7 +339,7 @@ class Video extends Component {
this.setupTimer()
}
if (this.lessonAvailable()) {
if (this.hasAuth(this.state.activeIndex)) {
if (this.hasAuth()) {
Promise.resolve().then(() => {
let {videoList, course} = this.state
......@@ -375,6 +371,9 @@ class Video extends Component {
}
setPlayerSrc = src => {
if(!this.player){
this.initializePlayer()
}
this.player.src({
src,
type: 'application/x-mpegURL'
......@@ -430,36 +429,25 @@ class Video extends Component {
hasAuth = () => {
const {course, videoList, activeIndex} = this.state
let lesson = videoList[activeIndex]
if (!lesson['is_free']) {
if (course['is_audition']) {
this.setState({
isAuth: true
})
return true
} else {
if (lesson['video_auth']) {
this.setState({
isAuth: true
})
return true
}
} else {
this.setState({
isAuth: false
})
return false
}
}
this.setState({
isAuth: true
})
return true
}
render() {
let {match, location} = this.props
const {videoList, activeIndex, isAuth, salePrice} = this.state
const {videoList, activeIndex, isAuth, salePrice, course} = this.state
return (
<div className='play'>
<HeaderBar title={this.state.title} arrow={true}/>
......@@ -469,21 +457,31 @@ class Video extends Component {
<source src={'/'} type='application/x-mpegURL'/>
</video>
{
!isAuth && (
!isAuth && !!videoList[activeIndex]['is_class'] && (
<div className="purchase-box">
<div className='hint'>您尚未购买该课时,请购买后学习。</div>
<div className='btns'>
<button type='button'
onClick={this.tobuy}
className='purchase-class'>¥{salePrice} 购买课程</button>
className='purchase-class'>¥{salePrice} 购买课程
</button>
<button type='button'
onClick={this.toSingleset.bind(this,videoList[activeIndex])}
onClick={this.toSingleset.bind(this, videoList[activeIndex])}
className='purchase-episode'>¥{videoList.length && videoList[activeIndex]['class_price']} 购买单集
</button>
</div>
</div>
)
}
{
!isAuth && !!course.is_aist && (
<div className="is-aist-box">
<i className={'iconfont iconiconfront-21'}></i>
<p className={'time'}>{videoList[activeIndex]['aist_start_time']}</p>
<p className={'time'}>请耐心等待...</p>
</div>
)
}
</div>
<div className='tab'>
<div>
......@@ -501,7 +499,8 @@ class Video extends Component {
</div>
{/*单集购买*/}
<Single singleBox={this.state.singleBox} boxHide={this.boxHide} data={this.state.singMess} videoId={this.state.singMess.id}
<Single singleBox={this.state.singleBox} boxHide={this.boxHide} data={this.state.singMess}
videoId={this.state.singMess.id}
title={this.state.singMess.course_tile}/>
</Loading>
<Switch>
......
......@@ -68,6 +68,28 @@ $tabHeight: 44px;
}
}
.is-aist-box {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.8);
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
color: #fff;
i {
font-size: 34px;
}
.time {
font-size: 16px;
}
}
video {
width: 100%;
height: 100%;
......@@ -93,7 +115,8 @@ $tabHeight: 44px;
height: $tabHeight;
font-size: $font_16;
border-bottom: 1px solid transparent;
&.active{
&.active {
border-bottom: 1px solid $active;
}
}
......
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