index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="user_store_attention">
  3. <view v-if="list.length > 0">
  4. <view class="item" v-for="(item,index) in list" :key="index" @click="goHomepage(item)">
  5. <image v-if="item.userLevelIcon" class="level_icon" :src="item.userLevelIcon" alt="">
  6. <image :src="item.avatar?item.avatar:urlDomain+'crmebimage/presets/morenT.png'" mode=""></image>
  7. <view class="info">
  8. <view class="line1">
  9. <text class="name line1">{{item.isLogoff ? "用户已注销" :item.nickname}}</text>
  10. </view>
  11. <view v-if="item.fansNum" class="des">
  12. 粉丝{{item.fansNum<10000 ? item.fansNum : (item.fansNum/10000).toFixed(2)+'万'}}
  13. </view>
  14. <view v-else class="des">粉丝0</view>
  15. <view class="btn" :class="(!item.isConcerned && type === 'follow') || (!item.isFansConcerned &&type === 'fans') ? 'focusBtn' : ''" @click.stop="focusToggle(item)">
  16. <text v-if="type === 'follow'">{{!item.isConcerned ?'关注' : '已关注'}}</text>
  17. <text v-else>{{!item.isFansConcerned ?'回关' : '已关注'}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view :hidden="!loading" class="acea-row row-center-wrapper loadingicon">
  23. <text class="iconfont icon-jiazai loading"></text>
  24. </view>
  25. <view class='noCommodity' v-if="list.length == 0 && !loading">
  26. <view v-if="type === 'follow'" class='pictrue'>
  27. <image :src="urlDomain+'crmebimage/presets/noguanzhu.png'"></image>
  28. <view class="text-ccc">暂未关注任何人哦~</view>
  29. </view>
  30. <view v-else class='pictrue'>
  31. <image :src="urlDomain+'crmebimage/presets/noguanzhu.png'"></image>
  32. <view class="text-ccc">你还没有粉丝哦~</view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. // +----------------------------------------------------------------------
  39. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  40. // +----------------------------------------------------------------------
  41. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  42. // +----------------------------------------------------------------------
  43. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  44. // +----------------------------------------------------------------------
  45. // | Author: CRMEB Team <admin@crmeb.com>
  46. // +----------------------------------------------------------------------
  47. let app = getApp();
  48. import {
  49. discoverFollowAuthor
  50. } from '@/libs/follow.js';
  51. import {
  52. Debounce
  53. } from '@/utils/validate.js'
  54. import { myConcernedListApi, followAuthorApi, myFansListApi } from '@/api/discover.js'
  55. export default{
  56. data(){
  57. return {
  58. urlDomain: this.$Cache.get("imgHost"),
  59. list:[],
  60. isScroll:true,
  61. loading: false,
  62. page:1,
  63. limit:20,
  64. type: ''//follow关注,fans粉丝
  65. }
  66. },
  67. onLoad(options) {
  68. this.type = options.type;
  69. uni.setNavigationBarTitle({
  70. title: options.type === 'follow' ? '我的关注' : '我的粉丝'
  71. })
  72. if(options.type === 'follow'){
  73. this.getList()
  74. }else{
  75. this.getFansList()
  76. }
  77. },
  78. mounted: function() {},
  79. methods:{
  80. //粉丝列表
  81. getFansList(){
  82. if(!this.isScroll || this.loading) return
  83. this.loading = true;
  84. myFansListApi({
  85. page:this.page,
  86. limit:this.limit
  87. }).then(res=>{
  88. this.loading = false
  89. this.isScroll = res.data.list.length>=this.limit
  90. this.list = this.list.concat(res.data.list)
  91. this.page+=1
  92. })
  93. },
  94. //关注列表
  95. getList(){
  96. if(!this.isScroll || this.loading) return
  97. this.loading = true;
  98. myConcernedListApi({
  99. page:this.page,
  100. limit:this.limit
  101. }).then(res=>{
  102. this.loading = false
  103. this.isScroll = res.data.list.length>=this.limit
  104. this.list = this.list.concat(res.data.list)
  105. this.page+=1
  106. })
  107. },
  108. /*关注*/
  109. focusToggle: Debounce(function(item){
  110. discoverFollowAuthor(item.id).then(() => {
  111. this.$set(item, 'isConcerned', !item.isConcerned);
  112. this.$set(item, 'isFansConcerned', !item.isFansConcerned);
  113. });
  114. }),
  115. goHomepage(item){
  116. if(item.isLogoff) return;
  117. uni.navigateTo({
  118. url: `/pages/discover/discover_user/index?id=${item.id}`
  119. })
  120. }
  121. },
  122. onReachBottom() {
  123. this.getList()
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .level_icon {
  129. position: absolute;
  130. width: 38rpx !important;
  131. height: 38rpx !important;
  132. border: none;
  133. z-index: 11;
  134. bottom: 30rpx;
  135. left: 106rpx;
  136. }
  137. .noCommodity{
  138. margin-top: 50%;
  139. }
  140. .user_store_attention{
  141. .item{
  142. position: relative;
  143. display: flex;
  144. padding: 30rpx 20rpx;
  145. background-color: #fff;
  146. align-items: center;
  147. &::after{
  148. content: ' ';
  149. position: absolute;
  150. bottom: 0;
  151. left: 30rpx;
  152. right: 0;
  153. height: 1px;
  154. background: #f0f0f0;
  155. }
  156. image{
  157. width: 120rpx;
  158. height: 120rpx;
  159. border-radius: 50%;
  160. }
  161. .info{
  162. flex: 1;
  163. display: flex;
  164. flex-direction: column;
  165. justify-content: space-between;
  166. margin-left: 20rpx;
  167. position: relative;
  168. .name{
  169. width: 410rpx;
  170. font-size: 30rpx;
  171. color: #282828;
  172. }
  173. .des{
  174. color: #999999;
  175. font-size: 24rpx;
  176. margin-top: 10rpx;
  177. }
  178. .btn{
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. position: absolute;
  183. right: 0;
  184. top: 50%;
  185. width: 124rpx;
  186. height: 50rpx;
  187. font-weight: 500;
  188. line-height: 50rpx;
  189. transform: translateY(-50%);
  190. border:1px solid #F5F5F5;
  191. color: #999999;
  192. border-radius: 33rpx;
  193. font-size: 22rpx;
  194. &.focusBtn{
  195. color: #fff;
  196. background: #E93323;
  197. border: none;
  198. .iconfont{
  199. font-size: 20rpx;
  200. margin-right: 10rpx;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. .no_content,.main{
  208. min-height: 100vh;
  209. background: #fff;
  210. position: relative;
  211. .count{
  212. position: absolute;
  213. text-align: center;
  214. width: 100%;
  215. top: 50%;
  216. margin-top: -300rpx;
  217. image,uni-image{
  218. width: 424rpx;
  219. height: 305rpx;
  220. }
  221. text{
  222. display: block;
  223. color: #999999;
  224. font-size: 26rpx;
  225. }
  226. }
  227. }
  228. </style>