<script setup>
import { ref } from 'vue'
import { userDetailService } from '@/api/user'
const drawerVisible = ref(false)

const userInfo = ref({})
const getUserInfo = async (id) => {
  const {
    data: { data }
  } = await userDetailService(id)
  console.log(data)
  userInfo.value = data
}

// 组件对外暴露一个方法 open ，基于 open 传来的参数，区分添加还是编辑
const open = (id) => {
  getUserInfo(id)
  drawerVisible.value = true
}
// 向外暴露
defineExpose({
  open
})

// const emit = defineEmits(['success'])
// emit('success')
</script>
<template>
  <el-drawer v-model="drawerVisible" draggable title="认证信息">
    <el-descriptions
      class="margin-top"
      title=""
      :column="1"
      :size="size"
      border
    >
      <el-descriptions-item label="所属单位">{{
        userInfo.college
      }}</el-descriptions-item>
      <el-descriptions-item label="学工号">{{
        userInfo.schoolNumber
      }}</el-descriptions-item>
      <el-descriptions-item label="身份类型">
        <el-tag size="small">{{ userInfo.type }}</el-tag>
      </el-descriptions-item>
    </el-descriptions>
  </el-drawer>
</template>
