NomalMessageItem.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view @click="click" class="merge_item">
  3. <my-avatar :src="source.faceURL" :desc="source.senderNickname" size="42" />
  4. <view class="merge_details">
  5. <view class="top_desc">
  6. <text class="send_name">{{ source.senderNickname }}</text>
  7. <text class="send_timer">{{ getSendTime }}</text>
  8. </view>
  9. <view class="message_row">
  10. <text class="message_content">{{ getContent }}</text>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import MyAvatar from "../../../../components/MyAvatar/index.vue";
  17. import {
  18. formatConversionTime,
  19. parseMessageByType,
  20. } from "../../../../util/imCommon";
  21. export default {
  22. name: "",
  23. components: {
  24. MyAvatar,
  25. },
  26. props: {
  27. source: Object,
  28. },
  29. data() {
  30. return {};
  31. },
  32. computed: {
  33. getSendTime() {
  34. return formatConversionTime(this.source.sendTime);
  35. },
  36. getContent() {
  37. return parseMessageByType(this.source);
  38. },
  39. },
  40. methods: {
  41. click() {
  42. this.$emit("click", this.source);
  43. },
  44. },
  45. };
  46. </script>
  47. <style lang="scss">
  48. .merge_item {
  49. display: flex;
  50. flex-direction: row;
  51. padding: 24rpx 44rpx;
  52. .merge_details {
  53. @include colBox(false);
  54. margin-left: 24rpx;
  55. border-bottom: 1px solid #dfdfdf;
  56. width: 100%;
  57. padding-bottom: 24rpx;
  58. .top_desc {
  59. display: flex;
  60. justify-content: space-between;
  61. font-size: 28rpx;
  62. .send_name {
  63. @include nomalEllipsis();
  64. max-width: 240rpx;
  65. margin-bottom: 6rpx;
  66. color: $uni-text-color;
  67. }
  68. .send_timer {
  69. color: #999;
  70. }
  71. }
  72. .message_row {
  73. @include colBox(false);
  74. .message_content {
  75. font-size: 28rpx;
  76. color: #666;
  77. }
  78. .quote_content {
  79. width: fit-content;
  80. padding: 6rpx 12rpx;
  81. border-radius: 4rpx;
  82. background-color: #f0f0f0;
  83. margin-top: 12rpx;
  84. }
  85. }
  86. }
  87. }
  88. </style>