flow.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="">
  3. <view class="flex justify-between padding align-center border-bottom" v-for="(item,index) in list" :key="index">
  4. <view class="">
  5. <image class="cu-avatar round lg margin-right" :src="static_photo + item.user_info.face" mode="">
  6. </image>
  7. <text>{{item.user_info.nickname}}</text>
  8. </view>
  9. <button class="cu-btn bg-gray" @click="toFlow(item,index)">取消关注</button>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import _data from "@/common/_data";
  15. import _get from "@/common/_get";
  16. export default {
  17. data() {
  18. return {
  19. list: [],
  20. static_photo: _data.staticPhoto(),
  21. page: 1,
  22. my_data: {}, //我
  23. }
  24. },
  25. onLoad() {
  26. let _this = this;
  27. _get.getUserInfo({});
  28. uni.$on('data_user_info', function(data) {
  29. data.photo = data.photo + '?_=' + +Math.random()
  30. data.photo = data.photo.replace(/(\?_=)[\d\.]+$/, '$1' + Math.random());
  31. _this.my_data = data;
  32. _data.data('user_info', data)
  33. });
  34. this.getList();
  35. },
  36. onReachBottom() {
  37. this.getList();
  38. },
  39. methods: {
  40. getList() {
  41. this.$httpSend({
  42. path: "/im/video.Share/me_follow",
  43. data: {
  44. type: "2", //关注
  45. page: this.page,
  46. },
  47. success: (data) => {
  48. console.log("data", data);
  49. if (data.data.length) {
  50. this.page++;
  51. this.list = [...this.list, ...data.data];
  52. }
  53. }
  54. })
  55. },
  56. toFlow(item, index) {
  57. this.$httpSend({
  58. path: "/im/video.Share/follow",
  59. data: {
  60. user_id: item.to_id,
  61. },
  62. success: (data) => {
  63. uni.showToast({
  64. icon: "none",
  65. title: data.msg,
  66. });
  67. this.list.splice(index, 1);
  68. },
  69. });
  70. }
  71. }
  72. }
  73. </script>
  74. <style scoped>
  75. @import '@/static/css/colorui/main.css';
  76. page {
  77. background: #fff;
  78. }
  79. .border-bottom {
  80. border-bottom: 1px solid #ddd;
  81. }
  82. </style>