<template>
  <view class="data-main">
    <view v-for="data in dataArray" :key="data.text" class="data-main-item">
      <view class="data-value">{{ data.value }}</view>
      <view class="data-text">{{ data.text }}</view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { computed, inject, type Ref, ref } from 'vue';
import type { UserInfo } from '@/types/inspector/mine';

const userInfo = inject<Ref<UserInfo>>('userInfo');

const dataArray = computed(() => {
  return [
    {
      text: '督学人数',
      value: userInfo.value.inspectorUserNum ?? 0,
    },
    {
      text: '督学次数',
      value: userInfo.value.inspectorNum ?? 0,
    },
    {
      text: '学习计划数',
      value: userInfo.value.planNum ?? 0,
    },
  ];
});
</script>

<style scoped lang="scss">
.data-main {
  width: 690rpx;
  height: 167rpx;
  background: white;
  margin: 30rpx auto;
  display: flex;
  align-items: center;
  border-radius: 20rpx;

  &-item {
    display: flex;
    flex-direction: column;
    width: 33%;
    height: 100%;
    position: relative;
    place-content: center;

    &::after {
      content: '';
      width: 2rpx;
      height: 67rpx;
      background: #eeeeee;
      vertical-align: middle;
      position: absolute;
      right: 0;
      top: 50rpx;
    }

    .data-value {
      color: #0a1f13;
      text-align: center;
      font-size: 48rpx;
      font-style: normal;
      font-weight: 400;
      line-height: normal;
    }

    .data-text {
      color: #666666;
      text-align: center;
      font-size: 26rpx;
      font-style: normal;
      font-weight: 400;
      line-height: 39rpx; /* 150% */
    }
  }
}
</style>
