main.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  3. <uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" @clickRight="onNavSearchFriend()" title="我的好友"
  4. color="#000000" fixed="true" :border="false">
  5. <view slot="left">
  6. <view class=" flex align-center margin-left">
  7. <image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
  8. </view>
  9. </view>
  10. <view slot="right">
  11. <view class=" flex align-center margin-left">
  12. <image class="p-left-arrow" src="../../../static/friend/add.png"></image>
  13. </view>
  14. </view>
  15. </uni-nav-bar>
  16. <view class="cu-list menu-avatar ">
  17. <view class="cu-item card-view" style="height: 180rpx;" v-for="(item, index) in friends" :key="index">
  18. <view class="cu-avatar round lg"
  19. :style="[{ backgroundImage:'url('+item.avatarUrl+')' }]">
  20. <view class="cu-tag badge-bottom" >
  21. <image v-if="item.gender == 0" style="height: 32rpx;width: 32rpx;" src="../../../static/friend/boy.png"></image>
  22. <image v-if="item.gender == 1" style="height: 32rpx;width: 32rpx;" src="../../../static/friend/girl.png"></image>
  23. </view>
  24. </view>
  25. <view class="content" style="width: 360rpx;">
  26. <view class="text-grey">{{item.username}}</view>
  27. <view class="text-gray text-sm flex">
  28. <view class="text-cut">
  29. <text class="cuIcon-infofill text-red margin-right-xs"></text>
  30. {{item.signature}}
  31. </view>
  32. </view>
  33. <!-- <view class="text-gray text-sm flex">
  34. <view class="text-cut">
  35. <text class="cuIcon-infofill text-red margin-right-xs"></text>
  36. 我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。
  37. </view>
  38. </view> -->
  39. </view>
  40. <view class="action" style="width: 160rpx; ">
  41. <button class="cu-btn round lines-gray text-13px"
  42. style=" line-height: 26rpx; white-space: nowrap; width: 146rpx; right: 30rpx;"
  43. @click="onDeleteInfo(item)">
  44. 取消关注</button>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import config from '../../../common/config.js';
  52. import reqUtil from '../../../util/util-js/requstUtil.js';
  53. export default {
  54. data() {
  55. return {
  56. friends: null
  57. }
  58. },
  59. onShow() {
  60. reqUtil.requestData(config.URL.GETFRIENDLIST, {}).then(
  61. res => {
  62. // console.log(JSON.stringify(res));
  63. this.friends = res.data.friends;
  64. },
  65. e => {
  66. console.log(e);
  67. }
  68. );
  69. },
  70. methods: {
  71. onBack() {
  72. uni.navigateBack({
  73. delta: 1
  74. })
  75. },
  76. onNavSearchFriend() {
  77. uni.navigateTo({
  78. url: "../search/search"
  79. })
  80. },
  81. onDeleteInfo(item) {
  82. uni.showToast({
  83. title: '删除中..',
  84. duration: 1000,
  85. icon: 'loading',
  86. mask: true
  87. })
  88. reqUtil.requestData(config.URL.DELETEFIRENDINFO, {
  89. id: item.friendId
  90. }).then(
  91. res => {
  92. console.log(JSON.stringify(res));
  93. var index0 = this.friends.findIndex(e => {
  94. if (item.friendId == e.friendId) {
  95. return true
  96. }
  97. })
  98. this.friends.splice(index0, 1);
  99. uni.showToast({
  100. title: '删除成功',
  101. duration: 1000,
  102. mask: true
  103. })
  104. },
  105. e => {
  106. console.log(e);
  107. }
  108. );
  109. }
  110. }
  111. }
  112. </script>
  113. <style>
  114. </style>