chat.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view>
  3. <template v-if="contactListMap.groupList.list.length > 0">
  4. <view
  5. class="item"
  6. v-for="(item, index) in contactListMap.groupList.list"
  7. :key="index"
  8. @click="selectItem(item)"
  9. >
  10. <view>
  11. <image :src="item.avatar" class="img" />
  12. </view>
  13. <view class="right">
  14. <text class="name">{{ item.name }}</text>
  15. </view>
  16. </view>
  17. </template>
  18. <div
  19. v-else
  20. style="
  21. display: flex;
  22. flex-direction: column;
  23. align-items: center;
  24. height: 90vh;
  25. justify-content: center;
  26. "
  27. >
  28. <img src="@/static/empaty.jpg" style="width: 200px; height: 150px" />
  29. <span style="margin-top: 20px"> 暂无群聊~</span>
  30. </div>
  31. </view>
  32. </template>
  33. <script setup lang="ts">
  34. import {
  35. TUITranslateService,
  36. TUIStore,
  37. StoreName,
  38. IGroupModel,
  39. TUIFriendService,
  40. Friend,
  41. FriendApplication,
  42. TUIUserService,
  43. TUIConversationService,
  44. } from "@tencentcloud/chat-uikit-engine";
  45. import ContactInfo from "../../TUIKit/components/TUIContact/contact-info/index.vue";
  46. import { isPC, isUniFrameWork } from "../../TUIKit/utils/env";
  47. import { onLoad, onShow } from "@dcloudio/uni-app";
  48. import {
  49. IContactList,
  50. IContactSearchResult,
  51. IBlackListUserItem,
  52. IUserStatus,
  53. IUserStatusMap,
  54. IContactInfoType,
  55. } from "../../TUIKit/interface";
  56. import { TUIGlobal } from "@tencentcloud/universal-api";
  57. import { ref, computed, onMounted, onUnmounted, provide } from "../../TUIKit/adapter-vue";
  58. const currentContactInfo = ref();
  59. const contactListMap = ref();
  60. const isShowContactInfo = ref(false);
  61. onLoad((options) => {
  62. contactListMap.value = JSON.parse(options.list);
  63. console.log("contactListMap.value", contactListMap.value);
  64. });
  65. const emits = defineEmits(["switchConversation"]);
  66. function selectItem(item: any) {
  67. isUniFrameWork &&
  68. TUIGlobal?.navigateTo({
  69. url: "/TUIKit/components/TUIChat/index",
  70. });
  71. TUIConversationService.switchConversation(`GROUP${item.groupID}`);
  72. }
  73. </script>
  74. <style lang="scss" scope>
  75. .item {
  76. display: flex;
  77. flex-direction: row;
  78. align-items: center;
  79. padding: 20rpx;
  80. border-bottom: 1px solid #f1f1f1;
  81. .right {
  82. margin-left: 10px;
  83. .name {
  84. font-weight: 600;
  85. font-size: 32rpx;
  86. color: #333333;
  87. }
  88. }
  89. .img {
  90. width: 60px;
  91. height: 60px;
  92. border-radius: 50%;
  93. }
  94. }
  95. </style>