index.js 28.6 KB
Newer Older
FE committed
1 2
import React, { Component } from 'react';
import classnames from 'classnames';
3
import { http , getParam, SendMessageToApp} from '@/utils';
FE committed
4 5
import { Toast } from "antd-mobile";
import ListFrame from './../listFrame/index';
FE committed
6
import CourseItem from './../courseItem/index';
FE committed
7
import ListHeader from './../listHeader';
FE committed
8
import './index.scss';
xuzhenghua committed
9
import cookie from "js-cookie";
FE committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

class CourseList extends Component {
  constructor(props) {
    super(props);
    this.state = {
      basic: {
        course: [],
        courseList: [],
        isMore: false,
      },
      advanced: {
        course: [],
        courseList: [],
        isMore: false,
      },
      higher: {
        course: [],
        courseList: [],
        isMore: false,
      },
      expand: {
        course: [],
        courseList: [],
        isMore: false,
      },
      group: {
        course: [],
        courseList: [],
        isMore: false,
      },
      training: {
        course: [],
        courseList: [],
        isMore: false,
      }
    };
  }

  componentDidMount() {

    // 精品课程-集训营、就业班/AI特训营
    this.fetchCourseData();

    // AI之路-基础
    this.fetchAICourse('one');

    // AI之路-进阶
    this.fetchAICourse('two');

    // AI之路-高阶
    this.fetchAICourse('three');

    // AI之路-拓展
    this.fetchAICourse('four');
  }

xuzhenghua committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
  shouldComponentUpdate(nextProps, nextState, nextContext) {
    if(this.props.isApp !== nextProps.isApp) {
      // 精品课程-集训营、就业班/AI特训营
      this.fetchCourseData();

      // AI之路-基础
      this.fetchAICourse('one');

      // AI之路-进阶
      this.fetchAICourse('two');

      // AI之路-高阶
      this.fetchAICourse('three');

      // AI之路-拓展
      this.fetchAICourse('four');
      return false;
    }
    return true;
  }

FE committed
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
  fetchAICourse = (key) => {
    const { basic, advanced, higher, expand } = this.state;
    http.get(`${API.home}/sys/ai_grow_up_courses/${key}`).then(res => {
      const {code, data} = res.data;
      if (code === 200) {
        if (data.length > 4) {
          if (key === 'one') {
            this.setState({
              basic: Object.assign({}, basic, {
                isMore: true,
                course: data.filter((item, index) => index < 4),
                courseList: data,
              })
            });
          }
          if (key === 'two') {
            this.setState({
              advanced: Object.assign({}, advanced, {
                isMore: true,
                course: data.filter((item, index) => index < 4),
                courseList: data,
              })
            });
          }
          if (key === 'three') {
            this.setState({
              higher: Object.assign({}, higher, {
                isMore: true,
                course: data.filter((item, index) => index < 4),
                courseList: data,
              })
            });
          }
          if (key === 'four') {
            this.setState({
              expand: Object.assign({}, expand, {
                isMore: true,
                course: data.filter((item, index) => index < 4),
                courseList: data,
              })
            });
          }
        } else {
          if (key === 'one') {
            this.setState({
              basic: Object.assign({}, basic, {
                isMore: false,
                course: data,
                courseList: data,
              })
            });
          }
          if (key === 'two') {
            this.setState({
              advanced: Object.assign({}, advanced, {
                isMore: false,
                course: data,
                courseList: data,
              })
            });
          }
          if (key === 'three') {
            this.setState({
              higher: Object.assign({}, higher, {
                isMore: false,
                course: data,
                courseList: data,
              })
            });
          }
          if (key === 'four') {
            this.setState({
              expand: Object.assign({}, expand, {
                isMore: false,
                course: data,
                courseList: data,
              })
            });
          }
        }
      }
    });
  }

