fans.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-red" @click="toFlow(item.user_id)">关注</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. my_data: {}, //我
  22. page: 1,
  23. }
  24. },
  25. onShow() {
  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: "1", //粉丝
  45. },
  46. success: (data) => {
  47. console.log("data", data);
  48. if (data.data.length) {
  49. this.page++;
  50. this.list = [...this.list, ...data.data];
  51. }
  52. }
  53. })
  54. },
  55. toFlow(id) {
  56. this.$httpSend({
  57. path: "/im/video.Share/follow",
  58. data: {
  59. user_id: id,
  60. },
  61. success(data) {
  62. console.log("data", data);
  63. uni.showToast({
  64. icon: "none",
  65. title: data.msg,
  66. });
  67. },
  68. });
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped>
  74. @import '@/static/css/colorui/main.css';
  75. page {
  76. background: #fff;
  77. }
  78. .border-bottom {
  79. border-bottom: 1px solid #ddd;
  80. }
  81. </style>