index.js 3.66 KB
Newer Older
zhanghaozhe committed
1 2 3 4 5 6 7 8 9 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 66 67 68 69 70 71 72 73 74 75 76 77 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 123 124 125 126
import React, { Component } from 'react'
import { http } from "@/utils"
import './index.scss'
import { HeaderBar } from "@common/index"
import { WhiteSpace } from "antd-mobile";
import VList from '@/common/v-list-base'


class LimitFree extends Component {

  state = {
    tabs: new Array(5).fill('a').map((item, i) => ({
      title: String.fromCharCode(97 + i)
    })),
    courses: [
      {
        img: 'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/20a86c1353.jpg',
        title: 'NLP到Word2Vec实战班',
        count: '1212',
        status: 1,
        price: 99,
        price1: 199,
      },
      {
        img: 'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/20a86c1353.jpg',
        title: 'NLP到Word2Vec实战班',
        count: '1212',
        status: 1,
        price: 99,
        price1: 199,
      },
      {
        img: 'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/20a86c1353.jpg',
        title: 'NLP到Word2Vec实战班',
        count: '1212',
        status: 1,
        price: 99,
        price1: 199,
      },
    ]
  }

  componentDidMount() {

  }

  handleClick = id => {

  }

  render() {
    const {tabs, courses} = this.state
    return (
      <div className='limit-free'>
        <HeaderBar arrow={true} title={'限时免费'}></HeaderBar>
        <div className="banner">
          <img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/time_limited_free/M/banner.png" alt=""/>
        </div>
        <nav>
          <ul>
            <li></li>
          </ul>
        </nav>
        <WhiteSpace/>
        <div className="course-list">
          <ul>
            <li>
              <h2>
                <img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/time_limited_free/M/category-icon.png"
                     alt=""/>
                <span>分类1</span>
              </h2>
              <ul className={'courses'}>
                {
                  courses && courses.length && courses.map((item, index) => {
                    let des, bottom
                    switch (item.status) {
                      case 1:
                        des = <div className={'learner'}>
                          <i className='iconfont iconRectangleCopy4'/>
                          <span>{item.count}人学习</span>
                        </div>
                        bottom = <div className={'bottom'}>
                          <span className={'red'}>限时免费</span>
                          <span className={'origin-price'}>¥{item.price1}</span>
                          <button>免费领取</button>
                        </div>
                        break
                      case 2:
                        des = <div className={'remain-time'}>
                          <i className={'iconfont iconiconfront-21'}/>
                          <span>125555分后过期</span>
                        </div>
                        break
                      case 3:

                    }

                    const info = (
                      <div className='info'>
                        <div className='title'>{item.title}</div>
                        {des}
                        {bottom}
                      </div>
                    )
                    return (
                      <VList img={item.img}
                             handleClick={this.handleClick}
                             info={info}
                      />
                    )
                  })
                }
              </ul>
            </li>
          </ul>
        </div>
        <div className="no-more">
          -没有更多了-
        </div>
      </div>
    );
  }
}

export default LimitFree