  fetchCourseData = () => {
    const { group, training } = this.state;
    http.get(`${API.home}/sys/preheat_data`).then(res => {
      const {code, data} = res.data;
      if (code === 200) {
        if (data.excellent_course.length > 2) {
          this.setState({
            group: Object.assign({}, group, {
              isMore: true,
              course: data.excellent_course.filter((item, index) => index < 2),
              courseList: data.excellent_course,
            })
          });
        } else {
          this.setState({
            group: Object.assign({}, group, {
              isMore: false,
              course: data.excellent_course,
              courseList: data.excellent_course,
            })
          });
        }
        if (data.ai_elite_courses.length > 2) {
          this.setState({
            training: Object.assign({}, training, {
              isMore: true,
              course: data.ai_elite_courses.filter((item, index) => index < 2),
              courseList: data.ai_elite_courses,
            })
          });
        } else {
          this.setState({
            training: Object.assign({}, training, {
              isMore: false,
              course: data.ai_elite_courses,
              courseList: data.ai_elite_courses,
            })
          });
        }
      }
    });
  }

FE committed
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
  handleToMore = (key) => {
    let data = {};
    if(this.state[key]['isMore']) {
      data[key] = {
        isMore: !this.state[key]['isMore'],
        course: this.state[key]['courseList'],
        courseList: this.state[key]['courseList']
      };
      this.setState({
        ...data
      });
    }else {
      if(key === 'group' || key === 'training') {
        data[key] = {
          isMore: !this.state[key]['isMore'],
          course: this.state[key]['courseList'].filter((item, index) => index < 2),
          courseList: this.state[key]['courseList']
        };
      }else {
        data[key] = {
          isMore: !this.state[key]['isMore'],
          course: this.state[key]['courseList'].filter((item, index) => index < 4),
          courseList: this.state[key]['courseList']
        };
      }
      this.setState({
        ...data
      });
    }
  }

  toReceiveCoupon(id, key = '') {
wangshuo committed
246
    const {isLogin, toLogin} = this.props;
xuzhenghua committed
247 248


wangshuo committed
249
    if(isLogin) {
xuzhenghua committed
250 251 252 253
      var _czc = _czc || [];
      var name = '课程id=' + id;
      _czc.push(["_trackEvent", name, 'm端双十一立即领券']);

wangshuo committed
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
      http.post(`${API.home}/sys/activity/coupon/receive`, {
        course_id: id
      }).then(res => {
        const { code, msg } = res.data;
        if(code === 200) {
          Toast.info('领取成功~', 2, null, false);
          let obj = {};
          obj[key] = {
            isMore: this.state[key]['isMore'],
            course: this.state[key]['course'].map(item => {
              if(item.course_id === id) {
                return Object.assign({}, item, {
                  course_status: 2
                });
              }
              return item;
            }),
            courseList: this.state[key]['courseList'].map(item => {
              if(item.course_id === id) {
                return Object.assign({}, item, {
                  course_status: 2
                });
              }
              return item;
            }),
          }
          this.setState({
            ...obj
          });
        } else {
          Toast.info(msg, 2, null, false);
FE committed
285
        }
wangshuo committed
286 287 288 289
      });
    }else{
      toLogin();
    }
xuzhenghua committed
290

FE committed
291 292
  }

293 294 295 296 297 298 299 300 301 302 303

  toQQque=()=>{
    if (!getParam('version')) {
      location.href='https://q.url.cn/AB8aue?_type=wpa&qidian=true'
    } else {
      SendMessageToApp("toQQ", 'https://q.url.cn/AB8aue?_type=wpa&qidian=true')
    }
  }

