<!--
 * @Author: your name
 * @Date: 2021-10-16 10:30:29
 * @LastEditTime: 2021-11-12 10:27:57
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/BrandComparison/weiboBigVComparison/index.vue
-->
<template>
  <div class="wbc-outter" v-loading="load">
    <v-label-div
      title="微博大V对比"
      :showLine="false"
      :eStyle="{ 'border-style': 'none' }"
    ></v-label-div>
    <div class="wbc-inner">
      <v-echarts :opt="opt"></v-echarts>
    </div>
  </div>
</template>

<script>
import { getBoauthen0528C } from "@/api/BrandComparison/BrandWeibo.js";
import createOpt from "./opt";
export default {
  name: "weiboBigVComparison",
  data() {
    return {
      load: false,
      form: {
        token: "",
        sBrand: "",
        sSeriesName: "",
        iContrastType: 2
      },
      opt: {}
    };
  },
  created() {
    this.initData();
  },
  methods: {
    initData() {
      this.form.token = this.getToken;
      let arr = this.getMComparison;
      let brands = [];
      let models = [];
      arr.forEach((ele) => {
        brands.push(ele.brand);
        models.push(ele.model);
      });
      this.form.sBrand = brands.toString();
      this.form.sSeriesName = models.toString();
      this.getData();
    },
    getData() {
      return new Promise((resolve, reject) => {
        let obj = Object.assign({}, this.getCtime2, this.form);
        this.load = true;
        getBoauthen0528C(obj)
          .then((res) => {
            let data = res.data || [];
            this.opt = createOpt(data);
            this.load = false;
            resolve(data);
          })
          .catch(() => {
            reject(false);
          });
      });
    },
  },
};
</script>
<style lang="less" scoped>
.wbc-outter {
  width: 630px;
  height: 412px;
  .wbc-inner {
    width: 100%;
    height: calc(100% - 48px);
  }
}
</style>
