index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="user_store_attention" :style="viewColor">
  3. <block v-if="list.length >0">
  4. <view class="user_plant_item" v-for="(item,index) in list" :key="index" @click="goHomepage(item)">
  5. <image :src="(item.fans && item.fans.avatar) || '/static/images/f.png'" mode=""></image>
  6. <view class="info">
  7. <view class="line1">
  8. <text class="name line1">{{(item.fans && item.fans.nickname) || '用户已注销'}}</text>
  9. </view>
  10. <view v-if="item.fans" class="acea-row plant-des">
  11. <view class="des">
  12. 内容<text>{{(item.fans.count_content<10000&&item.fans.count_content>0) ? item.fans.count_content : item.fans.count_content>1000 ? (item.fans.count_content/10000).toFixed(2)+'万' : 0}}</text>
  13. </view>
  14. <view class="des">
  15. 粉丝<text>{{(item.fans.count_fans<10000&&item.fans.count_fans>0) ? item.fans.count_fans : item.fans.count_fans>1000 ? (item.fans.count_fans/10000).toFixed(2)+'万' : 0}}</text>
  16. </view>
  17. </view>
  18. <view @click.stop="focusToggle(item)" class="btn" :class="item.is_start ? '' : 'focusBtn'">
  19. <text v-if="!item.is_start" class="iconfont icon-jiahao2"></text>
  20. {{item.is_start ? '已关注' : '关注'}}
  21. </view>
  22. </view>
  23. </view>
  24. </block>
  25. <view :hidden="!loading" class="acea-row row-center-wrapper loadingicon">
  26. <text class="iconfont icon-jiazai loading"></text>
  27. </view>
  28. <view class="no_content" v-if="list.length == 0 && !loading">
  29. <view class="count">
  30. <image src="../static/images/no_fans.png"></image>
  31. <text>你还没有粉丝哦~</text>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. // +----------------------------------------------------------------------
  38. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  39. // +----------------------------------------------------------------------
  40. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  41. // +----------------------------------------------------------------------
  42. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  43. // +----------------------------------------------------------------------
  44. // | Author: CRMEB Team <admin@crmeb.com>
  45. // +----------------------------------------------------------------------
  46. let app = getApp();
  47. import { mapGetters } from "vuex";
  48. import { myFansLst, followAuthorApi } from '@/api/community.js'
  49. export default{
  50. data(){
  51. return {
  52. list:[],
  53. isScroll:true,
  54. page:1,
  55. limit:20,
  56. loading: false,
  57. }
  58. },
  59. computed: {
  60. ...mapGetters(['isLogin', 'uid', 'viewColor']),
  61. },
  62. onLoad() {
  63. this.getList()
  64. },
  65. onReady(){},
  66. mounted: function() {},
  67. methods:{
  68. getList(){
  69. if(!this.isScroll || this.loading) return
  70. this.loading = true;
  71. myFansLst({
  72. page:this.page,
  73. limit:this.limit
  74. }).then(res=>{
  75. this.loading = false
  76. this.isScroll = res.data.list.length>=this.limit
  77. this.list = this.list.concat(res.data.list)
  78. this.page+=1
  79. })
  80. },
  81. /*关注*/
  82. focusToggle(item){
  83. let status = item.is_start ? 0 : 1
  84. followAuthorApi(item.left_id,{status: status}).then(res => {
  85. if (res.status === 200) {
  86. item.is_start = item.is_start ? false : true
  87. }
  88. this.$util.Tips({
  89. title: res.message
  90. });
  91. }).catch((err)=>{
  92. this.$util.Tips({
  93. title: err
  94. });
  95. })
  96. }
  97. },
  98. onReachBottom() {
  99. this.getList()
  100. }
  101. }
  102. </script>
  103. <style lang="scss" acoped>
  104. @import '../style/main.scss';
  105. .focusBtn{
  106. color: var(--view-theme)!important;
  107. border-color: var(--view-theme)!important;
  108. }
  109. .no_content,.main{
  110. min-height: 100vh;
  111. background: #fff;
  112. position: relative;
  113. .count{
  114. position: absolute;
  115. text-align: center;
  116. width: 100%;
  117. top: 50%;
  118. margin-top: -300rpx;
  119. image,uni-image{
  120. width: 424rpx;
  121. height: 305rpx;
  122. }
  123. text{
  124. display: block;
  125. color: #999999;
  126. font-size: 26rpx;
  127. }
  128. }
  129. }
  130. </style>