index.js 32.6 KB
Newer Older
xuzhenghua committed
1
import React, {Component} from 'react'
xuzhenghua committed
2
import './index.scss'
zhanghaozhe committed
3
import Bargain from './bargain'
xuzhenghua committed
4
import Group from './group'
xuzhenghua committed
5
import OutLine from './outline'
xuzhenghua committed
6
import {HeaderBar, CallApp} from '../../common'
xuzhenghua committed
7 8 9
import ShareRank from "./shareRank"
import Audition from "./audition"
import Single from "./single"
FE committed
10
import SingleSuccess from './single/singleSuccess';
xuzhenghua committed
11
import BtnStatus from "./btnstatus"
2  
xuzhenghua committed
12
import Barrage from './barrage'
xuzhenghua committed
13
import Deposit from './deposit'
xuzhenghua committed
14 15 16 17 18
import {connect} from "react-redux"
import {getCourses, addCourseToCart} from "./actions"
import {getParam, http, browser, wxShare} from "@/utils"
import {Toast} from 'antd-mobile'
import {bindActionCreators} from "redux";
FE committed
19
import {delCountryNum} from './../country/countryRedux';
xuzhenghua committed
20

FE committed
21
import RedPacket from './redPacket';
xuzhenghua committed
22
import {Link} from "react-router-dom";
xuzhenghua committed
23
import ExpandActiveToast from "../Index/expandActiveToast";
FE committed
24

xuzhenghua committed
25
class Detail extends Component {
xuzhenghua committed
26

wangshuo committed
27 28
    courseId

xuzhenghua committed
29 30 31 32 33 34
    constructor(props) {
        super(props)
        this.state = {
            isbuy: 0,
            isvip: 0,
            auditionBox: false,
FE committed
35

xuzhenghua committed
36
            singleBox: false,
FE committed
37 38
            singleType: 1,

xuzhenghua committed
39
            shareRank: false,
xuzhenghua committed
40 41
            singMess: '',
            barInfo: '',
xuzhenghua committed
42
            share: false,
wangshuo committed
43
            countdown: '00:00:00',
44 45
            outList: [],
            list: [],
wangshuo committed
46 47 48 49
            course: {},

            nowPrice: 0,
            laterPrice: 0,
xuzhenghua committed
50
            isPdd: 0, // 是否是拼团课程 控制首次单集购买后的 全集购买 接口: 拼团课程走拼团接口,否则直接走购买接口
xuzhenghua committed
51 52 53
            isRedPacket: true,

            countDownTime: '20s',
xuzhenghua committed
54 55 56 57
        }
    }

    componentDidMount() {
58
        this.fetchCourseInfo();
2  
xuzhenghua committed
59 60
        const {location: {state = {}}} = this.props;
        if (state.oid) {
FE committed
61 62
            this.check(state.oid);
        }
wangshuo committed
63 64 65 66 67 68
        if (getParam('is_class') === 1 || getParam('weixinpay')) {
            this.payCallback()
        }
        if (browser.isWeixin) {
            this.isweixinPay()
        }
FE committed
69 70 71 72

        this.judgeIsRedPacket();

        // 红包链接进入详情也
xuzhenghua committed
73
        if (getParam('share_code')) {
FE committed
74 75 76 77
            this.setState({
                isRedPacket: true
            });
        }
xuzhenghua committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

        if(getParam('ac') && Number(getParam('ac')) === 11) {
            this.getBorwerCourse();
        }

    }

    getBorwerCourse = () => {
        http.get(`${API.home}/sys/user/blessing`, {type: 4, course_id: getParam('id')}).then(res => {
            let {code, data: {today_browsed_courses}} = res.data;
            if(code === 200) {
                let currentCourseId = getParam('id');
                if(today_browsed_courses.includes(Number(currentCourseId))) {
                    this.setState({
                        countDownTime: '任务完成'
                    });
                }else{
                    this.startActivity();
                }
            }
        })
    }

