<template>
  <echarts-container :options="options"></echarts-container>
</template>

<script>
import EchartsContainer from "../../components/echarts/echartsContainer";
import {getUvStatistic } from "@/api/school-center/analysisAPI"
export default {
  name: "uv",
  components: {EchartsContainer, getUvStatistic},
  data() {
    return {
      options: {
        title: {
          text: "用户访问量",
          left: '40%',
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        legend: {
          data:['销量']
        },
        color: ["#1090FF"],
        xAxis: {
          type: 'category',
          data: []
        },
        grid: {
          left: "6%",
          right: "12%",
          top: "15%",
          bottom: "10%"
        },
        yAxis: {
          type: 'value'
        },
        series: [{
          data: [],
          type: 'line'
        }]
      }
    }
  },
  methods: {
    getEchartsData: function(startDate, endDate, type) {
      let param = {
        startDate: startDate,
        endDate: endDate,
        type: type
      }

      getUvStatistic(param).then(res => {
        this.options.series[0].data = res.data.seriesData;
        this.options.xAxis.data = res.data.xAxisData;
        console.log(this.options);
      });
    }
  },
  created() {

  }
}
</script>

<style scoped>

</style>