validate.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
  3. <cu-custom bgImage="/static/bg.png" :isBack="true">
  4. <template v-slot:content>
  5. <text class="text-black">好友验证</text>
  6. </template>
  7. </cu-custom>
  8. <view class="cu-list menu-avatar tab-bar-mar">
  9. <view class="cu-item bg-white" v-for="(friend) in friendStore.waitValidateList" :key="friend.id" >
  10. <user-avatar-tag :id="friend.userId"/>
  11. <view class="content">
  12. <view class="text-black text-bold">
  13. <user-name-tag :id="friend.userId"/>
  14. </view>
  15. <view class="text-black text-sm text-cut" style="max-width: 360rpx;">
  16. <text>{{ friend.message }}</text>
  17. </view>
  18. </view>
  19. <view class="action padding-right" style="width:260rpx;">
  20. <button class="cu-btn bg-cyan margin-right text-bold" style="padding: 16rpx;" @tap="agree(friend.userId)">同意</button>
  21. <button class="cu-btn bg-red text-bold" style="padding: 16rpx;" @tap="refuse(friend.userId)">拒绝</button>
  22. </view>
  23. </view>
  24. </view>
  25. <no-data v-if="friendStore.waitValidateList.length === 0"/>
  26. </template>
  27. <script lang="ts" setup>
  28. import CuCustom from '@/colorui/components/cu-custom.vue'
  29. import FriendApi from "@/api/FriendApi";
  30. import {useFriendStore} from "@/store/friendStore";
  31. import {ref} from "vue";
  32. import UserNameTag from "@/components/UserNameTag.vue";
  33. import UserAvatarTag from "@/components/UserAvatarTag.vue";
  34. import NoData from "@/components/NoData.vue";
  35. import Auth from "@/api/Auth";
  36. const fontValue=ref(Auth.getfontSize());
  37. const list = ref();
  38. const friendStore = useFriendStore();
  39. friendStore.loadValidateList()
  40. /**
  41. * 同意邀请
  42. * @param userId userId
  43. */
  44. const agree = (userId: string|undefined) => {
  45. if(userId){
  46. console.log(userId);
  47. FriendApi.agree(userId).then(() => {
  48. friendStore.loadValidateList();
  49. });
  50. }
  51. };
  52. /**
  53. * 拒绝邀请
  54. * @param userId userId
  55. */
  56. const refuse = (userId: string|undefined) => {
  57. if(userId) {
  58. FriendApi.delete(userId).then(() => {
  59. friendStore.loadValidateList();
  60. });
  61. }
  62. };
  63. </script>
  64. <style scoped>
  65. </style>