<template>
  <view class="flex card">
    <view class="radio" v-if="showRadio">
      <uv-radio :name="data.user.id"></uv-radio>
    </view>
    <view class="info">
      <view class="title">{{ typeDesc }}</view>
      <view class="row">
        <view class="row-label">绑定人：</view>
        <view class="row-content">{{ data.user.nickName }}</view>
      </view>
      <view class="row">
        <view class="row-label">申请人ID：</view>
        <view class="row-content">{{ data.user.id }}</view>
      </view>
    </view>
  </view>
</template>

<script>
  const TYPE_AND_DESC_MAPPING = {
    0: '家长',
    1: '学生',
  }

  export default {
    props: {
      data: {
        type: Object,
        default() {
          return {}
        }
      },
      value: {
        type: String,
        default: null,
      },
      showRadio: {
        type: Boolean,
        default: false
      },
    },
    data() {
      return {
      }
    },
    computed: {
      typeDesc() {
        const { user } = this.data

        return TYPE_AND_DESC_MAPPING[user?.role] || ''
      },
    },
    methods: {
    },
  }
</script>

<style scoped lang="scss">
  @import './card.scss';
</style>