import React, { Component } from "react"
import "./../index.scss"
import { http } from "src/utils"
import { Link } from "react-router-dom"
import { Toast } from "antd-mobile"

class TeacherList extends Component {
  constructor(props) {
    super(props)
    this.state = {
      data:[],
    }
  }

  componentDidMount() {
    http.get(`${API.home}/m/mobTeachers`).then((res) => {
      if (res.data.code === 200) {
        this.setState({
          data:res.data.data
        });
        console.log(this.state.data)
      } else {
        Toast.info(res.data.msg, 2)
      }
    })
  }


  render() {
    return (
      <div className="teacher">
      <p className="cont">超强师资内容</p>
      <div className="teabox">
      {this.state.data.map((item, i) => {
        return <div key={i} className="tealist">
          <div className="pic">
            <img src={item.thumb_img} alt=""/>
          </div>
          <div className="detail">
            <h2 className="name"><b>{item.teacher_name}</b><span className="title">{item.title}</span></h2>
            <p className="desc">{item.desc}</p>
          </div>
        </div>
    })}
      </div>
      <div className="consult">
            <a href="http://q.url.cn/s/Vbkup6m?_type=wpa">咨询更多师资信息</a>
          </div>
    </div>
    )
  }
}

export default TeacherList



