person.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view>
  3. <template v-if="!isShowContactInfo">
  4. <view
  5. class="item"
  6. v-for="(item, index) in contactListMap.friendApplicationList.list"
  7. :key="index"
  8. >
  9. <view>
  10. <image :src="item.avatar" class="img" />
  11. </view>
  12. <view
  13. class="right"
  14. style="
  15. display: flex;
  16. flex-direction: row;
  17. justify-content: space-between;
  18. width: 100%;
  19. "
  20. >
  21. <text class="name">{{ item.nick }}</text>
  22. <view
  23. @click="ty(item)"
  24. style="
  25. width: 114rpx;
  26. height: 54rpx;
  27. background: linear-gradient(275deg, #01cf6c 0%, #07e278 100%);
  28. border-radius: 28rpx;
  29. display: flex;
  30. flex-direction: row;
  31. justify-content: center;
  32. align-items: center;
  33. color: white;
  34. "
  35. >同意</view
  36. >
  37. </view>
  38. </view>
  39. </template>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import TUIChatEngine, {
  44. TUITranslateService,
  45. TUIFriendService,
  46. } from "@tencentcloud/chat-uikit-engine";
  47. import { onLoad, onShow } from "@dcloudio/uni-app";
  48. import { Toast, TOAST_TYPE } from "../../TUIKit/components/common/Toast/index";
  49. import { ref, computed, onMounted, onUnmounted, provide } from "../../TUIKit/adapter-vue";
  50. const contactListMap = ref();
  51. const isShowContactInfo = ref(false);
  52. onLoad((options) => {
  53. contactListMap.value = JSON.parse(options.list);
  54. console.log(contactListMap.value);
  55. });
  56. const ty = (record) => {
  57. TUIFriendService.acceptFriendApplication({
  58. userID: record.To_Account,
  59. remark: record.Remark,
  60. type: TUIChatEngine.TYPES.SNS_APPLICATION_AGREE_AND_ADD,
  61. })
  62. .then(() => {
  63. Toast({
  64. message: TUITranslateService.t("已同意申请"),
  65. type: TOAST_TYPE.SUCCESS,
  66. });
  67. })
  68. .catch((error) => {
  69. Toast({
  70. message: TUITranslateService.t(error),
  71. type: TOAST_TYPE.ERROR,
  72. });
  73. });
  74. };
  75. </script>
  76. <style lang="scss" scope>
  77. .item {
  78. display: flex;
  79. flex-direction: row;
  80. align-items: center;
  81. padding: 20rpx;
  82. border-bottom: 1px solid #f1f1f1;
  83. .right {
  84. margin-left: 10px;
  85. .name {
  86. font-weight: 600;
  87. font-size: 32rpx;
  88. color: #333333;
  89. }
  90. }
  91. .img {
  92. width: 60px;
  93. height: 60px;
  94. border-radius: 50%;
  95. }
  96. }
  97. </style>