<template>
  <div>
    <div class="menu-title">
      概览
    </div>
    <div class="home-box">
      <div class="counts-box">
        <div class="count-item" v-for="(value, key) in count" :key="key">
          <div>{{ key }}</div>
          <div>{{ value }}</div>
        </div>
      </div>
      <div class="chart-box">
        <div class="title">正反馈率</div>
        <div id="chart"></div>
      </div>
    </div>

  </div>
</template>

<script>
import request from '@/utils/request';

var _this;
export default {
  name: "homePage",
  data() {
    return {
      count: {
        '用户': '2,636',
        '物品': '51,754',
        '总反馈': '267,610',
        '正面反馈': '120,927',
        '负面反馈': '51,123'
      }
    }
  },
  mounted() {
    _this = this;
    _this.initChart();
  },
  methods: {
    initChart() {
      let dom = document.getElementById("chart");
      let chart = _this.$echarts.init(dom);
      chart.setOption({
        grid: {
          left: '3%',
          right: '3%'
        },
        xAxis: {
          type: 'category',
          data: ['05/01', '05/02', '05/03', '05/04', '05/05', '05/06', '05/07']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            name: 'like',
            data: [0.1, 0.23, 0.52, 0.44, 0.49, 0.78, 1],
            type: 'line'
          },
          {
            name: 'star',
            data: [0.92, 0.7, 0.65, 0.44, 0.55, 0.55, 0.78],
            type: 'line'
          }
        ]
      });
    }
  }
}
</script>
<style scoped lang="scss">

.content-box > div {
  height: 100%;
}

.home-box {
  padding: 0 30px;

  height: calc(100% - 160px);
  .chart-box {
    background-color: #fff;
    box-shadow: 0px 5px 12px 1px rgba(105, 105, 105, 0.12);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 30px;
    height: calc(100% - 200px);

    #chart {
      width: 100%;
      height: calc(100% - 60px);
    }

    .title {
      width: 100%;
      height: 60px;
      line-height: 60px;
      padding-left: 20px;
      font-size: 18px;
      color: #626672;
      border-bottom: 1px solid rgba(105, 105, 105, 0.12);
    }
  }

  .counts-box {
    display: flex;
    justify-content: space-between;

    .count-item {
      width: 18%;
      height: 165px;
      background-color: #fff;
      box-shadow: 0px 5px 12px 1px rgba(105, 105, 105, 0.12);
      text-align: center;
      border-radius: 10px;

      &:hover {
        transform: scale(1.03);
      }

      > div:first-child {
        font-size: 18px;
        padding-top: 35px;
        color: rgba(103, 109, 122, 0.58);
      }

      > div:last-child {
        font-size: 40px;
        color: #3e4c5c;
        padding-top: 25px;
      }
    }
  }
}


</style>