    startActivity = () => {
        let _this = this;
        let countDownInterval = setInterval(function() {
            let countDown = parseInt(_this.state.countDownTime);
            countDown--;
            if(countDown > 0) {
                _this.setState({
                    countDownTime: countDown + 's'
                });
            } else if(countDown === 0) {
                clearInterval(countDownInterval);
                countDownInterval = null;
                http.post(`${API.home}/sys/add/blessing`, {type: 4, course_id: getParam('id')}).then(res => {
                    let {code} = res.data;
                    if(code === 200) {
                        _this.setState({
                            countDownTime: '任务完成'
                        });
                    }
                })
            }
        }, 1000)
FE committed
123 124 125 126 127
    }

    // 判断时候未红包课程
    judgeIsRedPacket = () => {
        http.get(`${API.home}/sys/redPacket/showShareActive/${getParam('id')}`).then(res => {
xuzhenghua committed
128 129
            const {code, data} = res.data;
            if (code === 200) {
FE committed
130 131 132 133 134
                this.setState({
                    isRedPacket: data.is_show
                });
            }
        })
wangshuo committed
135
    }
zhanghaozhe committed
136 137

    componentDidUpdate(prevProps) {
2  
xuzhenghua committed
138
        if (prevProps.user.hasError !== this.props.user.hasError) {
zhanghaozhe committed
139 140 141 142
            this.fetchCourseInfo()
        }
    }

2  
xuzhenghua committed
143
    payCallback = () => {
wangshuo committed
144
        const _this = this;
2  
xuzhenghua committed
145
        if (!getParam('oid')) {
wangshuo committed
146
            return;
2  
xuzhenghua committed
147
        } else {
xuzhenghua committed
148 149 150
            this.setState({
                singMess: JSON.parse(window.localStorage.getItem('singMess'))
            })
wangshuo committed
151 152 153 154 155 156 157 158 159
            _this.intervalPayStatus = setInterval(function () {
                http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => {
                    if (res.data.errno === 401) {
                        clearInterval(_this.intervalPayStatus);
                        _this.intervalPayStatus = null;
                        // 获取课程类型
                        http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => {
                            if (Number(res.data.data.errno) === 200) {
                                // 正常购买单集成功
wangshuo committed
160
                                _this.setState({
wangshuo committed
161 162 163 164
                                    singleType: 6,
                                })
                            } else if (Number(res.data.data.errno) === 201) {
                                // 0元参团
wangshuo committed
165
                                _this.setState({
wangshuo committed
166 167 168 169
                                    singleType: 4,
                                })
                            } else if (Number(res.data.data.errno) === 202) {
                                // 0元购
wangshuo committed
170
                                _this.setState({
wangshuo committed
171 172 173 174
                                    singleType: 3,
                                })
                            } else if (Number(res.data.data.errno) === 203) {
                                // 三天内特价
wangshuo committed
175
                                _this.setState({
wangshuo committed
176 177 178
                                    nowPrice: res.data.data.data.now_price,
                                    laterPrice: res.data.data.data.three_day_later_price,
                                    singleType: 2,
xuzhenghua committed
179
                                    isPdd: res.data.data.data.is_pdd,
wangshuo committed
180 181 182 183 184 185 186 187 188 189
                                })
                            } else {
                                Toast.info(res.data.data.msg, 2)
                            }
                        })
                    }
                })
            }, 1000)
        }
    };
