You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
4.0 KiB

  1. <template>
  2. <uni-row :span="12">
  3. <uni-card :is-shadow="false" padding=0 margin="6rpx 20rpx" @click="handleClick">
  4. <view class="personal-list-item">
  5. <view class="personal-info">
  6. <view>
  7. <image class="people-img" slot='cover' :src="item.userImage"></image>
  8. </view>
  9. <view class="personal-info-1">
  10. <view class="personal-info-2">
  11. <view class="personal-info-title">
  12. <view class="personal-name">
  13. {{ item.userName || '匿名' }}
  14. </view>
  15. <view class="personal-sex">
  16. <img :src="item.appletUsersTeacher.sex == 0?'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_m.png':
  17. 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_f.png'" alt="sex"
  18. style="width: 20px;height: 20px;" />
  19. </view>
  20. </view>
  21. <view class="personal-star" @click.stop="handleLikeClick">
  22. <text style="color: #FFB13F;">点赞数{{ item.appletUsersTeacher.thumbsUp || 0 }}</text>
  23. <uni-icons v-if="isLike" type="hand-up-filled" size="20" color="#FFB13F"></uni-icons>
  24. <uni-icons v-else type="hand-up" size="20" color="#FFB13F"></uni-icons>
  25. </view>
  26. </view>
  27. <view class="personal-info-3" style="width: 100%;">
  28. <view class="ellipsis" v-if="item.distanceText">
  29. 距离{{ item.distanceText }}km
  30. </view>
  31. <view class="ellipsis" v-else>
  32. {{ '<' }}1km
  33. </view>
  34. </view>
  35. <view class="personal-info-4" style="width: 100%;">
  36. <view class="ellipsis" style="max-width: 225px;">
  37. 简介{{ item.appletUsersTeacher.userBrief || '暂无' }}
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view>
  44. <view class="personal-item-bottom">
  45. <text class="personal-item-bottom-text">养宠{{ item.experience || 0 }} | 评价{{ item.commentNum || 0 }} | 服务小结{{ item.serviceSummaryNum || 0 }}</text>
  46. </view>
  47. </view>
  48. </uni-card>
  49. </uni-row>
  50. </template>
  51. <script>
  52. export default {
  53. name: 'CompanionItem',
  54. props: {
  55. item: {
  56. type: Object,
  57. required: true
  58. }
  59. },
  60. data() {
  61. return {
  62. isLike: false
  63. }
  64. },
  65. methods: {
  66. // 处理点击事件
  67. handleClick() {
  68. this.$emit('click', this.item)
  69. },
  70. // 处理点赞点击事件
  71. handleLikeClick() {
  72. this.isLike = !this.isLike
  73. this.$emit('like', this.item)
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .personal-list-item {
  80. padding: 10px 0px 0px 0;
  81. .personal-info {
  82. display: flex;
  83. align-items: center;
  84. justify-content: flex-start;
  85. .people-img {
  86. width: 168rpx;
  87. height: 168rpx;
  88. border: #FEA714 5rpx solid;
  89. border-radius: 20rpx;
  90. }
  91. .personal-info-1 {
  92. margin-left: 10px;
  93. width: 100%;
  94. .personal-info-2 {
  95. display: flex;
  96. .personal-info-title {
  97. display: flex;
  98. flex-wrap: wrap;
  99. width: 60%;
  100. }
  101. .personal-name {
  102. color: #333;
  103. font-size: 28rpx;
  104. margin-right: 10rpx;
  105. font-weight: 900;
  106. font-style: normal;
  107. overflow: hidden;
  108. text-overflow: ellipsis;
  109. white-space: nowrap;
  110. max-width: 200rpx;
  111. }
  112. .personal-star {
  113. color: #FFAA48;
  114. font-size: 24rpx;
  115. font-weight: 400;
  116. line-height: 32rpx;
  117. flex-shrink: 0;
  118. margin-left: auto;
  119. }
  120. }
  121. .personal-info-3 {
  122. display: flex;
  123. align-items: baseline;
  124. font-size: 28rpx;
  125. line-height: 32rpx;
  126. margin-top: 5px;
  127. color: #FFAA48;
  128. font-weight: 900;
  129. }
  130. .personal-info-4 {
  131. display: flex;
  132. align-items: baseline;
  133. font-size: 24rpx;
  134. margin-top: 10px;
  135. color: #7D8196;
  136. font-weight: 400;
  137. line-height: 32rpx;
  138. }
  139. }
  140. }
  141. }
  142. .personal-item-bottom {
  143. height: 60rpx;
  144. background-color: #FFF4E5;
  145. margin: 20rpx 0 20rpx 0;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. border-radius: 8rpx;
  150. .personal-item-bottom-text {
  151. color: #A94F20;
  152. margin: 14rpx;
  153. font-size: 24rpx;
  154. font-weight: 400;
  155. }
  156. }
  157. .ellipsis {
  158. overflow: hidden;
  159. text-overflow: ellipsis;
  160. white-space: nowrap;
  161. }
  162. </style>