<template>
  <div class="home-container">
    <el-row :gutter="20">
      <el-col :span="24">
        <el-card>
          <p class="card-title">快捷菜单</p>
          <panel-group />
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="12" :md="13"  :lg="10">
        <el-card class="card-group">
          <p class="card-title">待办事项</p>
          <el-row :gutter="20">
            <el-col :xs="24" :sm="24" :md="12"  :lg="12" v-for="(v,i) in dataList" :key="i">
              <div class="card-panel"  >
                <div class="card-panel-icon-wrapper icon-people">
                  <svg-icon icon-class="peoples" class-name="card-panel-icon" />
                  <div class="card-icon-text">
                    {{v.taskTypeText}}
                  </div>
                </div>
                <div class="card-panel-description">
                  <div class="card-panel-text">
                    {{v.statusText}}
                  </div>
                  <count-to :start-val="0" :end-val="v.nums" :duration="3000" class="card-panel-num" />
                </div>
              </div>
            </el-col>
          </el-row>
        </el-card>


      </el-col>
      <el-col :xs="24" :sm="12" :md="11"  :lg="14">
        <el-card class="chart-wrapper">
          <p class="card-title">其他</p>
          <el-tabs type="border-card">
            <el-tab-pane label="通知公告">通知公告</el-tab-pane>
            <el-tab-pane label="知识库">知识库</el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>


  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import CountTo from 'vue-count-to'
import {homeData} from '../api/login'
export default {
  name: 'Index',
  components: {
    PanelGroup,
    CountTo
  },
  data() {
    return {
      dataList:[],
    }
  },
  mounted(){
    this.getData();
  },
  methods: {
    getData(){
      homeData().then(res=>{
        this.dataList = res.data;
      })
    }
  }
}
</script>
<style lang="scss">
.home-container{
  .el-card__body{
    padding: 10px 20px 20px 20px;
  }
  .card-group{
    .el-card__body {
      padding-bottom: 10px;
    }
  }
}
</style>
<style lang="scss" scoped>
.home-container {
  padding: 20px;
  background-color: rgb(240, 242, 245);
  .chart-wrapper {
    background: #fff;
    margin-top: 20px;
  }
}
.card-title{
  margin: 0 0 10px 0;
}
.card-group{
  .card-title{
    margin: 0;
  }
}
.card-group {
  margin-top: 20px;
  .card-panel {
    display: flex;
    flex:1;
    justify-content: space-between;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    margin: 10px 0;

    .icon-people {
      color: #40c9c6;
    }

    .card-panel-icon-wrapper {
      height: 120px;
      margin: 10px;
      padding: 10px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    .card-panel-icon {
      float: left;
      font-size: 44px;
    }
    .card-icon-text{
      padding-top: 8px;
      text-align: center;
      line-height: 20px;
      color: rgba(0, 0, 0, 0.65);
      font-size: 16px;
    }
    .card-panel-description {
      display: flex;
      flex-direction: column;
      justify-content: center;
      font-weight: bold;
      margin: 10px;
      .card-panel-text {
        text-align: center;
        line-height: 18px;
        color: rgba(0, 0, 0, 0.65);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
