talentItem.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view>
  3. <view v-for="(val, index) in items" :key="index" class="list-item" @tap.stop="handleDetail(val)" >
  4. <!-- 基本信息 -->
  5. <view class="d-flex align-center">
  6. <view class="user-avatar">
  7. <image class="user-avatar-img" :src="getUserAvatar(val.avatar, val.sex)" mode="scaleToFill"></image>
  8. <image class="user-avatar-sex" :src="val?.sex ? val?.sex === '1' ? '/static/img/man.png' : '/static/img/female.png' : ''" alt="" mode="scaleToFill" />
  9. </view>
  10. <view style="flex: 1; margin-left: 10px;">
  11. <view class="font-size-18" style="color: #0E100F">{{ val.name }}</view>
  12. <view class="ss-m-t-10">
  13. <span
  14. class="color-666 font-size-14"
  15. v-for="(key, index) in desc"
  16. :key="index"
  17. >
  18. {{ val[key] }}
  19. <span v-if="index !== desc.length - 1 && val[key]" class="ss-m-x-10">|</span>
  20. </span>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 感兴趣职位 -->
  25. <view v-if="val.position?.positionNames && showLastWorkExp" class="ss-m-t-15 color-666 font-size-14">
  26. 意向职位:{{ val.position?.positionNames || '暂无' }}
  27. </view>
  28. <!-- 最近一份工作经验 -->
  29. <view v-if="val?.lastWorkExp && showLastWorkExp" class="ss-m-t-15 color-666 font-size-14">
  30. <view>
  31. <uni-icons type="smallcircle" class="ss-m-r-10" color="#666"></uni-icons>
  32. {{ formatName(val.lastWorkExp.enterpriseName) || '未填写企业名称' }}
  33. </view>
  34. <view class="ss-m-l-45">
  35. <span>{{ formatName(val.lastWorkExp.positionName) || '未填写职位名称' }}</span>
  36. <span v-if="val.lastWorkExp.startTime" class="ss-m-l-20">
  37. {{ val.lastWorkExp.startTime ? timesTampChange(val.lastWorkExp.startTime, 'Y-M') : '暂无' }}
  38. -
  39. {{ val.lastWorkExp.endTime ? timesTampChange(val.lastWorkExp.endTime, 'Y-M') : val.lastWorkExp.startTime ? '至今' : '' }}
  40. </span>
  41. </view>
  42. </view>
  43. <!-- 工作经历 -->
  44. <view v-if="val?.workList && val.workList.length > 0 && !showLastWorkExp" class="ss-m-t-15 color-666 font-size-14">
  45. <view v-for="(k, index) in val.workList" :key="k.id" class="ss-m-b-30">
  46. <template v-if="val.showAll || index < 2">
  47. <view>
  48. <uni-icons type="smallcircle" class="ss-m-r-10" color="#666"></uni-icons>
  49. {{ formatName(k.enterpriseName) || '未填写企业名称' }}
  50. </view>
  51. <view class="ss-m-l-45">
  52. <span>{{ formatName(k.positionName) || '未填写职位名称' }}</span>
  53. <span class="ss-m-l-20">
  54. <span>{{ k.startTimeStr }}</span>
  55. <span v-if="k.endTimeStr"> - {{ k.endTimeStr }}</span>
  56. </span>
  57. </view>
  58. </template>
  59. </view>
  60. <view v-if="val.workList.length > 2" class="showBtn color-primary" @tap.stop="val.showAll = Boolean(!val.showAll)">{{ val.showAll ? '收起' : '展开全部' }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script setup>
  66. import { getUserAvatar } from '@/utils/avatar.js'
  67. import { timesTampChange } from '@/utils/date'
  68. import { formatName } from '@/utils/getText'
  69. defineProps({
  70. items: Array,
  71. showLastWorkExp: {
  72. type: Boolean,
  73. default: true
  74. }
  75. })
  76. const desc = ['jobStatusName', 'eduName', 'expName']
  77. const handleDetail = ({ userId }) => {
  78. if (!userId) {
  79. uni.showToast({
  80. title: '资源获取失败,请稍后重试',
  81. icon: 'none',
  82. duration: 2000
  83. })
  84. return
  85. }
  86. uni.navigateTo({
  87. url: `/pagesB/personnelDetails/index?id=${userId}&type=1`
  88. })
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .list-item {
  93. margin: 30rpx;
  94. border-radius: 20rpx;
  95. padding: 30rpx;
  96. background-color: #fbfbfb;
  97. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  98. border: 1rpx solid #E1E4E9;
  99. }
  100. .user-avatar {
  101. position: relative;
  102. &-img {
  103. width: 60px;
  104. height: 60px;
  105. border-radius: 50%;
  106. }
  107. &-sex {
  108. position: absolute;
  109. right: 0;
  110. bottom: 2px;
  111. width: 20px;
  112. height: 20px;
  113. background-color: #fff;
  114. border-radius: 50%;
  115. }
  116. }
  117. .showBtn {
  118. text-align: center;
  119. }
  120. </style>