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.

186 lines
4.2 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" v-if="showNumerBtn">
  45. <text class="personal-item-bottom-text">养宠{{ item.experience || 0 }} | 评价{{ item.commentNum || 0 }} | 服务小结{{ item.serviceSummaryNum || 0 }}</text>
  46. </view>
  47. <view class="personal-item-bottom" v-else-if="showDetailBtn">
  48. <text class="personal-item-bottom-text">点击查看详情</text>
  49. </view>
  50. </view>
  51. </uni-card>
  52. </uni-row>
  53. </template>
  54. <script>
  55. export default {
  56. name: 'CompanionItem',
  57. props: {
  58. item: {
  59. type: Object,
  60. required: true
  61. },
  62. showDetailBtn: {
  63. type: Boolean,
  64. default: false
  65. },
  66. showNumerBtn: {
  67. type: Boolean,
  68. default: true
  69. },
  70. },
  71. data() {
  72. return {
  73. isLike: false
  74. }
  75. },
  76. methods: {
  77. // 处理点击事件
  78. handleClick() {
  79. this.$emit('click', this.item)
  80. },
  81. // 处理点赞点击事件
  82. handleLikeClick() {
  83. this.isLike = !this.isLike
  84. this.$emit('like', this.item)
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .personal-list-item {
  91. padding: 10px 0px 0px 0;
  92. .personal-info {
  93. display: flex;
  94. align-items: center;
  95. justify-content: flex-start;
  96. .people-img {
  97. width: 168rpx;
  98. height: 168rpx;
  99. border: #FEA714 5rpx solid;
  100. border-radius: 20rpx;
  101. }
  102. .personal-info-1 {
  103. margin-left: 10px;
  104. width: 100%;
  105. .personal-info-2 {
  106. display: flex;
  107. .personal-info-title {
  108. display: flex;
  109. flex-wrap: wrap;
  110. width: 60%;
  111. }
  112. .personal-name {
  113. color: #333;
  114. font-size: 28rpx;
  115. margin-right: 10rpx;
  116. font-weight: 900;
  117. font-style: normal;
  118. overflow: hidden;
  119. text-overflow: ellipsis;
  120. white-space: nowrap;
  121. max-width: 200rpx;
  122. }
  123. .personal-star {
  124. color: #FFAA48;
  125. font-size: 24rpx;
  126. font-weight: 400;
  127. line-height: 32rpx;
  128. flex-shrink: 0;
  129. margin-left: auto;
  130. }
  131. }
  132. .personal-info-3 {
  133. display: flex;
  134. align-items: baseline;
  135. font-size: 28rpx;
  136. line-height: 32rpx;
  137. margin-top: 5px;
  138. color: #FFAA48;
  139. font-weight: 900;
  140. }
  141. .personal-info-4 {
  142. display: flex;
  143. align-items: baseline;
  144. font-size: 24rpx;
  145. margin-top: 10px;
  146. color: #7D8196;
  147. font-weight: 400;
  148. line-height: 32rpx;
  149. }
  150. }
  151. }
  152. }
  153. .personal-item-bottom {
  154. height: 60rpx;
  155. background-color: #FFF4E5;
  156. margin: 20rpx 0 20rpx 0;
  157. display: flex;
  158. align-items: center;
  159. justify-content: center;
  160. border-radius: 8rpx;
  161. .personal-item-bottom-text {
  162. color: #A94F20;
  163. margin: 14rpx;
  164. font-size: 24rpx;
  165. font-weight: 400;
  166. }
  167. }
  168. .ellipsis {
  169. overflow: hidden;
  170. text-overflow: ellipsis;
  171. white-space: nowrap;
  172. }
  173. </style>