<!--
 * @Author: your name
 * @Date: 2021-10-12 18:43:22
 * @LastEditTime: 2021-11-01 18:57:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/BrandInsight/keyMedia/index.vue
-->

<template>
    <div class="km-outter" v-loading="load">
        <v-label-div title="重点媒体" :showLine="false" :eStyle="{'border-style': 'none'}">
            <!-- <v-pagination :data="pdata" :style="{}" @change="handlerData"></v-pagination> -->
        </v-label-div>
        <div class="km-inner">
            <v-echarts :opt="opt"></v-echarts>
        </div>
    </div>
</template>

<script>
import { getWebsite } from "@/api/BrandInsight";
import createOpt from "./opt";
export default {
    name: "keyMedia",
    props: ["brand"],
    data() {
        return {
            load: false,
            form: {
                token: "",
                sBrand: "奥迪",
            },
            opt: {},
            pdata: []
        };
    },
    created() {
        this.form.token = this.getToken;
        this.form.sBrand = this.getBrand.brandname || this.brand;
        this.getData();
    },
    methods: {
        getData() {
            this.load = true;
            let obj = Object.assign({}, this.getCtime2, this.form);
            getWebsite(obj).then((res) => {
                let data = res.data || {};
                let dy = [];
                let ds = [];
                for (let key in data) {
                   dy.push(key);
                   ds.push(data[key]);
                }
               this.opt = createOpt(dy, ds);
               this.load = false;
            });
        },
    },
};
</script>

<style lang="less" scoped>
.km-outter {
    position: relative;
    width: 630px;
    height: 412px;
    margin-left: 16px;
    .km-inner {
        width: 100%;
        height: calc(100% - 48px);
    }
}
</style>
