baseInfo.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!-- 基本信息 -->
  2. <template>
  3. <div class="d-flex">
  4. <!-- 头像 -->
  5. <div class="avatarsBox">
  6. <v-badge
  7. v-if="info?.sex === '1' || info?.sex === '2'"
  8. bordered
  9. offset-x="-25"
  10. offset-y="33"
  11. :color="info?.sex ? (info?.sex === '1' ? '#1867c0' : 'error') : 'error'"
  12. :icon="info?.sex ? (info?.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'">
  13. <v-avatar size=80 :image="getUserAvatar(info?.avatar, info?.sex)"></v-avatar>
  14. </v-badge>
  15. <v-avatar v-else size=80 :image="getUserAvatar(info?.student?.studentHeadImg, info?.sex)"></v-avatar>
  16. </div>
  17. <!-- 信息 -->
  18. <div style="flex: 1;">
  19. <span style="font-size: 20px; font-weight: 600;color: var(--color-666);">{{ info?.student?.studentName }}</span>
  20. <div class="d-flex mt-2 listBox">
  21. <span>{{ info?.student?.schoolDepartmentName }}</span>
  22. <span v-if="info?.student?.schoolDepartmentName && info?.student?.majorName" class="mx-3">|</span>
  23. <span>{{ info?.student?.majorName }}</span>
  24. </div>
  25. <view class="mt-2 listBox">{{ info?.student?.schoolClassName }}</view>
  26. </div>
  27. </div>
  28. </template>
  29. <script setup>
  30. defineOptions({name: 'studentList-student-details-baseInfo'})
  31. import { ref } from 'vue'
  32. import { getUserAvatar } from '@/utils/avatar'
  33. const props = defineProps({
  34. data: Object
  35. })
  36. const info = ref({})
  37. if (props.data && Object.keys(props.data).length) {
  38. info.value = props.data
  39. info.value.sex = info.value?.student?.studentSex === '男' ? '1' : info.value?.student?.studentSex === '女' ? '2' : info.value?.student?.sex || null
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .avatarsBox {
  44. height: 80px;
  45. width: 80px;
  46. position: relative;
  47. // margin: 32px;
  48. margin-right: 40px;
  49. .img {
  50. width: 100%;
  51. height: 100%;
  52. }
  53. .mdi {
  54. font-size: 42px;
  55. color: #fff;
  56. }
  57. div {
  58. position: absolute;
  59. top: 50%;
  60. left: 50%;
  61. transform: translate(-50%, -50%);
  62. border-radius: 50%;
  63. }
  64. }
  65. .listBox {
  66. display: flex;
  67. flex-wrap: wrap; /* 允许换行 */
  68. width: 100%; /* 设置容器宽度 */
  69. // height: 68px;
  70. overflow: hidden;
  71. color: var(--color-777);
  72. div {
  73. margin-right: 50px;
  74. span {
  75. height: 32px;
  76. line-height: 32px;
  77. }
  78. .mdi {
  79. font-size: 22px;
  80. margin-right: 8px;
  81. }
  82. }
  83. }
  84. </style>