<!--
 * @Author: your name
 * @Date: 2021-10-14 19:06:52
 * @LastEditTime: 2021-10-14 19:14:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/WeiboDetails/weiboWordCloud/index.vue
-->
<template>
  <div class="wwc-outter" v-loading="load">
    <v-label-div title="词云分布">
    </v-label-div>
    <div class="wwc-inner">
      <v-echarts :opt="opt"></v-echarts>
    </div>
  </div>
</template>

<script>
import {getHotWord} from  "@/api/KeyMediaTheme/index.js"
import createWordCloud from "@/utils/gol/bubbleWord";
export default {
  name: "weiboWordCloud",
  data() {
    return {
      opt: {},
      load: false,
      positiveData: {},
      negativeData: {},
      form: {
        token: "",
        sSource: '',
        sGuid: '',
        ilimitType: 0,
      },
    };
  },
  created() {
        this.form.token = this.getToken;
        this.form.sGuid = this.$route.query.sGuid;
        this.form.sSource = this.$route.query.source || "抖音";
        if(this.form.sSource == '汽车之家') {
        this.form.ilimitType = 1;
        } else if (this.form.sSource == '懂车帝' && this.getCarCircle == 1) {
        this.form.ilimitType = 2;
        }
        this.getData();
  },
  methods: {
    getData() {
      this.load = true;
      Promise.all([this.getH()]).then(() => {
        // 什么也不执行
        this.load = false;
      });
    },
    // 正面
    getH() {
      return new Promise((resolve, reject) => {
        let obj = Object.assign({}, this.getCtime2, this.form);
        getHotWord(obj)
          .then((res) => {
            this.positiveData = res.data || {};
            this.opt = createWordCloud(res.data);
            resolve(res);
          })
          .catch(() => {
            reject(false);
          });
      });
    },
  },
};
</script>

<style lang="less" scoped>
.wwc-outter {
  width: 618px;
  height: 460px;
  border: 2px solid #0f2a4d;
  margin-left: 16px;
  .wwc-inner {
    width: 100%;
    height: calc(100% - 48px);
  }
}
</style>