  // 去课程详情页
  toCourse = (courseId) => {
FE committed
304
    const { history } = this.props;
305
    if (!getParam('version')) {
FE committed
306
      history.push(`/detail?id=${courseId}`);
307
    } else {
xuzhenghua committed
308
      SendMessageToApp("toCourse", courseId);
309 310 311
    }
  }

xuzhenghua committed
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
  // 开始使用
  toCourse2 = (courseId) => {
    const { history } = this.props;
    var _czc = _czc || [];
    var name = '课程id=' + courseId;
    _czc.push(["_trackEvent", name, 'm端双十一开始使用优惠券']);

    if (!getParam('version')) {
      history.push(`/detail?id=${courseId}`);
    } else {
      SendMessageToApp("toCourse", courseId);
    }
  }


FE committed
327
  render() {
FE committed
328
    const { isFormal } = this.props;
FE committed
329 330
    const { basic, advanced, higher, expand, group, training } = this.state;
    return (
xuzhenghua committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
        <div className="boutique-course">
          <ListHeader text="集训营、就业班" size="middle" styles={{margin: '20px 0 15px'}} />
          {/* 集训营、就业班 */}
          {
            (group.course && group.course.length > 0) &&
            <>
              <div data-layout="row">
                {
                  group.course.map(item => (
                      <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
                        <div className="coupon-course__footer">
                          <a onClick={() => this.toQQque()} className="course-button">立抢超低团购价</a>
                        </div>
                      </CourseItem>
                  ))
                }
              </div>
FE committed
348
              {
xuzhenghua committed
349 350 351 352
                (group.courseList && group.courseList.length > 2) &&
                <button className="more-button" onClick={() => this.handleToMore('group')}>
                  {group.isMore? '展开更多' : '收起'}
                </button>
FE committed
353
              }
xuzhenghua committed
354 355
            </>
          }
FE committed
356

xuzhenghua committed
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
          <ListHeader text="AI特训营" size="middle" styles={{margin: '0 0 15px'}} />
          {/* AI特训营 */}
          {
            (training.course && training.course.length > 0) &&
            <>
              <div data-layout="row">
                {
                  training.course.map(item => (
                      <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
                        <div className="coupon-course__footer">
                          {
                            item.course_status === 1 &&
                            <a
                                className={classnames("coupon-course__button", "coupon-course__button--receive")}
                                onClick={() => this.toReceiveCoupon(item.course_id, 'training')}
                            >
FE committed
373 374 375 376
                          <span className="coupon-course__button-price">
                            <em>¥{item.coupon}</em>
                            <i>代金券</i>
                          </span>
xuzhenghua committed
377 378 379
                              <span className="coupon-course__button-label">立即领券</span>
                            </a>
                          }
380

xuzhenghua committed
381 382 383
                          {
                            (isFormal === 0 && item.course_status === 2) &&
                            <a className="coupon-course__button">
FE committed
384 385 386 387
                          <span className="coupon-course__button-price">
                            <em>¥{item.coupon}</em>
                            <i>代金券</i>
                          </span>
xuzhenghua committed
388 389 390 391 392 393
                              <span className="coupon-course__button-label">11.11开始使用</span>
                            </a>
                          }
                          {
                            (isFormal === 1 && item.course_status === 2) &&
                            <a
xuzhenghua committed
394
                                onClick={() => this.toCourse2(item.course_id)}
xuzhenghua committed
395
                                className="coupon-course__button">
FE committed
396 397 398 399
                          <span className="coupon-course__button-price">
                            <em>¥{item.coupon}</em>
                            <i>代金券</i>
                          </span>
xuzhenghua committed
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
                              <span className="coupon-course__button-label">开始使用</span>
                            </a>
                          }
                          {
                            item.course_status === 3 &&
                            <a onClick={() => this.toCourse(item.course_id)}
                               className="course-button"
                               data-type="study"
                            >开始学习</a>
                          }
                        </div>
                      </CourseItem>
                  ))
                }
              </div>
              {
                (training.courseList && training.courseList.length > 2) &&
                <button className="more-button" onClick={() => this.handleToMore('training')}>
                  {training.isMore? '展开更多' : '收起'}
                </button>
FE committed
420
              }
xuzhenghua committed
421 422
            </>
          }
FE committed
423

xuzhenghua committed
424 425 426 427 428 429 430 431 432 433
          {/* AI成长之路--基础 */}
          <ListHeader text="AI成长之路" size="middle" styles={{margin: '0 0 15px'}} />
          {
            (basic.course && basic.course.length > 0) &&
            <>
              <h4 className="ai-course__subtitle">基础</h4>
              <div data-layout="row">
                {
                  basic.course.map(item => (
                      <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
FE committed
434
                        {
xuzhenghua committed
435 436 437 438 439 440 441 442
                          item.type === 0 &&
                          <div className="coupon-course__footer">
                            {
                              item.course_status === 1 &&
                              <a
                                  className={classnames("coupon-course__button", "coupon-course__button--receive")}
                                  onClick={() => this.toReceiveCoupon(item.course_id, 'basic')}
                              >
FE committed
443 444 445 446
                                <span className="coupon-course__button-price">
                                  <em>¥{item.coupon}</em>
                                  <i>代金券</i>
                                </span>
xuzhenghua committed
447 448 449
                                <span className="coupon-course__button-label">立即领券</span>
                              </a>
                            }
450

xuzhenghua committed
451 452 453
                            {
                              (isFormal === 0 && item.course_status === 2) &&
                              <a className="coupon-course__button">
FE committed
454 455 456 457
                                <span className="coupon-course__button-price">
                                  <em>¥{item.coupon}</em>
                                  <i>代金券</i>
                                </span>
xuzhenghua committed
458 459 460 461 462
                                <span className="coupon-course__button-label">11.11开始使用</span>
                              </a>
                            }
                            {
                              (isFormal === 1 && item.course_status === 2) &&
xuzhenghua committed
463
                              <a onClick={() => this.toCourse2(item.course_id)} className="coupon-course__button">
FE committed
464 465 466 467
                                <span className="coupon-course__button-price">
                                  <em>¥{item.coupon}</em>
                                  <i>代金券</i>
                                </span>
xuzhenghua committed
468 469 470 471 472 473 474 475 476 477 478
                                <span className="coupon-course__button-label">开始使用</span>
                              </a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)}
                                 className="course-button"
                                 data-type="study"
                              >开始学习</a>
                            }
                          </div>
FE committed
479 480
                        }
                        {
xuzhenghua committed
481 482 483
                          item.type === 1 &&
                          <div className="cent-course__footer">
                            {
FE committed
484
                              (item.course_status === 1 || item.course_status === 2) &&
xuzhenghua committed
485 486 487 488 489 490 491
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
                            }
                          </div>
FE committed
492
                        }
xuzhenghua committed
493 494 495 496 497 498 499 500 501
                      </CourseItem>
                  ))
                }
              </div>
              {
                (basic.courseList && basic.courseList.length > 4) &&
                <button className="more-button" onClick={() => this.handleToMore('basic')}>
                  {basic.isMore? '展开更多' : '收起'}
                </button>
FE committed
502
              }
xuzhenghua committed
503 504
            </>
          }
FE committed
505

xuzhenghua committed
506 507 508 509 510 511 512 513 514
          {/* AI成长之路--进阶 */}
          {
            (advanced.course && advanced.course.length > 0) &&
            <>
              <h4 className="ai-course__subtitle">进阶</h4>
              <div data-layout="row">
                {
                  advanced.course.map(item => (
                      <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
FE committed
515
                        {
xuzhenghua committed
516 517 518 519 520 521 522 523
                          item.type === 0 &&
                          <div className="coupon-course__footer">
                            {
                              item.course_status === 1 &&
                              <a
                                  className={classnames("coupon-course__button", "coupon-course__button--receive")}
                                  onClick={() => this.toReceiveCoupon(item.course_id, 'advanced')}
                              >
FE committed
524 525 526 527
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
528 529 530 531 532 533
                                <span className="coupon-course__button-label">立即领券</span>
                              </a>
                            }
                            {
                              (isFormal === 0 && item.course_status === 2) &&
                              <a className="coupon-course__button">
FE committed
534 535 536 537
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
538 539 540 541 542
                                <span className="coupon-course__button-label">11.11开始使用</span>
                              </a>
                            }
                            {
                              (isFormal === 1 && item.course_status === 2) &&
xuzhenghua committed
543
                              <a onClick={() => this.toCourse2(item.course_id)} className="coupon-course__button">
FE committed
544 545 546 547
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
548 549 550 551 552 553 554 555 556 557 558
                                <span className="coupon-course__button-label">开始使用</span>
                              </a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)}
                                 className="course-button"
                                 data-type="study"
                              >开始学习</a>
                            }
                          </div>
FE committed
559 560
                        }
                        {
xuzhenghua committed
561 562 563
                          item.type === 1 &&
                          <div className="cent-course__footer">
                            {
FE committed
564
                              (item.course_status === 1 || item.course_status === 2) &&
xuzhenghua committed
565 566 567 568 569 570 571
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
                            }
                          </div>
FE committed
572
                        }
xuzhenghua committed
573 574 575 576 577 578 579 580 581
                      </CourseItem>
                  ))
                }
              </div>
              {
                (advanced.courseList && advanced.courseList.length > 4) &&
                <button className="more-button" onClick={() => this.handleToMore('advanced')}>
                  {advanced.isMore? '展开更多' : '收起'}
                </button>
FE committed
582
              }
