<!--
 * @Author: your name
 * @Date: 2021-10-14 15:54:06
 * @LastEditTime: 2021-11-04 17:03:24
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/WeiboDetails/weiboContentTOPVolume/index.vue
-->
<template>
  <div>
    <div class="d22" v-if="(form.sSource == '汽车之家') || (form.sSource == '懂车帝')">
      <div class="wct-small-outter">
        <v-label-div title="内容TOP声量"> </v-label-div>
        <div class="wct-inner">
          <vue-scroll>
                <div class="d-rank" style="margin-left: 16px">
                    <div class="rank1">
                        <v-ranking-kmd v-for="(item,index) in d4" :key="index" :lineShow="index === 0 ? false : true" :num="index + 1" :label="item.label|doStr(8)" :val="item.val" @toMedia="toKeyMedia(item)"></v-ranking-kmd>
                    </div>
                </div>
          </vue-scroll>
        </div>
      </div>
      <div class="wct-small-outter">
        <v-label-div title="关注TOP车型"> </v-label-div>
        <div class="wct-inner">
            <vue-scroll>
              <div class="d-rank" style="margin-left: 16px;">
                  <div class="rank1">
                      <v-ranking-kmd v-for="(item,index) in d3" :key="index" :lineShow="index === 0 ? false : true" :num="index + 1" :label="item.label|doStr(8)" :val="item.val" @toMedia="toKeyMedia(item)"></v-ranking-kmd>
                  </div>
              </div>
            </vue-scroll>
        </div>
      </div>
    </div>
    <div class="wct-outter" v-loading="load" v-else>
      <v-label-div title="内容TOP声量"> </v-label-div>
      <div class="wct-inner">
          <div class="dd2">
              <div class="d-rank" style="margin-left: 16px;display: flex">
                  <div class="rank1">
                      <v-ranking-kmd v-for="(item,index) in d1" :key="index" :lineShow="index === 0 ? false : true" :num="index + 1" :label="item.label|doStr(8)" :val="item.val" @toMedia="toKeyMedia(item)"></v-ranking-kmd>
                  </div>
                  <div class="rank1" style="margin-left: 14px">
                      <v-ranking-kmd v-for="(item,index) in d2" :key="index" :lineShow="index === 0 ? false : true" :num="index + 6" :label="item.label|doStr(8)" :val="item.val" @toMedia="toKeyMedia(item)"></v-ranking-kmd>
                  </div>
            </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { comparePig } from "@/utils/gol/dataTool"
import vRankingKmd from "./v-ranking-kmd"
import { getHomeDirectWeiBo0528 } from "@/api/KeyMediaHome/index.js"
import {getHomeGuanZhuSeriesname} from "@/api/KeyMediaHome/index.js"
export default {
  name: "weiboContentTOPVolume",
  components: {
      vRankingKmd
  },
  data() {
    return {
      load: false,
      form: {
        sSource: '',
        ilimitType: 0,
      },
      d1: [],
      d2: [],
      d3: [],
      d4: [],
      list: [],
      colors: ['#3373CC', '#63AECC', '#54BF93', '#CC9D12', '#3373CC', '#63AECC', '#54BF93', '#CC9D12']
    };
  },
  created() {
    this.form.sSource = this.$route.query.source || "抖音";
    if (this.form.sSource == '汽车之家' && this.getCarCircle == 1) {
      this.form.ilimitType = 1;
    } else if (this.form.sSource == '懂车帝' && this.getCarCircle == 1) {
      this.form.ilimitType = 2;
    }
    this.getData();
  },
  methods: {
    getData() {
      // this.load = true;
      let obj = Object.assign({}, this.getCtime2, this.form);
      getHomeDirectWeiBo0528(obj).then(res => {
        let data = res.data || [];
        data.sort(comparePig('value'));
        let mediaList = [];
        data.forEach(ele => {
          let obj = { label: ele.key, val: ele.value};
          mediaList.push(obj);
        })
        this.d1 = mediaList.slice(0, 5);
        this.d2 = mediaList.slice(5, 10);
        this.d4 = mediaList;
        this.load = false;
      });
      getHomeGuanZhuSeriesname(obj).then(res => {
        let data = res.data || [];
        let arr = [];
        for(let key in data) {
          let obj = {label: key, val: data[key]};
          arr.push(obj)
        }
        this.d3 = arr
      })
    }
  }
}
</script>

<style lang="less" scoped>
.d22 {
  width: 100%;
  height: auto;
  display: flex;
  justify-content: flex-start;
}
.wct-outter {
  width: 936px;
  height: 460px;
  border: 2px solid #0f2a4d;
  margin-left: 16px;
  overflow: hidden;
}
.wct-small-outter {
  width: 460px;
  height: 460px;
  border: 2px solid #0f2a4d;
  margin-left: 16px;
  overflow: hidden;
  padding-bottom: 24px;
}
.wct-inner {
  width: 100%;
  margin-top: 16px;
  height: calc(100% - 48px);

  .wct-d1 {
    position: relative;
    width: 233px;
    height: 206px;
    display: inline-block;

    .wct-d1-dd1 {
      position: absolute;
      padding: 0px 16px;
      width: 100%;
      height: auto;
      display: flex;
      justify-content: space-between;
      top: 140px;
      left: 0px;

      span {
        color: #d8d8d8;
        font-size: 12px;

        .ss1 {
          font-family: Bebas;
          font-size: 16px;
          color: #ffffff;
        }
      }
    }
  }
}
</style>
