<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-11-13 16:37:02
 * @LastEditors: 无尘
 * @LastEditTime: 2019-11-21 10:46:18
 -->
<!--
<data-statistics-child :activeData="activeData" :barChartData="barChartData"></data-statistics-child>

import dataStatisticsChild from '@/components/active/data-statistics-child.vue';
-->

<template>
  <div class="data-statistics">
    <div class="data-statistics-body flex">
      <div class="data-statistics-left">
        <ul class="flex flex-column flex-pack-center flex-align-center">
          <li class="flex-1 flex flex-pack-center flex-align-center">
            <div class="data-statistics-icon"><img
                src="../../assets/images/bgl.png"
                alt=""
              /></div>

            <div class="data-statistics-txt flex flex-column">
              <div class="font-14 color-606266 font-w-400">活动曝光量</div>
              <div class="font-22 color-303133 font-w-600 p-t-10">{{ activeData.exposure | formatThousand }}</div>
            </div>
          </li>
          <li class="flex-1 flex flex-pack-center flex-align-center">
            <div class="data-statistics-icon"><img
                src="../../assets/images/cyrs.png"
                alt=""
              /></div>

            <div class="data-statistics-txt flex flex-column">
              <div class="font-14 color-606266 font-w-400">参与人数</div>
              <div class="font-22 color-303133 font-w-600 p-t-10">{{ activeData.attend | formatThousand }}</div>
            </div>
          </li>
          <li class="flex-1 flex flex-pack-center flex-align-center">
            <div class="data-statistics-icon"><img
                src="../../assets/images/syrs.png"
                alt=""
              /></div>

            <div class="data-statistics-txt flex flex-column">
              <div class="font-14 color-606266 font-w-400">受邀人数</div>
              <div class="font-22 color-303133 font-w-600 p-t-10">{{ activeData.invited | formatThousand }}</div>
            </div>
          </li>
        </ul>
      </div>
      <div class="data-right-wrap">
        <div class="data-right-top flex">
          <div class="data-statistics-middle flex-1 border-box m-l-20">
            <div class="font-14 color-606266">参与率</div>
            <div :class="['font-22 color-303133 p-t-5 ', activeData.attendRate]">{{ activeData.attendRate }} %</div>
            <div class="data-percentage">
              <div
                class="data-percentage-inner"
                :style="{ width: activeData.attendRate + '%' }"
              ></div>
            </div>
          </div>
          <div class="data-statistics-right flex-1 border-box m-l-20">
            <div class="font-14 color-606266">传播系数</div>
            <div class="font-22 color-303133 p-t-5">{{ activeData.spread }}</div>
            <div class="data-percentage">
              <template v-for="(child, key) in Math.floor(activeData.spread)">
                <i
                  class="iconfont icon-xiaoren color-1890ff"
                  :key="key + 'xrbg'"
                ></i>
              </template>
              <template v-for="(child, key) in 10 - Math.floor(activeData.spread)">
                <i
                  class="iconfont icon-xiaoren icon-xiaoren-opacity"
                  :key="key + 'xr'"
                ></i>
              </template>
            </div>
          </div>
        </div>
        <div class="data-right-bottom">
          <bar-chart
            :barChartData="barChartData"
            :charHeight="charHeight"
          ></bar-chart>
        </div>
        <!--<div class="chart-title font-12 color-000 text-center">- 近15天趋势图 -</div>-->
      </div>
    </div>
  </div>
</template>
<script>
import barChart from '@/components/active/bar-chart.vue';
export default {
  name: 'data-statistics',
  props: {
    activeData: {
      type: [Object,Array],
      default() {
        return {
          exposure: 0,
          attend: 0,
          invited: 0,
          attendRate: 0,
          spread: 0
        };
      }
    },
    barChartData: {
      type: [Array, Object],
      default() {
        return {};
      }
    }
  },
  components: { barChart },
  data() {
    return {
      charHeight: '220px'
    };
  },
  /* methods() {

  } */
  mounted() {
    console.log(this.activeData);
  }
};
</script>
<style lang="less" scoped>
.data-statistics {
  width: 100%;
  min-height: 300px;
  background: #fff;
  .data-statistics-body {
    position: relative;
    width: 100%;
    min-height: 300px;
    &::after {
      overflow: hidden;
    }
    .data-statistics-left {
      min-width: 164px;
      min-height: 300px;
      ul {
        min-height: 300px;
        li {
          min-height: 100px;
        }
      }
      .data-statistics-icon {
        width: 38px;
        height: 34px;
      }
    }

    .data-right-wrap {
      width: 100%;
      .data-right-bottom {
        margin-top: 40px;
      }
      .chart-title {
        height: 34px;
        margin-top: -36px;
      }
    }
    .data-statistics-middle {
      position: relative;
      min-width: 216px;
      height: 85px;
      background: #f3f6f9;
      padding: 10px 20px 0 20px;
      background-image: url(../../assets/images/cyl-bg.png);
      background-repeat: no-repeat;
      background-position: top right;
      .data-percentage {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 17px;
        background: rgba(227, 242, 253, 1);
        .data-percentage-inner {
          height: 17px;
          background: linear-gradient(90deg, rgba(53, 195, 255, 1) 0%, rgba(24, 144, 255, 1) 100%);
        }
      }
    }
    .data-statistics-right {
      position: relative;
      min-width: 216px;
      height: 85px;
      padding: 10px 20px 0 20px;
      background: #f3f6f9;
      background-image: url(../../assets/images/cbxs-bg.png);
      background-repeat: no-repeat;
      background-position: top right;
      .data-percentage {
        position: absolute;
        left: 20px;
        right: 0;
        bottom: 6px;
        .icon-xiaoren {
          font-size: 16px;
        }
        .icon-xiaoren-opacity {
          color: rgba(24, 144, 255, 0.15);
        }
      }
    }
  }
}
</style>
