index.js 4.04 KB
Newer Older
zhanghaozhe committed
1 2
import React, { Component } from "react"
import "./index.scss"
xuzhenghua committed
3 4 5

export default class Study extends Component {
  Change = (data) => {
zhanghaozhe committed
6 7
    let cn = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]
    let newStr = ""
xuzhenghua committed
8 9 10
    let str = data.toString()
    let ci = Number(str) % 10
    let cs = Math.floor(Number(str) / 10)
zhanghaozhe committed
11
    let cv = ""
xuzhenghua committed
12
    if (str.length > 1) {
zhanghaozhe committed
13
      if (cs === 1) {
zhanghaozhe committed
14 15 16 17
        cv = ci >= 1 ? cn[9] + cn[ci - 1] : cn[9]
      } else {
        cv = ci > 1 ? cn[cs - 1] + cn[9] + cn[ci - 1] : cn[cs - 1] + cn[9]
      }
xuzhenghua committed
18
    } else {
zhanghaozhe committed
19
      cv = cn[ci - 1]
xuzhenghua committed
20 21
    }
    newStr = str.replace(str, cv)
zhanghaozhe committed
22
    return newStr
xuzhenghua committed
23 24 25 26
  }

  render() {
    return (
zhanghaozhe committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
      <div className={"study__container"}>
        <img
          className={"learn_left"}
          src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/learn_left.png"
          alt=""
        />
        <img
          className={"learn_bottom"}
          src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/learn_bottom.png"
          alt=""
        />
        <p className={"title"}> /  /  / </p>
        <p className={"sub__title"}>17节课堂教学,带你掌握Python技术入门知识</p>
        <div className={"step__container"}>
          <div className={"item__container"}>
            <img
              src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/wanzheng.png"
              alt=""
            />
xuzhenghua committed
46
            <p>完整的Python基础知识体系</p>
zhanghaozhe committed
47
            <div className={"item__line"}></div>
xuzhenghua committed
48
          </div>
zhanghaozhe committed
49 50 51 52 53
          <div className={"item__container"}>
            <img
              src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/siwei.png"
              alt=""
            />
xuzhenghua committed
54
            <p>灵活的编程思维和实操技巧</p>
zhanghaozhe committed
55
            <div className={"item__line"}></div>
xuzhenghua committed
56
          </div>
zhanghaozhe committed
57 58 59 60 61
          <div className={"item__container"}>
            <img
              src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/shicao.png"
              alt=""
            />
xuzhenghua committed
62 63 64 65
            <p>丰富有趣的实操训练</p>
          </div>
        </div>

zhanghaozhe committed
66 67 68 69 70
        <div className={"table__container"}>
          <div className={"table__head"}>
            <div className={"head_title order_number"}>序号</div>
            <div className={"head_title chapter"}>章节</div>
            <div className={"head_title points"}>知识点</div>
xuzhenghua committed
71
          </div>
zhanghaozhe committed
72 73 74 75 76 77
          <div className={"table__body"}>
            {this.props.syllabus.map((item, index) => {
              return (
                <div className={"item__container"} key={index}>
                  <div className={"item__title"}>
                    {"第" + this.Change(index + 1) + "阶段 " + item.name}
xuzhenghua committed
78
                  </div>
zhanghaozhe committed
79 80 81 82 83 84 85 86 87 88 89
                  {item.lessons.map((item, index) => {
                    return (
                      <div className={"item__content"} key={index}>
                        <div className={"content order_number number_center"}>
                          {item.number}
                        </div>
                        <div className={"content chapter"}>{item.name}</div>
                        <div className={"content points"}>{item.info.name}</div>
                      </div>
                    )
                  })}
xuzhenghua committed
90 91
                </div>
              )
zhanghaozhe committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
            })}
          </div>
          <div className={"table__bottom"}>
            {this.props.allSyllabusShow ? (
              <div onClick={() => this.props.hide(1)}>
                <p>收起</p>
                <img
                  src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/shouqi.png"
                  alt=""
                />
              </div>
            ) : (
              <div onClick={() => this.props.show(1)}>
                <p>展开更多</p>
                <img
                  src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/h5_python_class/zhankai.png"
                  alt=""
                />
              </div>
            )}
xuzhenghua committed
112 113 114 115 116 117
          </div>
        </div>
      </div>
    )
  }
}