<template>
  <div class="content">
    <div class="top">
      <div class="map">
        <span class="map-pro">{{countData.name}}</span>

        <div class="my-map">
          <div id="myChart" :style="{width: '600px', height: '600px'}"></div>
        </div>
        <div class="chart">
          <h1>{{countData.data}}</h1><h2>个</h2>
          <h3>名师工作室</h3>
          <ul>
            <li><span>{{countData.teacher}}人</span><p>一线教师</p></li>
            <li><span>{{countData.source}}个</span><p>资源</p></li>
            <li><span>{{countData.focus}}次</span><p>关注度</p></li>
          </ul>
        </div>
      </div>
    </div>

    <div class="teacher-show">
      <div class="header">
        <h1 class="title ">名师展示</h1>
        <ul class="region">
          <li><a class="active" @click="chooseSchool()">全部</a></li>
          <li><a @click="chooseSchool('zt')">紫藤小学</a></li>
          <li><a @click="chooseSchool('xx')">西芯小学</a></li>
          <li><a @click="chooseSchool('fc')">芳草小学</a></li>
          <li><!--<a href="" rel="350000" class=""></a>--></li>
        </ul>
      </div>
      <div class="select">
        <Select v-model="model1" placeholder="学段" style="width:100px">
          <Option v-for="item in periodList" :value="item.value" :key="item.value">{{ item.label }}</Option>
        </Select>
        <Select v-model="model1" placeholder="学科" style="width:100px">
          <Option v-for="item in subjectList" :value="item.value" placeholder="学科" :key="item.value">{{ item.label }}</Option>
        </Select>
      </div>
      <div class="content-buttom">

        <div class="teacher-item" style="cursor: pointer" v-for="item in teacherList" @click="teacherZone">
          <div class="t-title">
            <!--<router-link to="/TeacherZone"></router-link>-->
            <span>{{item.provice}}</span>
            <span>{{item.title}}</span>
          </div>
          <div class="img-content">
            <img :src="item.img" class="th_pto">
          </div>
          <div class="teacher-info">
            <p class="name">{{item.name}}</p>
            <div class="subject">
              <p>{{item.period}}<span></span>{{item.subject}}</p>
            </div>
          </div>
          <div class="teacher-detailed">
            <div class="item">
              <p class="number">{{item.number1}}</p>
              <p class="txt">{{item.text1}}</p>
            </div>
            <div class="item">
              <p class="number">{{item.number2}}</p>
              <p class="txt">{{item.text2}}</p>
            </div>
            <div class="item">
              <p class="number">{{item.number3}}</p>
              <p class="txt">{{item.text3}}</p>
            </div>
          </div>
        </div>

      </div>
    </div>
    <div class="data-view">
      <div class="resource-data">
        <ul>
          <li>445585</li>
          <li>856585</li>
          <li>482655</li>
        </ul>
      </div>
      <div class="resource">
        <ul>
          <li>6545585</li>
          <li>152685</li>
          <li>624585</li>
        </ul>
      </div>
    </div>
  </div>
