<!--
 * @Author: your name
 * @Date: 2021-10-16 13:45:18
 * @LastEditTime: 2021-10-16 13:49:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/BrandComparison/comparisonOfForumPostingTrends/index.vue
-->
<template>
  <div class="cop-outter">
    <v-label-div
      title="论坛发帖趋势对比"
      :showLine="false"
      :eStyle="{ 'border-style': 'none' }"
    />
    <div class="cop-inner">
      <v-echarts :opt="opt"></v-echarts>
    </div>
  </div>
</template>

<script>
import { getCountTime0528C } from "@/api/BrandComparison/BbsBrand.js";
import createOpt from "./opt";
export default {
  name: "comparisonOfForumPostingTrends",
  data() {
    return {
      form: {
        token: "",
        sBrand: "",
      },
      opt: {},
    };
  },
  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() {
      let obj = Object.assign({}, this.getCtime2, this.form);
      getCountTime0528C(obj)
        .then((res) => {
          let data = res.data || [];
          let dx = [];
          let ds = [];
          data.forEach((ele) => {
            let key = ele.key;
            let value = ele.value;
            dx.push(key);
            ds.push(value);
          });
          this.opt = createOpt(dx, ds);
        })
    },
  },
};
</script>

<style lang="less" scoped>
.cop-outter {
  width: 944px;
  height: 412px;
  .cop-inner {
    width: 100%;
    height: calc(100% - 48px);
  }
}
</style>
