index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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.jobTitle || '职位' }}</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="isCall ? '#155DFC' : '#666666'"></uni-icons>
  22. <text style="flex: none;" class="contact-text" :class="{'call-highlight': isCall}">{{ info.phonenumber || '暂无电话' }}</text>
  23. </view>
  24. <view class="contact-row">
  25. <uni-icons type="email" :size="18" color="#666666"></uni-icons>
  26. <text class="contact-text">{{ info.email || '暂无邮箱' }}</text>
  27. </view>
  28. <view class="contact-row">
  29. <uni-icons type="location" :size="18" color="#666666"></uni-icons>
  30. <text class="contact-text">{{ info.companyAddress || '暂无地址' }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script setup>
  36. import UserAvatar from '@/components/user-avatar/index.vue'
  37. const props = defineProps({
  38. info: {
  39. type: Object,
  40. default: () => ({})
  41. },
  42. isCall:{
  43. type: Boolean,
  44. default: false
  45. }
  46. })
  47. const emit = defineEmits(['call'])
  48. const onCall = () => {
  49. if (props.info.phonenumber) {
  50. uni.makePhoneCall({
  51. phoneNumber: props.info.phonenumber
  52. })
  53. } else {
  54. uni.showToast({
  55. title: '暂无电话号码',
  56. icon: 'none'
  57. })
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .user-card {
  63. position: relative;
  64. z-index: 2;
  65. width: 100%;
  66. height: 400rpx;
  67. box-sizing: border-box;
  68. padding: 80rpx 40rpx 32rpx;
  69. position: relative;
  70. .user-card-bg {
  71. position: absolute;
  72. top: 0;
  73. left: 0;
  74. width: 100%;
  75. height: 100%;
  76. z-index: 0;
  77. }
  78. view,
  79. text {
  80. position: relative;
  81. z-index: 1;
  82. }
  83. .user-header {
  84. .name-row {
  85. display: flex;
  86. align-items: center;
  87. margin-bottom: 16rpx;
  88. .user-name {
  89. font-size: 44rpx;
  90. font-weight: 700;
  91. color: #202020;
  92. line-height: 1.2;
  93. }
  94. .user-role {
  95. margin-left: 16rpx;
  96. padding: 6rpx 16rpx;
  97. background: rgba(68, 110, 255, 0.10);
  98. border-radius: 8rpx;
  99. font-size: 24rpx;
  100. font-weight: 500;
  101. color: #446eff;
  102. }
  103. }
  104. .company-name {
  105. font-size: 28rpx;
  106. font-weight: 500;
  107. color: #666666;
  108. line-height: 1.4;
  109. }
  110. }
  111. .avatar-wrapper {
  112. position: absolute;
  113. top: 74rpx;
  114. right: 36rpx;
  115. z-index: 2;
  116. }
  117. .user-contact {
  118. margin-top: 32rpx;
  119. .contact-row {
  120. display: flex;
  121. align-items: center;
  122. margin-bottom: 16rpx;
  123. position: relative;
  124. uni-icons {
  125. margin-right: 12rpx;
  126. flex-shrink: 0;
  127. }
  128. .contact-text {
  129. font-size: 26rpx;
  130. color: #666666;
  131. overflow: hidden;
  132. white-space: nowrap;
  133. text-overflow: ellipsis;
  134. flex: 1;
  135. }
  136. .call-btn {
  137. flex-shrink: 0;
  138. margin-left: 6rpx;
  139. font-size: 20rpx;
  140. color: #4080FF;
  141. border-radius: 20rpx;
  142. line-height: 1.6;
  143. }
  144. .call-highlight {
  145. color: #155DFC;
  146. }
  147. }
  148. }
  149. }
  150. </style>