<!--
 * @Author: your name
 * @Date: 2021-10-12 15:24:48
 * @LastEditTime: 2021-11-01 10:00:09
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/BrandInsight/weiboVolumeTrend/index.vue
-->
<template>
    <div class="wvt-outter" v-loading="load">
        <v-label-div title="微博声量趋势" :showLine="false" :eStyle="{ 'border-style': 'none' }">
        </v-label-div>
        <div class="wvt-inner">
             <v-echarts :opt="opt"></v-echarts>
        </div>
    </div>
</template>

<script>
import {getCountTime0528} from "@/api/BrandInsight";
import createOpt from "./opt"
export default {
    name: "weibo-volume-trend",
    props: ["brand"],
    data() {
        return {
            load: false,
            form: {
                sBrand: "",
                token: "",
            },
          opt: {}
        }
    },
     created() {
        this.form.token = this.getToken;
        this.form.sBrand = this.getBrand.brandname || this.brand;
        this.getData();
    },
    methods: {
        getData() {
          let obj = Object.assign({}, this.getCtime2, this.form);
          this.load = true;
          getCountTime0528(obj).then(res => {
              let data = res.data || [];
              let dx = [];
              let ds = [];
              data.forEach(ele => {
                  let key = ele.Time;
                  let value = ele.value;
                  dx.push(key);
                  ds.push(value);
              })
              this.opt = createOpt(dx, ds);
              this.load = false;
          })
        }
    }
}
</script>

<style lang="less" scoped>
.wvt-outter {
    width: 580px;
    height: 412px;
    margin-left: 16px;
    .wvt-inner {
        width: 100%;
        height: calc(100% - 48px);
    }
}
</style>
