<!--
 * @Author: your name
 * @Date: 2021-10-14 11:25:20
 * @LastEditTime: 2021-10-16 11:31:16
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/WeiboDetails/weiboUserActiveArea/index.vue
-->
<template>
  <div class="wua-outter">
    <v-label-div
      title="用户区域分布"
      :showLine="false"
      :eStyle="{ 'border-style': 'none' }"
    >
      <v-tab-group
        :btns="['奥迪', '宝马', '奔驰', '吉利', '大众', '别克']"
      ></v-tab-group>
    </v-label-div>
    <div class="wua-inner">
      <div class="d1">
        <v-echarts :opt="opt1"></v-echarts>
      </div>
      <div class="d2">
        <v-echars-map :opt="opt2"></v-echars-map>
      </div>
    </div>
  </div>
</template>

<script>
import { getRegionWeiBoC } from "@/api/BrandComparison/BrandWeibo.js";
import createOptD1 from "./opt1";
import createOptD2 from "./opt2";
export default {
  name: "userAreaDistribution",
  data() {
    return {
      opt1: createOptD1(),
      opt2: createOptD2(),
      form: {
        token: "",
        sBrand: "",
      },
    };
  },
  created() {
    this.initData();
  },
  methods: {
    initData() {
      this.form.token = this.getToken;
      let arr = this.getBComparison;
      let brands = [];
      arr.forEach((ele) => {
        brands.push(ele.name);
      });
      this.form.sBrand = brands.toString();
      this.getData();
    },
    getData() {
      return new Promise((resolve, reject) => {
        let obj = Object.assign({}, this.getCtime2, this.form);
        getRegionWeiBoC(obj)
          .then((res) => {
            let data = res.data || [];
            resolve(data);
          })
          .catch(() => {
            reject(false);
          });
      });
    },
  },
};
</script>

<style lang="less" scoped>
.wua-outter {
  width: 944px;
  height: 412px;
  .wua-inner {
    width: 100%;
    height: calc(100% - 48px);
    display: flex;
    justify-content: flex-start;
    .d1 {
      width: 479px;
      height: 100%;
    }
    .d2 {
      width: 465px;
      height: 100%;
      margin-left: 16px;
    }
  }
}
</style>