</template>
<script>
  import echarts from 'echarts'
  import '../../static/china.js' // 引入中国地图数据
  // import 'echarts/map/js/china.js';
  export default {
    data() {
      return {
        model1: '',
        countData:[],
        dataIndex: '',
        countDatas: [
          {
            name: '四川省',
            data:'14666',
            teacher: '41654',
            source: '599545',
            focus:'454556'
          },
          {
            name: '湖北省',
            data: '14956',
            teacher: '44944',
            source: '544445',
            focus: '45956'
          },
          {
            name: '广东省',
            data: '89966',
            teacher: '41654',
            source: '545445',
            focus: '5416'
          },
          {
            name: '云南省',
            data: '14986',
            teacher: '418794',
            source: '545445',
            focus: '45556'
          }
        ],
        periodList: [
          {
            value: 1,
            label: '学前'
          },
          {
            value: 2,
            label: '小学'
          },
          {
            value: 3,
            label: '初中'
          },
          {
            value: 4,
            label: '高中'
          },
          {
            value: 5,
            label: '中职'
          },
        ],
        subjectList: [
          {
            value: 1,
            label: '语文'
          },
          {
            value: 2,
            label: '数学'
          },
          {
            value: 3,
            label: '英语'
          },
          {
            value: 4,
            label: '生物'
          },
          {
            value: 5,
            label: '化学'
          },
        ],
        teacherList: [],
        teacher: {
          datazt: [
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people01.jpg'), title: '省级名师', name: '周杨', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people02.jpg'), title: '省级名师', name: '李俊峰', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people04.jpg'), title: '省级名师', name: '王志明', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people03.jpg'), title: '省级名师', name: '李国强', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people05.jpg'), title: '省级名师', name: '黄明莉', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people08.jpg'), title: '省级名师', name: '李章杰', period: '中学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people06.jpg'), title: '省级名师', name: '周湾明', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people07.jpg'), title: '省级名师', name: '徐建生', period: '中学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people09.jpg'), title: '省级名师', name: '王福生', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people10.jpg'), title: '省级名师', name: '张凯伦', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people13.jpg'), title: '省级名师', name: '吴世杰', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people12.jpg'), title: '省级名师', name: '王先森', period: '中学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people11.jpg'), title: '省级名师', name: '李德华', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people15.jpg'), title: '省级名师', name: '李萌萌', period: '小学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people14.jpg'), title: '省级名师', name: '张梦迪', period: '中学', text1: '成员', number1: '1000', text2: '资源', number2: '2000', text3: '热度', number3: '1500' },
          ],
          dataxx: [
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people04.jpg'), title: '市级名师', name: '范建健', period: '中学', text1: '成员', number1: '1260', text2: '资源', number2: '1000', text3: '热度', number3: '6500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people02.jpg'), title: '省级名师', name: '张梦娇', period: '小学', text1: '成员', number1: '1450', text2: '资源', number2: '2500', text3: '热度', number3: '1800' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people01.jpg'), title: '省级名师', name: '严苏华', period: '小学', text1: '成员', number1: '1560', text2: '资源', number2: '2050', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people05.jpg'), title: '省级名师', name: '乔国锋', period: '小学', text1: '成员', number1: '1980', text2: '资源', number2: '2500', text3: '热度', number3: '100' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people03.jpg'), title: '市级名师', name: '周育俭', period: '中学', text1: '成员', number1: '1200', text2: '资源', number2: '2080', text3: '热度', number3: '500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people06.jpg'), title: '省级名师', name: '李章杰', period: '中学', text1: '成员', number1: '1000', text2: '资源', number2: '2800', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people08.jpg'), title: '省级名师', name: '赵志田', period: '小学', text1: '成员', number1: '1600', text2: '资源', number2: '2900', text3: '热度', number3: '1600' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people07.jpg'), title: '省级名师', name: '邹守烁', period: '中学', text1: '成员', number1: '1050', text2: '资源', number2: '2200', text3: '热度', number3: '700' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people09.jpg'), title: '省级名师', name: '王福生', period: '中学', text1: '成员', number1: '1500', text2: '资源', number2: '1800', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people10.jpg'), title: '省级名师', name: '邹守烁', period: '小学', text1: '成员', number1: '2000', text2: '资源', number2: '2700', text3: '热度', number3: '5500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people15.jpg'), title: '市级名师', name: '吴世杰', period: '小学', text1: '成员', number1: '1050', text2: '资源', number2: '2300', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people12.jpg'), title: '省级名师', name: '吴兵', period: '中学', text1: '成员', number1: '1800', text2: '资源', number2: '2020', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people14.jpg'), title: '市级名师', name: '李德华', period: '小学', text1: '成员', number1: '1300', text2: '资源', number2: '2500', text3: '热度', number3: '6500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people13.jpg'), title: '省级名师', name: '李东方', period: '中学', text1: '成员', number1: '1500', text2: '资源', number2: '2060', text3: '热度', number3: '1500' },
            { provice: '四川', subject: '语文', img: require('../../assets/image/resource/people11.jpg'), title: '省级名师', name: '张浩然', period: '中学', text1: '成员', number1: '1060', text2: '资源', number2: '2800', text3: '热度', number3: '1500' },
          ]
          },
      };
    },
    mounted() {
      this.drawLine();
      this.teacherList = this.teacher.datazt;
      this.countData = this.countDatas[0]
    },
    //computed: {
    //  dataIndex: function () {
    //    console.log('12111541');
    //  }
    //},
    //watch: {
    //  dataIndex() {
    //    console.log('23612651');
    //  },  
    //},
    methods: {
      chooseSchool(data) {
        if (data == "zt") {
          this.teacherList = this.teacher.datazt
        } else if (data == "xx") {
          this.teacherList = this.teacher.dataxx
        } else if (data == "fc") {
          this.teacherList = this.teacher.datazt
        } else {
          this.teacherList = this.teacher.datazt
        }
      },
      teacherZone() {
        this.$router.push('/TeacherZone')
      },
      choosePro(data) {
        console.log(data, '5646464');
        if (data == '0') {
          this.countData = this.countDatas[0]
        } else if (data == '2') {
          this.countData = this.countDatas[1]
        }else if (data == '1') {
          this.countData = this.countDatas[2]
        }else if (data == '3') {
          this.countData = this.countDatas[3]
        }
      },
      drawLine() {
        var mapChart = echarts.init(document.getElementById('myChart'));
        // mapChart的配置
        var option = {
          series: [{
            type: 'map',
            mapType: 'china',
            label: {
              normal: {
                show: false,//显示省份标签
                textStyle: { color: "#141414" }//省份标签字体颜色
              },
              emphasis: {//对应的鼠标悬浮效果
                show: true,
                textStyle: { color: "#666" }
              }
            },
            lineStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                  offset: 0, color: '#58B3CC'
                }, {
                  offset: 1, color: '#F58158'
                }], false),
                width: 1,
                opacity: 0.5,
                curveness: 0.1
              }
            },
            itemStyle: {
              normal: {
                borderWidth: .5,//区域边框宽度
                borderColor: '#666',//区域边框颜色
                areaColor: "lightblue",//区域颜色
                //background-image: linear-gradient(135deg, #f5f7fa 0 %, #c3cfe2 100 %);
              },
              emphasis: {
                borderWidth: .5,
                borderColor: '#4b0082',
                areaColor: "#008DFF",
              }
            },
            data: [
              { name: '四川', selected: true },//福建为选中状态
              { name: '广东', selected: true },//福建为选中状态
              { name: '湖北', selected: true },//福建为选中状态
              { name: '云南', selected: true },//福建为选中状态
            ]
          }],
        }
        mapChart.setOption(option);
        mapChart.on('click', (params) => {
          let data = params.dataIndex;
          this.choosePro(data);
        });
      },
    },
    
  }
