OuterPerson.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div class="outer-person-container">
  3. <div class="container-title">
  4. <span class="line"></span>
  5. <span class="title">今日访客</span>
  6. </div>
  7. <OuterPersonChart
  8. v-if="pieData.length > 0"
  9. class="chart-container"
  10. id="OuterPersonChart"
  11. :data="pieData"
  12. ></OuterPersonChart>
  13. <OuterPersonChartLegend v-if="pieData.length > 0" class="chart-legend" :data="pieData"></OuterPersonChartLegend>
  14. </div>
  15. </template>
  16. <script setup lang="ts">
  17. import { onMounted, ref } from 'vue';
  18. import OuterPersonChart from '../charts/OuterPersonChart.vue';
  19. import OuterPersonChartLegend from '../charts/OuterPersonChartLegend.vue';
  20. import { getPersonOverviewChartData } from '../hooks';
  21. import type { PieChartData } from '../types';
  22. const pieData = ref<PieChartData[]>([]);
  23. onMounted(async () => {
  24. pieData.value = await getPersonOverviewChartData();
  25. });
  26. </script>
  27. <style scoped lang="scss">
  28. .container-title {
  29. height: 24px;
  30. display: flex;
  31. align-items: center;
  32. font-weight: 500;
  33. font-size: 16px;
  34. color: #000000;
  35. .line {
  36. width: 3px;
  37. height: 16px;
  38. background: #1777ff;
  39. margin-right: 10px;
  40. }
  41. .title {
  42. margin-right: 12px;
  43. }
  44. }
  45. .outer-person-container {
  46. width: 100%;
  47. height: 100%;
  48. padding-top: 14px;
  49. position: relative;
  50. }
  51. .chart-container {
  52. width: 100%;
  53. height: calc(100% - 24px);
  54. }
  55. .chart-legend {
  56. position: absolute;
  57. top: 120px;
  58. left: 55%;
  59. }
  60. </style>