2  
xuzhenghua committed
190
    isweixinPay = () => {
wangshuo committed
191 192 193 194 195 196 197
        let _this = this;
        let weixin_code = getParam('code');
        if (weixin_code) {
            if (!getParam('oid')) {
                return
            } else {
                // this.props.weixinPay(weixin_code)
xuzhenghua committed
198 199 200
                this.setState({
                    singMess: JSON.parse(window.localStorage.getItem('singMess'))
                });
wangshuo committed
201 202 203
                http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => {
                    if (res.data.errno === 0) {
                        const data = res.data.data;
2  
xuzhenghua committed
204

wangshuo committed
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
                        function onBridgeReady() {
                            WeixinJSBridge.invoke(
                                'getBrandWCPayRequest', {
                                    "appId": data.appId,                //公众号名称,由商户传入
                                    "timeStamp": data.timeStamp,        //时间戳,自1970年以来的秒数
                                    "nonceStr": data.nonceStr,          //随机串
                                    "package": data.package,
                                    "signType": data.signType,          //微信签名方式:
                                    "paySign": data.paySign             //微信签名
                                },
                                function (res) {
                                    if (res.err_msg == "get_brand_wcpay_request:ok") {
                                        Toast.info('支付成功', 2);
                                        _this.intervalPayStatus = setInterval(function () {
                                            http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => {
                                                if (res.data.errno === 401) {
                                                    clearInterval(_this.intervalPayStatus);
                                                    _this.intervalPayStatus = null;
                                                    // 获取课程类型
                                                    http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => {
                                                        if (Number(res.data.data.errno) === 200) {
                                                            // 正常购买单集成功
wangshuo committed
227
                                                            _this.setState({
wangshuo committed
228 229 230 231
                                                                singleType: 6,
                                                            })
                                                        } else if (Number(res.data.data.errno) === 201) {
                                                            // 0元参团
wangshuo committed
232
                                                            _this.setState({
wangshuo committed
233 234 235 236
                                                                singleType: 4,
                                                            })
                                                        } else if (Number(res.data.data.errno) === 202) {
                                                            // 0元购
wangshuo committed
237
                                                            _this.setState({
wangshuo committed
238 239 240 241
                                                                singleType: 3,
                                                            })
                                                        } else if (Number(res.data.data.errno) === 203) {
                                                            // 三天内特价
wangshuo committed
242
                                                            _this.setState({
wangshuo committed
243 244 245
                                                                nowPrice: res.data.data.data.now_price,
                                                                laterPrice: res.data.data.data.three_day_later_price,
                                                                singleType: 2,
xuzhenghua committed
246
                                                                isPdd: res.data.data.data.is_pdd,
wangshuo committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260
                                                            })
                                                        } else {
                                                            Toast.info(res.data.data.msg, 2)
                                                        }
                                                    })
                                                }
                                            })
                                        }, 1000)
                                    } else {
                                        alert('支付失败')
                                    }
                                }
                            )
                        }
2  
xuzhenghua committed
261

wangshuo committed
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
                        if (typeof WeixinJSBridge == "undefined") {
                            if (document.addEventListener) {
                                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false)
                            } else if (document.attachEvent) {
                                document.attachEvent('WeixinJSBridgeReady', onBridgeReady)
                                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady)
                            }
                        } else {
                            onBridgeReady()
                        }
                    } else {
                        Toast.info(res.data.msg, 2)
                    }
                })
            }
        }
FE committed
278 279 280 281
    }

    // 判断支付是否成功
    check = (oid) => {
xuzhenghua committed
282 283 284
        this.setState({
            singMess: JSON.parse(window.localStorage.getItem('singMess'))
        })
FE committed
285 286 287 288
        http.get(`${API['base-api']}/class_order_status/${oid}`).then((res) => {
            if (Number(res.data.data.errno) === 200) {
                // 正常购买单集成功
                this.setState({
xuzhenghua committed
289
                    singleType: 6
FE committed
290 291 292 293
                })
            } else if (Number(res.data.data.errno) === 201) {
                // 0元参团
                this.setState({
xuzhenghua committed
294
                    singleType: 4
FE committed
295 296 297 298
                })
            } else if (Number(res.data.data.errno) === 202) {
                // 0元购
                this.setState({
xuzhenghua committed
299
                    singleType: 3
FE committed
300 301 302 303 304 305 306
                })
            } else if (Number(res.data.data.errno) === 203) {
                // 三天内特价
                this.setState({
                    nowPrice: res.data.data.data.now_price,
                    laterPrice: res.data.data.data.three_day_later_price,
                    singleType: 2,
xuzhenghua committed
307
                    isPdd: res.data.data.data.is_pdd,
xuzhenghua committed
308

FE committed
309 310 311 312 313
                })
            } else {
                Toast.info(res.data.data.msg, 2)
            }
        })
314
    }
xuzhenghua committed
315