</script>
<style scoped>
  .top {
    width: 100%;
    background: -webkit-linear-gradient(left, #FFD3AC,#FFC381);
  }
  .map {
    width: 65%;
    height: 600px;
    margin: auto;
    /*margin-left:150px;*/
    padding-left: 250px;
    background: url("../../assets/image/resource/map-bg.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
  .map-pro {
    display: block;
    padding-top: 13%;
    margin-left: 2%;
    font-size: 25px;
    font-weight: 800;
    color: #f05053;
  }
  .my-map {
    height: 600px;
    width: 600px;
    /*border: 1px solid red;*/
    /*text-align: right;*/
    /*background-color:#555;*/
    margin-top: -15%;
    margin-left: 25%;
  }
  .chart {
    width: 300px;
    height: 300px;
    margin-top: -35%;
    /* border: 1px solid red; */
    margin-left: -18%;
  }
  .chart h1{
    color:gold;
    margin-top:35px;
  }
    .chart h2 {
      display: block;
      margin-top: -33px;
      margin-left: 25%;
      font-size: 20px;
      color: #fefefe;
      font-weight: 800;
    }
    .chart h3 {
      font-size:20px;
      font-weight:800;
      color:#fefefe;
    }
    .chart ul {
      list-style:none;
      width:150px;
      margin-top:10%;
    }
    .chart li {
      width: 200px;
      height: 20px;
      /*border: 1px solid red;*/
      margin-bottom: 15px;
      border-radius: 25px;
      background: -webkit-linear-gradient(left, #f05053, #f05053);
    }
    .chart span {
      color:#fff;
      font-size:14px;
      margin-left:15px;
    }
    .chart p {
      color: #fff;
      font-size: 15px;
      font-weight: 800;
      display: block;
      margin-left: 100px;
      margin-top: -21px;
    }
  .header {
    width: 100%;
    height: 56px;
    margin: auto;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    border-bottom: 1px solid #e4e4e4;
  }
  .title {
    font-size: 32px;
    line-height: 56px;
    color: #000;
    float:left;
  }
  .region {
    width: 580px;
    margin-left: 60px;
    float: left;
  }
   .region li {
    float: left;
    margin-right: 60px;
    margin-top: 12px;
    font-weight:700;
    font-size: 20px;
    list-style:none;
  }
    .region li a:hover {
      color: #1a89e3;
      border-bottom: 2px solid #1a89e3;
    }
    .region li a {
      display: inline-block;
      line-height: 36px;
      color: #888;
      padding-bottom: 6px;
    }
  .teacher-show {
    width: 1200px;
    height: 1228px;
    margin: 45px auto auto;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  .select {
    float: right;
    margin-top: -3%;
  }
  .content-buttom {
    width: 1200px;
    height: 1228px;
  }
  .teacher-item {
    width: 222px;
    height: 313px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    border: 1px solid #ececec;
    -webkit-box-shadow: 1px 1px 10px #ececec;
    box-shadow: 1px 1px 10px #ececec;
    margin-bottom: 20px;
    background: #fff;
    float: left;
    margin-left: 1%;
    margin-top: 1%;
  }
  .t-title {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
  }
    .t-title span {
      display: inline-block;
      line-height: 20px;
      font-size: 16px;
      color: #555;
      margin: 20px;
    }
   .img-content {
    width: 100%;
    height: 100px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
  }
  .th_pto {
    width: 110px;
    height: 105px;
    border-radius: 50%;
    margin-left: -30px;
    margin-top: -25px;
    position: relative;
  }
  .teacher-info {
    width: 100%;
    height: 70px;
    text-align: center;
    margin-top: 22px;
  }
    .teacher-info .name {
      font-size: 18px;
      line-height: 30px;
      font-weight: bold;
    }
    .teacher-info .subject {
      width: 120px;
      height: 25px;
      margin: 0 auto;
      -webkit-border-radius: 20px;
      border-radius: 20px;
      background: -webkit-linear-gradient(left, #ff7e56, #ffc77d);
    }
      .teacher-info .subject p span {
        display: inline-block;
        width: 4px;
        height: 4px;
        -webkit-border-radius: 50%;
        border-radius: 50%;
        margin-top: 10px;
        background: #fff;
        margin: 3px 6px;
      }
      .teacher-info .subject p {
        padding-top: 3px;
        font-size: 12px;
        font-weight: 800;
      }
  .teacher-detailed {
    width: 100%;
    height: 60px;
    margin-top: 8px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-justify-content: space-around;
    -ms-flex-pack: distribute;
    justify-content: space-around;
  }
   .item .txt {
    color: #888;
  }
  .data-view {
    width: 100%;
    height: 650px;
    overflow: hidden;
    background: url('../../assets/image/resource/teacher-bottom.png') no-repeat;
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
  .four {
    width: 409px;
    height: 248px;
    overflow: hidden;
    margin: 40px auto;
  }
    .four img {
      width: 409px;
    }
  .ewm_img {
    width: 79.5%;
    height: 300px;
    text-align: right;
    position: absolute;
    top: 2128px;
    left: 0px;
  }
    .ewm_img img {
      width: 150px;
      height: 150px;
    }
  .ewm_text {
    font-size: 17px;
    color: #fff;
    margin-top: 10px;
  }
  .resource-data {
    /*width: 1100px;*/
    height: 130px;
    /*text-align:left;*/
  }
    .resource-data ul {
      font-size: 25px;
      font-weight: 800;
      margin-top: 365px;
      margin-left: 565px;
    }
      .resource-data ul li {
        float: left;
        width: 316px;
        display: block;
        font-size: 28px;
        color:#ff705b;
      }
 .resource {
    /*width: 1100px;*/
    height: 130px;
    /*text-align:left;*/
  }
  .resource ul {
    font-size: 25px;
    font-weight: 800;
    margin-top: 48px;
    margin-left: 565px;
  }
      .resource ul li {
        float: left;
        width: 316px;
        display: block;
        font-size: 28px;
        color:#ff705b;
      }
  .data-item {
    width: 130px;
    height: 100%;
  }
  .img-content {
    width: 60px;
    height: 60px;
    margin: 25px auto 17px;
    text-align: center;
  }
  .data-name {
    font-size: 18px;
    color: #555;
  }
  .number {
    font-size: 24px;
    color: #000;
  }

</style>
