<!--
 * @Author: tqh
 * @FilePath: /yuan-qingdao-zld-browser/src/views/monitoring/website/components/accessVisit.vue
 * @Date: 2022-09-2 08:56:59
-->
<script setup lang="ts">
import { ref, watch, defineProps } from "vue";
import CommonCard from '../../../../components/CommonCard/CommonCard.vue'
import RoseChart from '../../../../components/chart/RoseChart/RoseChart.vue'
const list = ref([]) as any
const props = defineProps({
  LIST: Array
})
watch(() => props.LIST, (val, preVal) => {
  list.value = val.map((item, index) => {
    return {
      name: item.city,
      value: item.visitCount
    }
  })
})
</script>  

<template>
  <CommonCard title="各地市访问量TOP5" class="access-visit">
    <RoseChart :borderRadius="0" :pieCenter="['28%', '50%']" legendTop="auto" legendRight="20px" :legendShow="true"
      :labelLineShow="false" :labelShow="false" :chartData="list" />
  </CommonCard>
</template>

<style lang="scss" scoped>
::v-deep .custom-rose-legend {
  width: 40%;
}

.access-visit {
  width: 100%;
  height: 360px;
  font-size: 14px;
  color: rgba(0, 0, 0, .65);

  .access-visit-con {
    width: 100%;
    margin-top: 34px;
  }

  .access-visit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;

    .access-rank {
      background: rgba(0, 0, 0, .2);
      width: 24px;
      height: 24px;
      border-radius: 2px;
      line-height: 24px;
      text-align: center;
      color: #fff;
      font-size: 12px;
    }

    .access-rank-first {
      background: #FF5B5D;
    }

    .access-rank-secend {
      background: #F18301;
    }

    .access-rank-third {
      background: #0095FF;
    }

    .access-item-name {
      margin-left: 8px;
      width: 160px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      white-space: nowrap; // 默认不换行；
    }

    .access-item-count {
      color: rgba(0, 0, 0, .4);
    }

    .access-visit-flex {
      display: flex;
      align-items: center;
    }
  }
}
</style>