wangshuo committed
316
    payCallBack = (singleType, nowPrice, laterPrice) => {
wangshuo committed
317
        // Toast.info(singleType, 2);
wangshuo committed
318
        const _this = this;
2  
xuzhenghua committed
319
        if (singleType === 2) {
wangshuo committed
320 321 322 323 324
            _this.setState({
                singleType,
                nowPrice,
                laterPrice
            })
2  
xuzhenghua committed
325
        } else {
wangshuo committed
326 327 328
            _this.setState({
                singleType,
            })
wangshuo committed
329 330
        }
    };
331 332 333 334 335
    fetchCourseInfo = () => {
        const id = getParam('id');
        http.get(`${API.home}/m/course/detail/${id}`).then((res) => {
            const {data, code} = res.data;
            if (code === 200) {
xuzhenghua committed
336 337 338
                if(data['redirect_url'] !== ''){
                    window.location.href = data['redirect_url']
                }
339 340 341
                this.setState({
                    course: data
                });
FE committed
342
                if (data.course_info) {
xuzhenghua committed
343 344 345 346
                    if(data.course_info.is_it_course == 1){
                        this.props.history.push(`/python?id=${id}`)
                    }

FE committed
347
                    let course_info = data.course_info;
wangshuo committed
348
                    document.title = `${course_info.course_title} - 七月在线`;
FE committed
349 350
                    if (course_info.group_status === 3 || course_info.group_status === 4) {
                        let endTime = course_info.pdd_group_info.groupon_member.end_time;
FE committed
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
                        if(endTime && endTime > 0) {
                            let date = endTime * 1000,
                                hours = 0,
                                minutes = 0,
                                seconds = 0;
                            setInterval(() => {
                                date -= 1000
                                hours = `${parseInt(date / (60 * 60 * 1000))}`.padStart(2, 0);
                                minutes = `${parseInt((date - hours * 3600000) / 60000)}`.padStart(2, 0);
                                seconds = `${parseInt((date - hours * 3600000 - minutes * 60000) / 1000)}`.padStart(2, 0);
                                this.setState({
                                    countdown: `${hours}:${minutes}:${seconds}`
                                });
                            }, 1000)
                        }
FE committed
366
                    }
xuzhenghua committed
367 368 369 370
                    wxShare({
                        title: course_info.course_title,
                        desc: course_info.index_description,
                        link: encodeURI(location.origin + '/detail?id=' + getParam('id')),
2  
xuzhenghua committed
371
                        imgUrl: course_info.image_name
xuzhenghua committed
372
                    });
FE committed
373 374
                }

375 376
            }
        });
xuzhenghua committed
377 378
    }

xuzhenghua committed
379
    // 点击子组件试听按钮
xuzhenghua committed
380
    toAudition = (vCourseId,videoId) => {
xuzhenghua committed
381 382 383 384 385
        const {user} = this.props
        const uid = user && user.data && user.data.uid
        if (!uid) {
            this.props.history.push('/passport/login')
        } else {
xuzhenghua committed
386 387 388 389 390 391 392 393 394
            if(videoId == '' || videoId == 0 || videoId == undefined){
                return false;
            }
            http.post(`${API['base-api']}/sys/get_class_audition?video_id=${videoId}`).then((res) => {
                if (res.data.errno == 200) {
                    this.props.history.push(`/play/video?id=${vCourseId + '&video_id=' + videoId}`)
                }else {
                    Toast.info(res.data.msg, 2);
                }
xuzhenghua committed
395
            })
xuzhenghua committed
396 397 398
            // this.setState({
            //     auditionBox: true,
            // })
xuzhenghua committed
399
        }
xuzhenghua committed
400
    }
xuzhenghua committed
401
    // 点击子组件单集购买按钮
xuzhenghua committed
402
    toSingleset = (item) => {
xuzhenghua committed
403 404 405 406 407 408 409
        const {user} = this.props
        const uid = user && user.data && user.data.uid
        if (!uid) {
            this.props.history.push('/passport/login')
        } else {
            this.setState({
                singleBox: true,
FE committed
410
                singleType: 1,
xuzhenghua committed
411
                singMess: item
FE committed
412
            });
xuzhenghua committed
413
            window.localStorage.setItem('singMess', JSON.stringify(item))
xuzhenghua committed
414
        }
xuzhenghua committed
415 416
    }

