myfans.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="content">
  3. <view class="top-fan">
  4. <image src="../../static/img/top-bg.png" mode=""></image>
  5. </view>
  6. <view class="fans-base flex">
  7. <view class="base-item">
  8. <view class="base-item-val">
  9. {{fans.count || 0}}
  10. </view>
  11. <view class="base-item-name">
  12. 我的粉丝
  13. </view>
  14. </view>
  15. <view class="jg"></view>
  16. <view class="base-item">
  17. <view class="base-item-val">
  18. {{fans.active || 0}}
  19. </view>
  20. <view class="base-item-name">
  21. 活跃粉丝
  22. </view>
  23. </view>
  24. <view class="jg"></view>
  25. <view class="base-item">
  26. <view class="base-item-val">
  27. {{fans.money || 0}}
  28. </view>
  29. <view class="base-item-name">
  30. 总成交额
  31. </view>
  32. </view>
  33. </view>
  34. <view class="fans-tit">
  35. 我的粉丝列表
  36. </view>
  37. <view class="fans-list-tit flex">
  38. <view class="list-item">
  39. 姓名
  40. </view>
  41. <view class="list-item">
  42. ID
  43. </view>
  44. <view class="list-item">
  45. 当日业绩
  46. </view>
  47. <view class="list-item">
  48. 粉丝数
  49. </view>
  50. </view>
  51. <scroll-view scroll-y="true" class="swiper-box" :style="{'height':height}" @scrolltolower="getMyfans()">
  52. <view class="fans-list-val flex" v-for="(item,index) in list"
  53. :style="{'background':index%2 ==0 ? '#F9F9F9':'#fff'}">
  54. <view class="list-item clamp">
  55. {{item.real_name||item.nickname}}
  56. </view>
  57. <view class="list-item">
  58. {{item.uid}}
  59. </view>
  60. <view class="list-item">
  61. {{item.money}}
  62. </view>
  63. <view class="list-item">
  64. {{item.count}}
  65. </view>
  66. </view>
  67. <uni-load-more :status="loadingType"></uni-load-more>
  68. </scroll-view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. getMyfans
  74. } from '@/api/user.js'
  75. export default {
  76. data() {
  77. return {
  78. height: '',
  79. list: [],
  80. page: 1,
  81. limit: 10,
  82. fans: {},
  83. loadingType: 'more'
  84. }
  85. },
  86. onLoad() {
  87. this.getMyfans()
  88. },
  89. onReady(res) {
  90. var _this = this;
  91. uni.getSystemInfo({
  92. success: resu => {
  93. const query = uni.createSelectorQuery();
  94. query.select('.swiper-box').boundingClientRect();
  95. query.exec(function(res) {
  96. // console.log(res, 'ddddddddddddd');
  97. _this.height = resu.windowHeight - res[0].top + 'px';
  98. // console.log('打印页面的剩余高度', _this.height);
  99. });
  100. },
  101. fail: res => {}
  102. });
  103. },
  104. methods: {
  105. getMyfans() {
  106. let obj = this
  107. if (obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  108. return
  109. }
  110. obj.loadingType = 'loading'
  111. getMyfans({
  112. page: obj.page,
  113. limit: obj.limit
  114. }).then(res => {
  115. console.log(res)
  116. obj.fans = res.data;
  117. let ar = res.data.user.map((item)=>{
  118. if(item.real_name.length>2){
  119. let str =item.real_name.slice(1,item.real_name.length-1);
  120. let str2 = str.replace(/.*/g,'*');
  121. item.real_name =item.real_name.slice(0,1)+str2+item.real_name.slice(item.real_name.length-1);
  122. }else if(item.real_name.length==2){
  123. item.real_name =item.real_name.slice(0,1)+"*";
  124. }
  125. return item
  126. })
  127. obj.list = obj.list.concat(res.data.user)
  128. obj.page++
  129. if (res.data.user.length == obj.limit) {
  130. obj.loadingType = 'more'
  131. } else {
  132. obj.loadingType = 'noMore'
  133. }
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. page {
  141. background-color: #f3f5f4;
  142. height: 100%;
  143. }
  144. .content {
  145. background-color: #f3f5f4;
  146. }
  147. .top-fan {
  148. position: relative;
  149. width: 750rpx;
  150. height: 336rpx;
  151. image {
  152. position: absolute;
  153. top: 0;
  154. left: 0;
  155. right: 0;
  156. width: 100%;
  157. height: 100%;
  158. }
  159. }
  160. .fans-base {
  161. position: relative;
  162. z-index: 2;
  163. width: 702rpx;
  164. height: 210rpx;
  165. background: #FFFFFF;
  166. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  167. border-radius: 20rpx;
  168. margin: -147rpx auto 0;
  169. text-align: center;
  170. font-size: 30rpx;
  171. font-family: PingFang SC;
  172. font-weight: 500;
  173. color: #666666;
  174. .jg {
  175. width: 2rpx;
  176. height: 96rpx;
  177. background: #DCDCDC;
  178. }
  179. .base-item {
  180. flex-grow: 1;
  181. .base-item-val {
  182. font-size: 50rpx;
  183. font-family: PingFang SC;
  184. font-weight: bold;
  185. color: #0C1732;
  186. }
  187. }
  188. }
  189. .fans-tit {
  190. font-size: 32rpx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #0C1732;
  194. padding: 45rpx 0 29rpx 40rpx;
  195. }
  196. .fans-list-tit {
  197. width: 710rpx;
  198. height: 100rpx;
  199. background: #FFE1E2;
  200. border-radius: 20rpx 20rpx 0px 0px;
  201. margin: auto;
  202. text-align: center;
  203. ;
  204. font-size: 30rpx;
  205. font-family: PingFang SC;
  206. font-weight: bold;
  207. color: #DC262B;
  208. .list-item {
  209. width: 25%;
  210. flex-shrink: 0;
  211. }
  212. }
  213. .fans-list-val {
  214. width: 710rpx;
  215. height: 100rpx;
  216. margin: auto;
  217. text-align: center;
  218. ;
  219. font-size: 30rpx;
  220. font-family: PingFang SC;
  221. font-weight: bold;
  222. color: #0C1732;
  223. .list-item {
  224. // flex-grow: 1;
  225. width: 25%;
  226. flex-shrink: 0;
  227. }
  228. }
  229. </style>