index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.focus&&item.focus.avatar) || '/static/images/f.png'" mode=""></image>
  6. <view v-if="item.focus" class="info">
  7. <view class="line1">
  8. <text class="name line1">{{(item.focus && item.focus.nickname) || '用户已注销'}}</text>
  9. </view>
  10. <view v-if="item.focus" class="acea-row plant-des">
  11. <view class="des">
  12. 内容<text>{{(item.focus.count_content<10000&&item.focus.count_content>0) ? item.focus.count_content : item.focus.count_content>1000 ? (item.focus.count_content/10000).toFixed(2)+'万' : 0}}</text>
  13. </view>
  14. <view class="des">
  15. 粉丝<text>{{(item.focus.count_fans<10000&&item.focus.count_fans>0) ? item.focus.count_fans : item.focus.count_fans>1000 ? (item.focus.count_fans/10000).toFixed(2)+'万' : 0}}</text>
  16. </view>
  17. </view>
  18. <view class="btn" :class="item.is_fans ? 'focusBtn' : ''" @click.stop="focusToggle(item)">
  19. <text v-if="item.is_fans" class="iconfont icon-jiahao2"></text>
  20. {{item.is_fans ? '关注' : '已关注'}}
  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_attention.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 { myFocusLst, followAuthorApi } from '@/api/community.js'
  49. export default{
  50. data(){
  51. return {
  52. list:[],
  53. isScroll:true,
  54. loading: false,
  55. page:1,
  56. limit:20,
  57. }
  58. },
  59. computed: {
  60. ...mapGetters(['isLogin', 'uid', 'viewColor']),
  61. },
  62. onLoad() {
  63. this.getList()
  64. },
  65. mounted: function() {},
  66. methods:{
  67. getList(){
  68. if(!this.isScroll || this.loading) return
  69. this.loading = true;
  70. myFocusLst({
  71. page:this.page,
  72. limit:this.limit
  73. }).then(res=>{
  74. this.loading = false
  75. this.isScroll = res.data.list.length>=this.limit
  76. this.list = this.list.concat(res.data.list)
  77. this.page+=1
  78. })
  79. },
  80. /*关注*/
  81. focusToggle(item){
  82. let status = item.is_fans ? 1 : 0
  83. followAuthorApi(item.right_id,{status: status}).then(res => {
  84. if (res.status === 200) {
  85. item.is_fans = item.is_fans ? false : true
  86. }
  87. this.$util.Tips({
  88. title: res.message
  89. });
  90. }).catch(err => {
  91. this.$util.Tips({
  92. title: err
  93. });
  94. })
  95. },
  96. goHomepage(item){
  97. uni.navigateTo({
  98. url: '/pages/plantGrass/plant_user/index?id='+item.focus.uid
  99. })
  100. }
  101. },
  102. onReachBottom() {
  103. this.getList()
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. @import '../style/main.scss';
  109. .focusBtn{
  110. color: var(--view-theme)!important;
  111. border-color: var(--view-theme)!important;
  112. }
  113. .no_content,.main{
  114. min-height: 100vh;
  115. background: #fff;
  116. position: relative;
  117. .count{
  118. position: absolute;
  119. text-align: center;
  120. width: 100%;
  121. top: 50%;
  122. margin-top: -300rpx;
  123. image,uni-image{
  124. width: 424rpx;
  125. height: 305rpx;
  126. }
  127. text{
  128. display: block;
  129. color: #999999;
  130. font-size: 26rpx;
  131. }
  132. }
  133. }
  134. </style>