417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
    // componentWillReceiveProps(nextProps) {
    //     let _this = this;
    //     if (nextProps.courseInfo.course_info) {
    //         let courseInfo = nextProps.courseInfo.course_info;
    //         if (courseInfo.group_status === 3 || courseInfo.group_status === 4) {
    //             let endTime = courseInfo.pdd_group_info.groupon_member.end_time;
    //             let date = endTime * 1000,
    //                 hours = 0,
    //                 minutes = 0,
    //                 seconds = 0;
    //             setInterval(() => {
    //                 date -= 1000
    //                 hours = `${parseInt(date / (60 * 60 * 1000))}`.padStart(2, 0);
    //                 minutes = `${parseInt((date - hours * 3600000) / 60000)}`.padStart(2, 0);
    //                 seconds = `${parseInt((date - hours * 3600000 - minutes * 60000) / 1000)}`.padStart(2, 0);
    //                 _this.setState({
    //                     countdown: `${hours}:${minutes}:${seconds}`
    //                 });
    //             }, 1000)
    //         }
    //     }
    // }
wangshuo committed
439

FE committed
440 441
    // 加入购物车 type:1 加入购物车,2加入购物车并跳转到购物车页面去支付
    toCart = (type) => {
2  
xuzhenghua committed
442
        const {history, addCourseToCart} = this.props;
FE committed
443 444 445 446 447 448 449 450 451 452 453 454
        let data = {
            course_id: getParam('id')
        };
        http.post(`${API.home}/m/cart/add`, data).then((res) => {
            if (res.data.code === 200) {
                if (type === 1) {
                    Toast.info('已加入购物车', 2)
                    // this.props.getCourses()
                    // document.location.reload()
                    addCourseToCart();
                    this.fetchCourseInfo();
                } else {
2  
xuzhenghua committed
455
                    history.replace('/shopcart');
FE committed
456 457 458 459 460 461 462 463 464 465 466
                }
            } else if (res.data.code === 15001) {
                history.replace('/shopcart');
            } else if (res.data.code === 4030) {
                history.replace('/passport');
            } else {
                Toast.info(res.data.msg, 2);
            }
        })
    };

467
    invitedFriends = () => {
FE committed
468 469 470 471 472 473 474 475 476 477 478
        // const {course_title, image_name, course_id, pdd_group_info, pdd_group_info: {groupon_member, groupon_member: {number}, price}} = this.state.course.course_info;
        // if (browser.isWeixin) {
        //     wxShare({
        //         title: `【仅剩${number}个名额】我${price}元拼了《${course_title}》`,
        //         desc: course_title,
        //         link: location.href,
        //         imgUrl: image_name,
        //     });
        // } else {
        //     Toast.info('请在微信中使用分享功能!', 2);
        // }
2  
xuzhenghua committed
479 480 481
        const {history} = this.props;
        const {course = {}} = this.state;
        if (course.course_info && course.course_info.self_oid) {
FE committed
482
            history.push(`/togroup?id=${course.course_info.self_oid}`);
483 484
        }
    }
xuzhenghua committed
485

xuzhenghua committed
486 487
    // 自组件传给父组件的boxHide
    boxHide = (val) => {
FE committed
488
        this.setState({
xuzhenghua committed
489
            auditionBox: val,
FE committed
490 491 492 493
            singleBox: val,
            singleType: 1
        })
        this.props.history.push(`/detail?id=${getParam('id')}`);
xuzhenghua committed
494
    }
xuzhenghua committed
495

