Commit 51265987 by zhanghaozhe

限时免费

parent e1cc8ecf
...@@ -525,7 +525,6 @@ class BtnStatus extends Component { ...@@ -525,7 +525,6 @@ class BtnStatus extends Component {
} }
{ {
//todo 联调
info.is_limit_free && info.limit_free_status == 0 && <div className='btns-box'> info.is_limit_free && info.limit_free_status == 0 && <div className='btns-box'>
<a className='consult consult-m' onClick={()=>this.qimoChatClick()}> <a className='consult consult-m' onClick={()=>this.qimoChatClick()}>
<i className='iconfont iconerji'></i> <i className='iconfont iconerji'></i>
......
...@@ -619,7 +619,6 @@ class Detail extends Component { ...@@ -619,7 +619,6 @@ class Detail extends Component {
</div> </div>
} }
{ {
//todo 联调
course_info.is_limit_free course_info.is_limit_free
? ?
course_info.limit_free_status == 0 course_info.limit_free_status == 0
......
...@@ -92,7 +92,11 @@ class LimitFree extends Component { ...@@ -92,7 +92,11 @@ class LimitFree extends Component {
this.getData() this.getData()
}}>知道了 }}>知道了
</button> </button>
<button onClick={this.toPlay.bind(this, id)}>立即学习</button> <button onClick={() => {
this.toPlay(id)
instance.close()
}}>立即学习
</button>
</div> </div>
}) })
...@@ -169,7 +173,11 @@ class LimitFree extends Component { ...@@ -169,7 +173,11 @@ class LimitFree extends Component {
bottom = <div className={'bottom'}> bottom = <div className={'bottom'}>
<span className={'red'}>限时免费</span> <span className={'red'}>限时免费</span>
<span className={'origin-price'}>¥{item.price0}</span> <span className={'origin-price'}>¥{item.price0}</span>
<button onClick={this.getCourse.bind(this, item.course_id)}>免费领取</button> <button onClick={e => {
e.stopPropagation()
this.getCourse(item.course_id)
}}>免费领取
</button>
</div> </div>
break break
case 1: case 1:
......
import React, { Component } from 'react' import React, { Component } from 'react'
import HeaderBar from '@/common/HeaderBar' import HeaderBar from '@/common/HeaderBar'
import './video.scss' import './video.scss'
import { NavLink, Route, Redirect, Switch} from 'react-router-dom' import { NavLink, Route, Redirect, Switch } from 'react-router-dom'
import { http, getParam, browser } from '@/utils' import { http, getParam, browser } from '@/utils'
import Recommendation from './recommendation' import Recommendation from './recommendation'
import VideoCatalog from './video-catalog' import VideoCatalog from './video-catalog'
...@@ -9,8 +9,8 @@ import DatumCatalog from './datum-catalog' ...@@ -9,8 +9,8 @@ import DatumCatalog from './datum-catalog'
import { Toast } from 'antd-mobile' 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' import { Loading } from '@/common'
import { connect } from "react-redux" import { connect } from "react-redux"
import jsCookie from 'js-cookie' import jsCookie from 'js-cookie'
import Single from "@/components/detail/single"; import Single from "@/components/detail/single";
...@@ -104,12 +104,12 @@ class Video extends Component { ...@@ -104,12 +104,12 @@ class Video extends Component {
nowPrice: 0,// 单集购买需要 nowPrice: 0,// 单集购买需要
laterPrice: 0,// 单集购买需要 laterPrice: 0,// 单集购买需要
limitFreeNoPromptChecked: false, limitFreeNoPromptChecked: false,
showLimitFreePopup: true //todo 联调 showLimitFreePopup: false,
limitFreePopup: {}
} }
componentDidMount() { componentDidMount() {
console.log(this.props.location.hash)
if (window.location.protocol === 'https:') { if (window.location.protocol === 'https:') {
window.location.replace('http' + window.location.href.slice(5)) window.location.replace('http' + window.location.href.slice(5))
return return
...@@ -527,6 +527,11 @@ class Video extends Component { ...@@ -527,6 +527,11 @@ class Video extends Component {
} }
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null; this.timer = null;
if (this.state.limitFreePopup.is_free) {
this.setState({
showLimitFreePopup: true
})
}
}) })
} }
...@@ -607,6 +612,7 @@ class Video extends Component { ...@@ -607,6 +612,7 @@ class Video extends Component {
}), }),
this.playSetup this.playSetup
) )
this.getLimitFreePopup(data.course.course_id)
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
} }
...@@ -736,9 +742,54 @@ class Video extends Component { ...@@ -736,9 +742,54 @@ class Video extends Component {
} }
} }
getLimitFreePopup = id => {
http.post(`${API.home}/sys/popup`, {
course_id: id
})
.then(res => {
const {code, msg, data} = res.data
if (code === 200) {
this.setState({
limitFreePopup: data
})
} else {
Toast.info(msg, 2, null, false)
}
})
}
checkNeverShowLimitFreePopup = () => {
http.post(`${API.home}/sys/checklist`, {
course_id: this.state.course.course_id
})
.then(res => {
const {code, msg} = res.data
if (code === 200) {
this.setState({
limitFreePopup: {...this.state.limitFreePopup, is_free: 0}
})
}else {
Toast.info(msg, 2, null, false)
}
})
}
render() { render() {
let {match, location, history} = this.props let {match, location, history} = this.props
const {videoList, activeIndex, isAuth, salePrice, course, singleBox, singleType, showLimitFreePopup} = this.state; const {
videoList,
activeIndex,
isAuth,
salePrice,
course,
singleBox,
singleType,
showLimitFreePopup,
limitFreePopup
} = this.state;
let toHref = ''; let toHref = '';
if (location.state && location.state.to && location.state.to === 'detail') { if (location.state && location.state.to && location.state.to === 'detail') {
toHref = `/detail?id=${course.course_id}` toHref = `/detail?id=${course.course_id}`
...@@ -875,13 +926,13 @@ class Video extends Component { ...@@ -875,13 +926,13 @@ class Video extends Component {
<div className={'limit-free-cover'}> <div className={'limit-free-cover'}>
<div className="free-popup"> <div className="free-popup">
<div className="title"> <div className="title">
<span>想领取【AI工程师必备干货礼包】? 想深入了解进阶课程? 职业前景不明朗? 资深规划师免费为你服务!</span> <span>{limitFreePopup.pop_descbition}</span>
</div> </div>
<div className={'des'}> <div className={'des'}>
<img className="qrcode" <img className="qrcode"
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/tinypng-common/right_weixin.png" alt=''/> src={limitFreePopup.wechat_img} alt=''/>
<span>长按/扫码识别</span> <span>长按/扫码识别</span>
<span>添加时请备注<span>142</span>哦</span> <span>添加时请备注<span>{course.course_id}</span>哦</span>
<div className="no-prompt"> <div className="no-prompt">
<label htmlFor="no-prompt"> <label htmlFor="no-prompt">
<span className={`checkbox-label ${this.state.limitFreeNoPromptChecked ? 'checked' : 'unchecked'}`}> <span className={`checkbox-label ${this.state.limitFreeNoPromptChecked ? 'checked' : 'unchecked'}`}>
...@@ -900,7 +951,7 @@ class Video extends Component { ...@@ -900,7 +951,7 @@ class Video extends Component {
this.setState({ this.setState({
showLimitFreePopup: false showLimitFreePopup: false
}) })
localStorage.setItem('neverShowLimitFreePopup', '1') this.checkNeverShowLimitFreePopup()
}}/> }}/>
</div> </div>
</div> </div>
......
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