xuzhenghua committed
583 584
            </>
          }
FE committed
585

xuzhenghua committed
586 587 588 589 590 591 592 593 594
          {/* AI成长之路--高阶 */}
          {
            (higher.course && higher.course.length > 0) &&
            <>
              <h4 className="ai-course__subtitle">高阶</h4>
              <div data-layout="row">
                {
                  higher.course.map(item => (
                      <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
FE committed
595
                        {
xuzhenghua committed
596 597 598 599 600 601 602 603
                          item.type === 0 &&
                          <div className="coupon-course__footer">
                            {
                              item.course_status === 1 &&
                              <a
                                  className={classnames("coupon-course__button", "coupon-course__button--receive")}
                                  onClick={() => this.toReceiveCoupon(item.course_id, 'higher')}
                              >
FE committed
604 605 606 607
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
608 609 610 611 612 613
                                <span className="coupon-course__button-label">立即领券</span>
                              </a>
                            }
                            {
                              (isFormal === 0 && item.course_status === 2) &&
                              <a className="coupon-course__button">
FE committed
614 615 616 617
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
618 619 620 621 622
                                <span className="coupon-course__button-label">11.11开始使用</span>
                              </a>
                            }
                            {
                              (isFormal === 1 && item.course_status === 2) &&
xuzhenghua committed
623
                              <a onClick={() => this.toCourse2(item.course_id)} className="coupon-course__button">
FE committed
624 625 626 627
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
628 629 630 631 632 633 634 635 636 637 638
                                <span className="coupon-course__button-label">开始使用</span>
                              </a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)}
                                 className="course-button"
                                 data-type="study"
                              >开始学习</a>
                            }
                          </div>
FE committed
639 640
                        }
                        {
xuzhenghua committed
641 642 643
                          item.type === 1 &&
                          <div className="cent-course__footer">
                            {
FE committed
644
                              (item.course_status === 1 || item.course_status === 2) &&
xuzhenghua committed
645 646 647 648 649 650 651
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
                            }
                          </div>
FE committed
652
                        }
xuzhenghua committed
653 654 655 656 657 658 659 660 661
                      </CourseItem>
                  ))
                }
              </div>
              {
                (higher.courseList && higher.courseList.length > 4) &&
                <button className="more-button" onClick={() => this.handleToMore('higher')}>
                  {higher.isMore? '展开更多' : '收起'}
                </button>
FE committed
662
              }