xuzhenghua committed
496
    render() {
xuzhenghua committed
497
        const {course: {course_info = {}}, barInfo, singleBox, singleType, isRedPacket, countDownTime} = this.state;
xuzhenghua committed
498

wangshuo committed
499
        let courseInfo = '',
xuzhenghua committed
500 501 502
            service = '',
            number = 0,
            endTime = 0;
503 504 505
        // if (this.props.courseInfo.course_info) {
        //     courseInfo = this.props.courseInfo.course_info;
        //     service = courseInfo.service;
2  
xuzhenghua committed
506 507 508
        if (course_info.group_status === 3 || course_info.group_status === 4) {
            number = course_info.pdd_group_info.groupon_member.number;
        }
509
        // }
510
        const {share, countdown, list, outList} = this.state;
FE committed
511
        let href = '';
2  
xuzhenghua committed
512 513
        const {location: {state = {}}} = this.props;
        if (state.to && state.to === 'classify') {
FE committed
514 515
            href = '/classify'
        }
2  
xuzhenghua committed
516 517
        if (state.oid) {
            href = '/classify'
FE committed
518
        }
2  
xuzhenghua committed
519 520
        if (getParam('dist_code')) {
            href = '/'
521
        }
xuzhenghua committed
522
        let isCent = course_info.pdd_group_info && course_info.pdd_group_info.price != '0.01';
xuzhenghua committed
523
        return (
FE committed
524
            <div>
xuzhenghua committed
525 526 527 528 529 530 531 532
                {
                    Number(getParam('ac')) === 11 ? (
                        <div className='activity__blessing'>
                            <img src='https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/count_donw.png' />
                            <span className='count__down__time'>{`${countDownTime}`}</span>
                        </div>
                    ) : (null)
                }
2  
xuzhenghua committed
533 534 535 536 537 538 539
                <div className='detail-box'>
                    <HeaderBar
                        title='课程详情'
                        arrow={true}
                        cart={true}
                        toHref={href}
                    />
xuzhenghua committed
540 541 542 543

                    <ExpandActiveToast/>


FE committed
544
                    <CallApp className='toapp' path={`/detail/id=${getParam('id')}`} />
2  
xuzhenghua committed
545 546 547 548 549 550 551 552

                    {/*弹幕*/}
                    <Barrage isShow={course_info.is_show}/>

                    {/*课程*/}
                    <div className='course-content'>
                        <div className='cover'>
                            <img src={course_info.image_name} alt=""/>
553
                            {
2  
xuzhenghua committed
554 555
                                course_info.is_aist &&
                                <span className='return_cash'/>
xuzhenghua committed
556 557
                            }
                        </div>
2  
xuzhenghua committed
558 559 560 561 562 563 564 565 566 567 568
                        <div className="info">
                            <p className='title'>{course_info.course_title}</p>
                            <p className='contact text-overflow-2'>{course_info.simpledescription}</p>
                            <div className='des'>
                                {
                                    course_info.is_baoming === 0 &&
                                    <p className="course-price">
                                        <span className="new">¥{course_info.price1}</span>
                                        <span className="old">¥{course_info.price0}</span>
                                    </p>
                                }
xuzhenghua committed
569 570 571 572 573 574 575
                                {
                                    !!course_info.is_deposit && course_info.is_deposit!= 0 &&
                                    <div className="openExpand">
                                        支付定金¥{course_info.deposit_info.deposit_amount},可抵扣¥{course_info.deposit_info.deduction_amount}
                                    </div>
                                }

2  
xuzhenghua committed
576 577
                            </div>
                        </div>
xuzhenghua committed
578
                    </div>
579

2  
xuzhenghua committed
580
                    {/*正常课程已购买时显示*/}
xuzhenghua committed
581 582 583 584 585 586 587 588 589 590 591

                    {/*
                    没有权限:不显示
                    vip及赠课:显示黄的
                    不在vip范围内,单独购买:显示蓝的
                    单独买了课然后买了vip:显示蓝的

                    vip_range是vip里买的课,而且买了vip才会返回时间
                    is_pay 1是单独购买 0是买vip赠的
                    is_vip 1是属于vip赠的 0是不在vip范围内的
                    */}
2  
xuzhenghua committed
592
                    {
xuzhenghua committed
593
                       course_info.is_baoming === 1 && course_info.is_pay == 1 && course_info.contact_type == 1 && course_info.course_qq &&
2  
xuzhenghua committed
594 595 596 597
                        <div className='group'>
                            上课QQ群:{course_info.course_qq},加群请备注您的学号:{course_info.uid}
                        </div>
                    }
xuzhenghua committed
598
                    {
xuzhenghua committed
599
                       course_info.is_baoming === 1 && course_info.is_pay == 1 && course_info.contact_type == 2 && course_info.course_qq &&
xuzhenghua committed
600 601 602 603 604
                        <div className='group'>
                            请添加班主任微信:{course_info.course_qq},添加时备注学号:{course_info.uid}
                        </div>
                    }

605

2  
xuzhenghua committed
606 607
                    {/*vip课程显示*/}
                    {
xuzhenghua committed
608
                        course_info.vip_range && course_info.is_vip == 1 && course_info.is_pay == 0 && course_info.contact_type == 1 && course_info.course_qq &&
2  
xuzhenghua committed
609 610
                        <div className="vip">
                            <p>已开通年会员:{course_info.vip_range}</p>
xuzhenghua committed
611
                            <p>上课QQ群:{course_info.course_qq},加群请备注您的学号:{course_info.uid}</p>
2  
xuzhenghua committed
612 613
                        </div>
                    }
xuzhenghua committed
614
                    {
xuzhenghua committed
615
                        course_info.vip_range && course_info.is_vip == 1 && course_info.is_pay == 0 && course_info.contact_type == 2 && course_info.course_qq &&
xuzhenghua committed
616 617 618 619 620
                        <div className="vip">
                            <p>已开通年会员:{course_info.vip_range}</p>
                            <p>请添加班主任微信:{course_info.course_qq},添加时备注学号:{course_info.uid}</p>
                        </div>
                    }
FE committed
621

xuzhenghua committed
622 623 624 625 626 627 628 629 630

                    {/*定金相关信息*/}
                    {
                        !!course_info.is_deposit && course_info.is_deposit!= 0 &&
                        <Deposit courseInfo={course_info}/>
                    }



2  
xuzhenghua committed
631 632 633 634 635 636 637 638 639 640 641 642
                    {/*服务承诺*/}
                    <div className='promise'>
                        <label>服务承诺</label>
                        <p>
                            {
                                course_info.service && course_info.service.length > 0 && course_info.service.map((item, index) => {
                                    return (
                                        <span key={index}> {item} </span>
                                    )
                                })
                            }
                        </p>
xuzhenghua committed
643
                    </div>
xuzhenghua committed
644

xuzhenghua committed
645

2  
xuzhenghua committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
                    {/*试听弹窗*/}
                    <Audition auditionBox={this.state.auditionBox} boxHide={this.boxHide}/>

                    {/*单集购买弹窗*/}
                    {
                        singleBox &&
                        <Single
                            singleType={this.state.singleType}
                            singleBox={this.state.singleBox}
                            boxHide={this.boxHide}
                            data={this.state.singMess}
                            vcourseId={course_info.v_course_id}
                            videoId={this.state.singMess.video_id}
                            title={course_info.course_title}
                            check={this.check}
                            courseId={course_info.course_id}
FE committed
662 663 664
                        />
                    }

2  
xuzhenghua committed
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
                    {/* 单集购买成功弹窗 */}
                    {
                        singleType !== 1 &&
                        <SingleSuccess
                            boxHide={this.boxHide}
                            data={this.state.singMess}
                            singleType={singleType}
                            vcourseId={course_info.v_course_id}
                            videoId={this.state.singMess.video_id}
                            nowPrice={this.state.nowPrice}
                            isPdd={this.state.isPdd}
                            laterPrice={this.state.laterPrice}
                            courseId={course_info.course_id}
                        />
                    }
                    {/*payCallback={this.payCallback}*/}
                    {/*weixinPay = {this.weixinPay}*/}
xuzhenghua committed
682

FE committed
683 684
                    {/* 红包 */}
                    {
xuzhenghua committed
685
                        isRedPacket &&
FE committed
686 687 688 689
                        <RedPacket
                            history={this.props.history}
                            country={this.props.country}
                            delCountryNum={this.props.delCountryNum}
xuzhenghua committed
690
                            userInfo={this.props.user.data}
FE committed
691 692 693
                        />
                    }

2  
xuzhenghua committed
694 695 696 697 698
                    {/*分享赚钱*/}
                    {
                        course_info.is_dist &&
                        <ShareRank courseInfo={course_info}/>
                    }
wangshuo committed
699

2  
xuzhenghua committed
700 701 702 703
                    {/**
                     * 拼团
                     * is_aist: 是否AI特训营
                     * group_status: 团状态,3:课程有小团 用户没参加小团;4:用户参加了小团
xuzhenghua committed
704
                     * 拼团价格为1分钱时,不允许参团
FE committed
705 706
                     */
                    }
xuzhenghua committed
707
                    {/*双十一期间不需要显示 不要删除*/}
xuzhenghua committed
708 709 710 711 712 713 714 715 716
                    {
                        isCent && !course_info.is_aist && (course_info.group_status === 3 || course_info.group_status === 4) &&
                        <Group
                            courseInfo={course_info}
                            history={this.props.history}
                            countdown={countdown}
                            invitedFriends={this.invitedFriends}
                        />
                    }
zhanghaozhe committed
717

FE committed
718 719 720 721 722 723
                    {/*
                      * 砍价
                      * is_baoming 否报名 0-未购买弹出报名 1-已购买弹出开始学习
                      * is_dist 是否分销课程
                      * is_bargain 是否砍价课程
                      */}
2  
xuzhenghua committed
724 725
                    {
                        course_info.is_baoming === 0 && (!course_info.is_aist) && course_info.is_bargain &&
xuzhenghua committed
726 727 728
                        <Bargain
                            country={this.props.country}
                            delCountryNum={this.props.delCountryNum}
FE committed
729
                        />
2  
xuzhenghua committed
730
                    }
xuzhenghua committed
731

2  
xuzhenghua committed
732 733 734 735 736 737
                    {/*课程介绍、大纲*/}
                    <OutLine
                        data={course_info}
                        toAudition={this.toAudition}
                        toSingleset={this.toSingleset}
                    />
738

2  
xuzhenghua committed
739 740 741 742
                    {/*课程按钮*/}
                    {
                        course_info &&
                        <BtnStatus
FE committed
743
                            country={this.props.country}
2  
xuzhenghua committed
744 745 746 747 748 749 750
                            countdown={countdown}
                            data={course_info}
                            user={this.props.user}
                            invitedFriends={this.invitedFriends}
                            // addCourseToCart={this.props.addCourseToCart}
                            toCart={this.toCart}
                            history={this.props.history}
FE committed
751 752
                        />
                    }
2  
xuzhenghua committed
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767

                    {
                        share ? (
                            <div
                                className='groupSuccessMbc'
                                onClick={() => {
                                    this.setState({share: false})
                                }}
                            >
                                <div className='tipContent'>
                                    {`还差${number}人,分享到3个群,成团率高达98%`}
                                </div>
                                <div className='tipArrow'>
                                    <i className='iconfont iconyindao'/>
                                </div>
wangshuo committed
768
                            </div>
2  
xuzhenghua committed
769 770 771
                        ) : null
                    }
                </div>
FE committed
772
            </div>
xuzhenghua committed
773
        )
xuzhenghua committed
774 775 776 777
    }

}

778 779
const mapStateToProps = (state) => {
    return {
780
        // courseInfo: state.courseInfo,
781 782
        user: {
            ...state.user
FE committed
783 784
        },
        country: state.country
785 786
    }
}
xuzhenghua committed
787

788 789 790 791 792 793 794
// const mapDispatchToProps = {
//     fetchCoursesListIfNeeded
// }
const mapDispatchToProps = (dispatch) => {
    return bindActionCreators(
        {
            getCourses,
FE committed
795 796
            addCourseToCart,
            delCountryNum
797 798 799
        },
        dispatch
    )
xuzhenghua committed
800
}
xuzhenghua committed
801

802

xuzhenghua committed
803
export default connect(mapStateToProps, mapDispatchToProps)(Detail)