GroupChat.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <van-swipe-cell>
  3. <!-- {{ itemData?.unreadMessageCount }}
  4. {{ itemData?.dfGroupImage }} -->
  5. <div
  6. @click="$emit('onChatPage')"
  7. class="w-full relative h-82 flex justify-start items-center px-16"
  8. >
  9. <div class="w-48 h-48">
  10. <van-badge
  11. v-if="itemData?.unreadMessageCount > 0"
  12. v-bind="messageNumber(itemData?.unreadMessageCount)"
  13. max="99"
  14. >
  15. <MultiHeader :imgUrls="itemData?.dfGroupImage" />
  16. </van-badge>
  17. <MultiHeader v-else :imgUrls="itemData?.dfGroupImage" />
  18. </div>
  19. <div class="h-48 w-245 ml-12 flex flex-wrap">
  20. <h1 class="line-clamp-1 mb-8 w-full text-xl text-black-3 font-semibold">
  21. {{ itemData?.groupName }}
  22. </h1>
  23. <p class="line-clamp-1 w-full h-20 text-base text-black/[0.6] leading-3xl">
  24. {{ itemData?.lastMessage?.messageContent }}
  25. </p>
  26. </div>
  27. <div class="w-35 h-48 shrink-0">
  28. <p class="text-black/[0.6] mb-12 text-sm text-end">{{ itemData?.updateTime }}</p>
  29. <div v-if="itemData?.isNotDisturb == 1" class="w-full shrink-0 flex justify-end">
  30. <span class="iconfont icon-close-remind text-black-6" style="font-size: 16px"></span>
  31. </div>
  32. </div>
  33. <div class="absolute bottom-0 right-0 w-[96%] h-1 border-b-[1px]"></div>
  34. </div>
  35. <template #right>
  36. <div class="pl-2 h-full">
  37. <van-button
  38. style="height: 100%"
  39. square
  40. :text="itemData?.isNotDisturb == 1 ? '取消免打扰' : '设为免打扰'"
  41. @click="$emit('onNoBother')"
  42. type="danger"
  43. color="#FF9300"
  44. class="delete-button"
  45. />
  46. <van-button
  47. style="height: 100%"
  48. square
  49. :text="itemData?.isTop == 1 ? '取消置顶' : '置顶聊天'"
  50. @click="$emit('onIsTop')"
  51. type="danger"
  52. color="#E37318"
  53. class="delete-button"
  54. />
  55. <van-button
  56. style="height: 100%"
  57. square
  58. :text="itemData?.isShow == 1 ? '不显示聊天' : '显示聊天'"
  59. @click="$emit('onConvDelete')"
  60. type="danger"
  61. color="#D54941"
  62. class="delete-button"
  63. />
  64. </div>
  65. </template>
  66. </van-swipe-cell>
  67. </template>
  68. <script setup>
  69. import { messageContentParse } from '~/utils/detalTime.js'
  70. defineProps({
  71. itemData: {
  72. type: Object,
  73. default: () => ({})
  74. }
  75. })
  76. defineEmits(['onNoBother', 'onIsTop', 'onConvDelete', 'onChatPage'])
  77. // 消息数量通知的展示 需要动态的展示
  78. const messageNumber = (content) => {
  79. let messageNumberObj = {}
  80. if (content <= 1) {
  81. messageNumberObj = {
  82. offset: [-5, 4],
  83. dot: true,
  84. content
  85. }
  86. }
  87. if (content > 1) {
  88. messageNumberObj = {
  89. offset: [-10, 7],
  90. content
  91. }
  92. }
  93. return messageNumberObj
  94. }
  95. </script>
  96. <style lang="scss" scoped></style>