xuzhenghua committed
663 664
            </>
          }
FE committed
665

xuzhenghua committed
666 667 668 669 670 671 672 673 674
          {/* AI成长之路--扩展 */}
          {
            (expand.course && expand.course.length > 0) &&
            <>
              <h4 className="ai-course__subtitle">扩展</h4>
              <div data-layout="row">
                {
                  expand.course.map(item => (
                      <CourseItem image={item.image_name} key={item.course_id} id={item.course_id} toCourse={this.toCourse}>
FE committed
675
                        {
xuzhenghua committed
676 677 678 679 680 681 682 683
                          item.type === 0 &&
                          <div className="coupon-course__footer">
                            {
                              item.course_status === 1 &&
                              <a
                                  className={classnames("coupon-course__button", "coupon-course__button--receive")}
                                  onClick={() => this.toReceiveCoupon(item.course_id, 'expand')}
                              >
FE committed
684 685 686 687
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
688 689 690
                                <span className="coupon-course__button-label">立即领券</span>
                              </a>
                            }
691

xuzhenghua committed
692 693 694
                            {
                              (isFormal === 0 && item.course_status === 2) &&
                              <a className="coupon-course__button">
FE committed
695 696 697 698
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
699 700 701 702 703
                                <span className="coupon-course__button-label">11.11开始使用</span>
                              </a>
                            }
                            {
                              (isFormal === 1 && item.course_status === 2) &&
xuzhenghua committed
704
                              <a onClick={() => this.toCourse2(item.course_id)} className="coupon-course__button">
FE committed
705 706 707 708
                            <span className="coupon-course__button-price">
                              <em>¥{item.coupon}</em>
                              <i>代金券</i>
                            </span>
xuzhenghua committed
709 710 711 712 713 714 715 716 717 718 719
                                <span className="coupon-course__button-label">开始使用</span>
                              </a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)}
                                 className="course-button"
                                 data-type="study"
                              >开始学习</a>
                            }
                          </div>
FE committed
720 721
                        }
                        {
xuzhenghua committed
722 723 724
                          item.type === 1 &&
                          <div className="cent-course__footer">
                            {
FE committed
725
                              (item.course_status === 1 || item.course_status === 2) &&
xuzhenghua committed
726 727 728 729 730 731 732
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
                            }
                            {
                              item.course_status === 3 &&
                              <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
                            }
                          </div>
FE committed
733
                        }
xuzhenghua committed
734 735 736 737 738 739 740 741 742
                      </CourseItem>
                  ))
                }
              </div>
              {
                (expand.courseList && expand.courseList.length > 4) &&
                <button className="more-button" onClick={() => this.handleToMore('expand')}>
                  {expand.isMore? '展开更多' : '收起'}
                </button>
FE committed
743
              }
xuzhenghua committed
744 745 746
            </>
          }
        </div>
FE committed
747 748 749 750
    )
  }
}

zhanghaozhe committed
751
export default ListFrame(CourseList);