index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="user-card">
  3. <!-- 背景图 -->
  4. <image class="user-card-bg" src="/static/image/home/usecard-bg.png" />
  5. <!-- 左上:姓名 + 职位 -->
  6. <view class="user-header">
  7. <view class="name-row">
  8. <text class="user-name">{{ info.nickName || '用户' }}</text>
  9. <text class="user-role">{{ info.postName || '职位' }}</text>
  10. </view>
  11. <text class="company-name">{{ info.companyName || '公司名称' }}</text>
  12. </view>
  13. <!-- 右上:头像 -->
  14. <view class="avatar-wrapper">
  15. <UserAvatar :src="info.avatar" :name="info.nickName" :size="142"
  16. :badge-src="'/static/image/public/badge-icon.png'" :badge-size="56" />
  17. </view>
  18. <!-- 左下:联系方式 -->
  19. <view class="user-contact">
  20. <view class="contact-row" @click="onCall">
  21. <uni-icons type="phone" :size="18" color="#666666"></uni-icons>
  22. <text style="flex: none;" class="contact-text">{{ info.phonenumber || '暂无电话' }}</text>
  23. <text v-if="info.phonenumber" class="call-btn">拨打</text>
  24. </view>
  25. <view class="contact-row">
  26. <uni-icons type="email" :size="18" color="#666666"></uni-icons>
  27. <text class="contact-text">{{ info.email || '暂无邮箱' }}</text>
  28. </view>
  29. <view class="contact-row">
  30. <uni-icons type="location" :size="18" color="#666666"></uni-icons>
  31. <text class="contact-text">{{ info.companyAddress || '暂无地址' }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script setup>
  37. import UserAvatar from '@/components/user-avatar/index.vue'
  38. const props = defineProps({
  39. info: {
  40. type: Object,
  41. default: () => ({})
  42. }
  43. })
  44. const emit = defineEmits(['call'])
  45. const onCall = () => {
  46. if (props.info.phonenumber) {
  47. uni.makePhoneCall({
  48. phoneNumber: props.info.phonenumber
  49. })
  50. } else {
  51. uni.showToast({
  52. title: '暂无电话号码',
  53. icon: 'none'
  54. })
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .user-card {
  60. position: relative;
  61. z-index: 2;
  62. width: 100%;
  63. height: 400rpx;
  64. box-sizing: border-box;
  65. padding: 80rpx 40rpx 32rpx;
  66. position: relative;
  67. .user-card-bg {
  68. position: absolute;
  69. top: 0;
  70. left: 0;
  71. width: 100%;
  72. height: 100%;
  73. z-index: 0;
  74. }
  75. view,
  76. text {
  77. position: relative;
  78. z-index: 1;
  79. }
  80. .user-header {
  81. .name-row {
  82. display: flex;
  83. align-items: center;
  84. margin-bottom: 16rpx;
  85. .user-name {
  86. font-size: 44rpx;
  87. font-weight: 700;
  88. color: #202020;
  89. line-height: 1.2;
  90. }
  91. .user-role {
  92. margin-left: 16rpx;
  93. padding: 6rpx 16rpx;
  94. background: rgba(68, 110, 255, 0.10);
  95. border-radius: 8rpx;
  96. font-size: 24rpx;
  97. font-weight: 500;
  98. color: #446eff;
  99. }
  100. }
  101. .company-name {
  102. font-size: 28rpx;
  103. font-weight: 500;
  104. color: #666666;
  105. line-height: 1.4;
  106. }
  107. }
  108. .avatar-wrapper {
  109. position: absolute;
  110. top: 74rpx;
  111. right: 36rpx;
  112. z-index: 2;
  113. }
  114. .user-contact {
  115. margin-top: 32rpx;
  116. .contact-row {
  117. display: flex;
  118. align-items: center;
  119. margin-bottom: 16rpx;
  120. position: relative;
  121. uni-icons {
  122. margin-right: 12rpx;
  123. flex-shrink: 0;
  124. }
  125. .contact-text {
  126. font-size: 26rpx;
  127. color: #666666;
  128. overflow: hidden;
  129. white-space: nowrap;
  130. text-overflow: ellipsis;
  131. flex: 1;
  132. }
  133. .call-btn {
  134. flex-shrink: 0;
  135. margin-left: 6rpx;
  136. font-size: 20rpx;
  137. color: #4080FF;
  138. border-radius: 20rpx;
  139. line-height: 1.6;
  140. }
  141. }
  142. }
  143. }
  144. </style>