Commit 8ea87862 by xuzhenghua

detail

parent f5f110dc
...@@ -9,6 +9,8 @@ import {http, api} from '@/utils' ...@@ -9,6 +9,8 @@ import {http, api} from '@/utils'
import LiveRoom from './liveRoom' import LiveRoom from './liveRoom'
import {Link} from "react-router-dom" import {Link} from "react-router-dom"
import {Toast} from 'antd-mobile' import {Toast} from 'antd-mobile'
import {CallApp} from '../../common'
const animateTypes = Swiper.animateTypes const animateTypes = Swiper.animateTypes
...@@ -98,7 +100,9 @@ class Index extends Component { ...@@ -98,7 +100,9 @@ class Index extends Component {
<div className='header'> <div className='header'>
<img className="logo" <img className="logo"
src="http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/img/index/logo.png" alt=""/> src="http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/img/index/logo.png" alt=""/>
<button className='to-app'>APP打开</button> {/*<button className='to-app'>在APP打开</button>*/}
<CallApp className='to-app'></CallApp>
<i className='iconfont iconiconfront- search' onClick={this.toSearch.bind(this)}></i> <i className='iconfont iconiconfront- search' onClick={this.toSearch.bind(this)}></i>
</div> </div>
...@@ -252,7 +256,7 @@ function ScrollBox(props) { ...@@ -252,7 +256,7 @@ function ScrollBox(props) {
<span className='no-start'>即将开始</span> <span className='no-start'>即将开始</span>
} }
{ {
item.live_status === 1 && (item.live_status === 1 || item.live_status === 10) &&
<span className='start'>正在直播</span> <span className='start'>正在直播</span>
} }
<img className="item-img" src={item.live_img} alt=""/> <img className="item-img" src={item.live_img} alt=""/>
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
} }
.to-app { .to-app {
display: inline-block;
text-align: center;
margin-left: 10px; margin-left: 10px;
width: 88px; width: 88px;
height: 22px; height: 22px;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
background: $bg_f4f4f4; background: $bg_f4f4f4;
padding-bottom: 50px; padding-bottom: 50px;
.indicator { .indicator {
color: $color_FE2F2F; color: $color_FE2F2F;
} }
......
import React, {Component} from 'react' import React, {Component, useState} from 'react'
import './bargain-middle-page.scss' import './bargain-middle-page.scss'
import classnames from 'classnames' import classnames from 'classnames'
import {HeaderBar, VList} from '@common' import {HeaderBar, VList} from '@common'
import {Course} from '@common' import {Course} from '@common'
import {api, getParam, http} from "@/utils" import {api, getParam, http} from "@/utils"
import {Toast} from "antd-mobile" import {Flex, Toast} from "antd-mobile"
import {Link, withRouter} from "react-router-dom" import {Link, withRouter} from "react-router-dom"
import Ranking from './ranking' import Ranking from './ranking'
import {getHours, getMinutes, getSeconds} from "date-fns" import {differenceInSeconds, differenceInMinutes, differenceInHours} from "date-fns"
import Overlay from '../detail/overlay' import Overlay from '../detail/overlay'
import {compose} from "redux" import {compose} from "redux"
...@@ -28,7 +28,10 @@ class BargainMiddlePage extends Component { ...@@ -28,7 +28,10 @@ class BargainMiddlePage extends Component {
list: [], list: [],
width: '0', width: '0',
isShowMore: '', isShowMore: '',
status: '' status: '',
hour: '',
min: '',
sec: ''
} }
} }
...@@ -40,7 +43,8 @@ class BargainMiddlePage extends Component { ...@@ -40,7 +43,8 @@ class BargainMiddlePage extends Component {
// 获取砍价信息 // 获取砍价信息
getBargainInfo = () => { getBargainInfo = () => {
http.get(`${api.home}/m/bargain/info?bargaincode=3133332c343739343131&is_originator=1`).then((res) => {
http.get(`${api.home}/m/bargain/info?bargaincode=${getParam('bargaincode')}&is_originator=${getParam('is_originator')}`).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
data: res.data.data, data: res.data.data,
...@@ -220,14 +224,26 @@ class BargainMiddlePage extends Component { ...@@ -220,14 +224,26 @@ class BargainMiddlePage extends Component {
} }
render() { render() {
let date, h, m, s let h, m, s
if (this.state.bargainData.expire_time) { if (this.state.bargainData.expire_time) {
date = new Date(this.state.bargainData.expire_time * 1000)
h = <span className={'time hour'}>{getHours(date)}</span> let date = this.state.bargainData.expire_time * 1000
m = <span className={'time hour'}>{getMinutes(date)}</span> let now = Date.now()
s = <span className={'time hour'}>{getSeconds(date)}</span> setInterval(() => {
date -= 1000
let s = differenceInSeconds(new Date(date), now) % 60,
m = differenceInMinutes(new Date(date), now) % 60,
h = differenceInHours(new Date(date), now) % 24
this.setState({
hour: h,
min: m,
sec: s
})
}, 1000)
} }
let thirdRow, btn let thirdRow, btn
// is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用 // is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用
if (this.state.bargainData.is_artifact === 0) { if (this.state.bargainData.is_artifact === 0) {
...@@ -280,10 +296,19 @@ class BargainMiddlePage extends Component { ...@@ -280,10 +296,19 @@ class BargainMiddlePage extends Component {
{ {
this.state.data.bargain_status === 0 && this.state.data.bargain_status === 0 &&
<div> <div>
{h} : {m} : {s} {this.state.time}
<span
className={'time hour'}>{String(this.state.hour).padStart(2, 0)}</span> :&nbsp;
<span
className={'time min'}>{String(this.state.min).padStart(2, 0)}</span> :&nbsp;
<span className={'time sec'}>{String(this.state.sec).padStart(2, 0)}</span>
<span className={'inactive'}> 后砍价结束</span> <span className={'inactive'}> 后砍价结束</span>
</div> </div>
} }
{
this.state.data.bargain_status === 1 && this.state.isOriginator === '1' &&
<span className={'inactive'}>砍价结束</span>
}
</div> </div>
<div className="middle"> <div className="middle">
...@@ -292,10 +317,24 @@ class BargainMiddlePage extends Component { ...@@ -292,10 +317,24 @@ class BargainMiddlePage extends Component {
{ {
this.state.isOriginator === '1' && this.state.data.bargain_status === 0 && this.state.isOriginator === '1' && this.state.data.bargain_status === 0 &&
<div> <div>
<div className='third-row'>
{thirdRow} {thirdRow}
</div>
<div>
{btn} {btn}
</div> </div>
</div>
}
{
this.state.isOriginator === '1' && this.state.data.bargain_status === 1 &&
<div>
砍价金额将于
{h} : {m} : {s}
后清零,请尽快完成支付
</div>
} }
<div className={'button'}> <div className={'button'}>
{bargainBtn} {bargainBtn}
</div> </div>
......
import React, {Component} from 'react' import React, {Component, useState} from 'react'
import './bargain.scss' import './bargain.scss'
import {Flex, Toast} from "antd-mobile" import {Flex, Toast} from "antd-mobile"
import Overlay from '../overlay' import Overlay from '../overlay'
import BargainInfo from './bargainInfo' import BargainInfo from './bargainInfo'
import {getHours, getMinutes, getSeconds} from "date-fns" import {differenceInSeconds, differenceInMinutes, differenceInHours} from "date-fns"
import {api, getParam, http} from "@/utils" import {api, getParam, http} from "@/utils"
import Ranking from "@/components/bargainMiddlePage/ranking" import Ranking from "@/components/bargainMiddlePage/ranking"
import {compose} from "redux" import {compose} from "redux"
...@@ -21,7 +21,8 @@ class Bargain extends Component { ...@@ -21,7 +21,8 @@ class Bargain extends Component {
list: [], list: [],
limitPeople: '', limitPeople: '',
status: '', status: '',
bargainCode: '' bargainCode: '',
time: ''
} }
} }
...@@ -61,7 +62,7 @@ class Bargain extends Component { ...@@ -61,7 +62,7 @@ class Bargain extends Component {
bargainCode: res.data.data.bargain_code bargainCode: res.data.data.bargain_code
}) })
if (res.data.data.bargain_status === 0) { if (res.data.data.bargain_status === 0) {
this.getBargainRankList(getParam('id'), 1) this.getBargainRankList(getParam('id'), 0)
} }
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
...@@ -183,7 +184,6 @@ class Bargain extends Component { ...@@ -183,7 +184,6 @@ class Bargain extends Component {
this.state.info.bargain_status === 2 && this.state.info.bargain_status === 2 &&
<BargainIntro limitPeople={this.state.limitPeople} iWantBargain={this.iWantBargain}/> <BargainIntro limitPeople={this.state.limitPeople} iWantBargain={this.iWantBargain}/>
} }
{console.log(this.state.outList, 11)}
{ {
(this.state.info.bargain_status === 0 || this.state.info.bargain_status === 1) && (this.state.info.bargain_status === 0 || this.state.info.bargain_status === 1) &&
<BargainStatus <BargainStatus
...@@ -265,7 +265,12 @@ function BargainIntro(props) { ...@@ -265,7 +265,12 @@ function BargainIntro(props) {
} }
function BargainStatus(props) { function BargainStatus(props) {
console.log(props, 1)
const [hour, setHour] = useState()
const [min, setMin] = useState()
const [sec, setSec] = useState()
let thirdRow, btn let thirdRow, btn
// is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用 // is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用
if (props.info.is_artifact === 0) { if (props.info.is_artifact === 0) {
...@@ -279,7 +284,18 @@ function BargainStatus(props) { ...@@ -279,7 +284,18 @@ function BargainStatus(props) {
thirdRow = <div>恭喜你获得<span className={'indicator'}>【砍价神器】</span></div> thirdRow = <div>恭喜你获得<span className={'indicator'}>【砍价神器】</span></div>
btn = <button onClick={props.useArtifact}>立即使用</button> btn = <button onClick={props.useArtifact}>立即使用</button>
} }
let date = new Date(props.info.end_time * 1000)
let date = props.info.end_time * 1000
let now = Date.now()
setInterval(() => {
date -= 1000
setSec(differenceInSeconds(new Date(date), now) % 60)
setMin(differenceInMinutes(new Date(date), now) % 60)
setHour(differenceInHours(new Date(date), now) % 24)
}, 1000)
return ( return (
<div className="status-outer"> <div className="status-outer">
...@@ -292,9 +308,9 @@ function BargainStatus(props) { ...@@ -292,9 +308,9 @@ function BargainStatus(props) {
<div className={'first-row'}> <div className={'first-row'}>
<div> <div>
已砍<span className={'indicator'}>{props.info.bargain_price}</span> 已砍<span className={'indicator'}>{props.info.bargain_price}</span>
<span className={'time hour'}>{getHours(date)}</span> :&nbsp; <span className={'time hour'}>{String(hour).padStart(2,0)}</span> :&nbsp;
<span className={'time min'}>{getMinutes(date)}</span> :&nbsp; <span className={'time min'}>{String(min).padStart(2,0)}</span> :&nbsp;
<span className={'time sec'}>{getSeconds(date)}</span> <span className={'time sec'}>{String(sec).padStart(2,0)}</span>
<span className='over'>后砍价结束</span> <span className='over'>后砍价结束</span>
</div> </div>
<div onClick={props.getMore}>{props.info.assist_num}位好友助力></div> <div onClick={props.getMore}>{props.info.assist_num}位好友助力></div>
...@@ -336,9 +352,9 @@ function BargainStatus(props) { ...@@ -336,9 +352,9 @@ function BargainStatus(props) {
</div> </div>
<div className="time-tobuy"> <div className="time-tobuy">
砍价金额将于 砍价金额将于
<span className={'time hour'}>{getHours(date)}</span> :&nbsp; <span className={'time hour'}>{String(hour).padStart(2,0)}</span> :&nbsp;
<span className={'time min'}>{getMinutes(date)}</span> :&nbsp; <span className={'time min'}>{String(min).padStart(2,0)}</span> :&nbsp;
<span className={'time sec'}>{getSeconds(date)}</span> <span className={'time sec'}>{String(sec).padStart(2,0)}</span>
后清零,请尽快完成支付 后清零,请尽快完成支付
</div> </div>
</Flex> </Flex>
......
...@@ -65,7 +65,7 @@ class BtnStatus extends Component { ...@@ -65,7 +65,7 @@ class BtnStatus extends Component {
isShowOverlay: false, isShowOverlay: false,
bargainStatus: '', bargainStatus: '',
}) })
document.location.reload() window.location.href = '/shopcart'
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
} }
...@@ -189,7 +189,7 @@ class BtnStatus extends Component { ...@@ -189,7 +189,7 @@ class BtnStatus extends Component {
{ {
(barInfo.bargain_status === 0 || barInfo.bargain_status === 1) && (barInfo.bargain_status === 0 || barInfo.bargain_status === 1) &&
<button className='btn btn-s bg-E02E24'> <button className='btn btn-s bg-E02E24'>
<span>¥1</span> <span>¥{barInfo.amount}</span>
<span onClick={e => this.toCart(2)}>去支付</span> <span onClick={e => this.toCart(2)}>去支付</span>
</button> </button>
} }
......
...@@ -26,18 +26,24 @@ class Detail extends Component { ...@@ -26,18 +26,24 @@ class Detail extends Component {
singleBox: false, singleBox: false,
shareRank: false, shareRank: false,
singMess: '', singMess: '',
barInfo: '', barInfo: ''
} }
} }
componentDidMount() { componentDidMount() {
this.props.fetchCoursesListIfNeeded() this.props.fetchCoursesListIfNeeded()
this.getBargainInfo()
} }
componentDidUpdate() { componentDidUpdate(prevProps) {
// console.log(this.props.courseInfo.course_info) let {courseInfo} = this.props
let {courseInfo: prevCourseInfo} = prevProps
if (courseInfo && courseInfo.is_bargain) {
if (prevCourseInfo && courseInfo.is_bargain !== prevCourseInfo.is_bargain) {
this.getBargainInfo()
}
} }
}
// 点击子组件试听按钮 // 点击子组件试听按钮
toAudition = () => { toAudition = () => {
...@@ -170,7 +176,7 @@ class Detail extends Component { ...@@ -170,7 +176,7 @@ class Detail extends Component {
<OutLine data={this.props.courseInfo} toAudition={this.toAudition} toSingleset={this.toSingleset}/> <OutLine data={this.props.courseInfo} toAudition={this.toAudition} toSingleset={this.toSingleset}/>
{/*课程按钮*/} {/*课程按钮*/}
<BtnStatus data={this.props.courseInfo} barInfo={this.state.barInfo} getBargainInfo={this.getBargainInfo}></BtnStatus> <BtnStatus data={this.props.courseInfo} barInfo={this.state.barInfo}></BtnStatus>
</div> </div>
) )
} }
......
...@@ -64,7 +64,7 @@ class My extends PureComponent { ...@@ -64,7 +64,7 @@ class My extends PureComponent {
</Link> </Link>
{ {
(isVIP === 0 || !isVIP) && (isVIP === 0 || !isVIP) &&
<div className="my-isvip"></div> <Link className="my-isvip" to={`/detail?id=139`}></Link>
} }
</List> </List>
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
} }
.my-isvip { .my-isvip {
display: inline-block;
width: 100%; width: 100%;
height: 43px; height: 43px;
background-image: url("./image/vip_bg.png"); background-image: url("./image/vip_bg.png");
......
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