IMessageItem.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view @click="clickItem" class="message_item">
  3. <my-avatar size="42" :src="opItem.faceURL" :desc="opItem.nickname" />
  4. <view class="message_item_details">
  5. <view class="content_wrap">
  6. <view class="main_content">
  7. <view class="i_name">
  8. {{ opItem.nickname }}
  9. </view>
  10. <view class="i_content">
  11. <image
  12. v-if="item.type === 1"
  13. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/moments_i_like.png"
  14. />
  15. <text v-if="item.type === 1">为你点了赞</text>
  16. <text class="comment_content" v-if="item.type === 3 && item.comments[0].replyUserID === ''">{{
  17. `评论了你:${opItem.content}`
  18. }}</text>
  19. <text class="comment_content" v-if="item.type === 3 && item.comments[0].replyUserID !== ''">{{
  20. `${item.comments[0].nickname}回复了${item.comments[0].replyNickname}:${opItem.content}`
  21. }}</text>
  22. <text v-if="item.type === 2">提到了你</text>
  23. </view>
  24. <view class="i_time">
  25. {{ opTimeStr }}
  26. </view>
  27. </view>
  28. <u--image
  29. v-if="mediaUrl"
  30. :showLoading="true"
  31. width="62"
  32. height="62"
  33. :src="mediaUrl"
  34. >
  35. <template v-slot:loading>
  36. <u-loading-icon color="red"></u-loading-icon>
  37. </template>
  38. </u--image>
  39. </view>
  40. <view class="bottom_line"></view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import MyAvatar from "../../../components/MyAvatar/index.vue";
  46. import { formatConversionTime } from "../../../util/imCommon";
  47. export default {
  48. name: "UserItem",
  49. components: {
  50. MyAvatar,
  51. },
  52. props: {
  53. item: Object,
  54. },
  55. data() {
  56. return {};
  57. },
  58. computed: {
  59. opItem() {
  60. if (this.item.type === 1) {
  61. return this.item.likeUsers[0];
  62. }
  63. if (this.item.type === 2) {
  64. return this.item;
  65. }
  66. return this.item.comments[0];
  67. },
  68. opTimeStr() {
  69. if (this.item.type === 3) {
  70. return formatConversionTime(this.item.comments[0].createTime)
  71. }
  72. return formatConversionTime(this.item.createTime)
  73. },
  74. mediaUrl() {
  75. let url;
  76. try {
  77. url = this.item.content.metas[0]?.thumb;
  78. } catch (e) {}
  79. return url;
  80. },
  81. },
  82. methods: {
  83. clickItem() {
  84. uni.$u.route("/pages_im/pages/moments/momentsDetails/index", {
  85. workMomentID: this.item.workMomentID,
  86. });
  87. },
  88. },
  89. };
  90. </script>
  91. <style lang="scss" scoped>
  92. .message_item {
  93. display: flex;
  94. padding: 24rpx 32rpx;
  95. color: $uni-text-color;
  96. position: relative;
  97. &_details {
  98. @include vCenterBox();
  99. margin-left: 24rpx;
  100. width: 100%;
  101. position: relative;
  102. .content_wrap {
  103. display: flex;
  104. justify-content: space-between;
  105. width: 100%;
  106. .main_content {
  107. margin-right: 36rpx;
  108. .i_name {
  109. @include nomalEllipsis;
  110. max-width: 360rpx;
  111. font-size: 32rpx;
  112. font-weight: 500;
  113. color: #333;
  114. }
  115. .i_content {
  116. @include ellipsisWithLine(5);
  117. margin-top: 12rpx;
  118. margin-bottom: 24rpx;
  119. image {
  120. width: 13px;
  121. height: 13px;
  122. margin-right: 12rpx;
  123. }
  124. }
  125. .i_time {
  126. font-size: 24rpx;
  127. color: #999;
  128. }
  129. }
  130. }
  131. .bottom_line {
  132. height: 1px;
  133. width: 100%;
  134. background-color: #f0f0f0;
  135. position: absolute;
  136. bottom: -20rpx;
  137. z-index: 9;
  138. }
  139. }
  140. }
  141. </style>