userShareList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view class="content">
  3. <view class="fixed-top-box">
  4. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  5. <view class="back-box" @click="back">
  6. <image src="../../static/images/back_white.png" mode=""></image>
  7. <text class="title">排行榜</text>
  8. <text></text>
  9. </view>
  10. </view>
  11. <view class="promoter-list" >
  12. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  13. <view class="tab-box">
  14. <view @click="changeType(1)" :class="type==1?'tab-item active':'tab-item'">
  15. 周榜
  16. </view>
  17. <view @click="changeType(2)" :class="type==2?'tab-item active':'tab-item'">
  18. 月榜
  19. </view>
  20. <view @click="changeType(0)" :class="type==0?'tab-item active':'tab-item'">
  21. 总榜
  22. </view>
  23. </view>
  24. <view class="top-box" >
  25. <view class="bg">
  26. <image src="../../static/images/top-bg.png"></image>
  27. </view>
  28. <view class="top-item top2" >
  29. <view class="name" v-if="list.length>=2">{{list[1].nickname}}</view>
  30. <view class="money" v-if="list.length>=2">{{list[1].tuiMoney.toFixed(2)}}</view>
  31. <view class="head" v-if="list.length>=2">
  32. <image class="head-bg" src="../../static/images/top1.png"></image>
  33. <image class="bg" :src="list[1].avatar==null?'/static/images/detault_head.jpg':list[1].avatar"></image>
  34. </view>
  35. </view>
  36. <view class="top-item top1" >
  37. <view class="name" v-if="list.length>=1">{{list[0].nickname}}</view>
  38. <view class="money" v-if="list.length>=1">{{list[0].tuiMoney.toFixed(2)}}</view>
  39. <view class="head" v-if="list.length>=1">
  40. <image class="head-bg" src="../../static/images/top1.png"></image>
  41. <image class="bg" :src="list[0].avatar==null?'/static/images/detault_head.jpg':list[0].avatar"></image>
  42. </view>
  43. </view>
  44. <view class="top-item top2" >
  45. <view class="name" v-if="list.length>=3">{{list[2].nickname}}</view>
  46. <view class="money" v-if="list.length>=3">{{list[2].tuiMoney.toFixed(2)}}</view>
  47. <view class="head" v-if="list.length>=3">
  48. <image class="head-bg" src="../../static/images/top1.png"></image>
  49. <image class="bg" :src="list[2].avatar==null?'/static/images/detault_head.jpg':list[2].avatar"></image>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="list">
  54. <view class="item" v-if="index>2" v-for="(item, index) in list">
  55. <view class="left">
  56. <view class="num">{{index+1}}</view>
  57. <view class="head">
  58. <image :src="item.avatar==null?'/static/images/detault_head.jpg':item.avatar"></image>
  59. </view>
  60. <view class="name">{{item.nickname}}</view>
  61. </view>
  62. <view class="right">
  63. <view class="money">¥{{item.tuiMoney.toFixed(2)}}</view>
  64. </view>
  65. </view>
  66. </view>
  67. <Loading :loaded="loaded" :loading="loading"></Loading>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {getUserShareList} from "@/api/user.js";
  73. import Loading from "@/components/Loading";
  74. export default {
  75. name: "tuiList",
  76. components: {
  77. Loading
  78. },
  79. props: {},
  80. data: function () {
  81. return {
  82. total:0,
  83. type:0,
  84. page: {
  85. page: 1,
  86. pageSize: 10
  87. },
  88. list: [],
  89. loaded: false,
  90. loading: false,
  91. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  92. };
  93. },
  94. mounted: function () {
  95. this.getUserShareList();
  96. },
  97. onReachBottom() {
  98. !this.loading && this.getUserShareList();
  99. },
  100. methods: {
  101. changeType(type){
  102. console.log(type)
  103. this.type=type;
  104. this.list=[];
  105. this.page.page=1
  106. this.loaded=false;
  107. this.loading=false;
  108. this.getUserShareList();
  109. },
  110. getUserShareList: function () {
  111. let that = this;
  112. if (that.loaded || that.loading) return;
  113. that.loading = true;
  114. this.page.type=this.type;
  115. getUserShareList(this.page).then(
  116. res => {
  117. that.total=res.data.total;
  118. that.list.push.apply(that.list, res.data.list);
  119. that.loading = false;
  120. that.loaded = !res.data.hasNextPage;
  121. that.page.page = that.page.page + 1;
  122. uni.hideLoading()
  123. },
  124. err => {
  125. uni.showToast({
  126. title: err.msg || err.response.data.msg || err.response.data.message,
  127. icon: "none",
  128. duration: 2000
  129. });
  130. },
  131. 300
  132. );
  133. },
  134. }
  135. };
  136. </script>
  137. <style lang="less">
  138. .page{
  139. height: 100%;
  140. }
  141. .content{
  142. height: 100%;
  143. background-image: linear-gradient(#35E1B1,#C7FFF2);
  144. }
  145. .fixed-top-box{
  146. width: 100%;
  147. position: fixed;
  148. top: 0;
  149. left: 0;
  150. z-index: 1000;
  151. .back-box{
  152. height: 88upx;
  153. padding-left: 22upx;
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-between;
  157. padding: 0 20upx;
  158. image{
  159. width: 40upx;
  160. height: 40upx;
  161. }
  162. .title{
  163. font-size: 32upx;
  164. font-family: PingFang SC;
  165. font-weight: 500;
  166. color: #FFFFFF;
  167. }
  168. }
  169. }
  170. .promoter-list{
  171. width: 100%;
  172. padding-top: 88rpx;
  173. .tab-box{
  174. margin: 30rpx 60rpx;
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. background-color:#FFFFFF ;
  179. border-radius: 36rpx;
  180. height: 60rpx;
  181. padding: 5rpx;
  182. .tab-item{
  183. height: 100%;
  184. border-radius: 30rpx;
  185. flex: 1;
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. color: #16967F;
  190. background-color:none ;
  191. font-size: 28rpx;
  192. }
  193. .active{
  194. color: #FFFFFF;
  195. background-color:#43CABC ;
  196. }
  197. }
  198. .top-box{
  199. z-index: 0;
  200. height: 450rpx;
  201. margin: 0rpx 60rpx;
  202. display: flex;
  203. align-items: flex-start;
  204. justify-content: center;
  205. position: relative;
  206. .bg{
  207. z-index: 0;
  208. bottom: -150rpx;
  209. position: absolute;
  210. height: 400rpx;
  211. width: 100%;
  212. image{
  213. height: 400rpx;
  214. width: 100%;
  215. }
  216. }
  217. .top-item{
  218. width: 33.33%;
  219. z-index: 10;
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. flex-direction: column;
  224. .head{
  225. position: relative;
  226. .head-bg{
  227. width: 120rpx;
  228. height:140rpx;
  229. }
  230. .bg{
  231. top:35rpx;
  232. left:10rpx;
  233. position: absolute;
  234. width: 100rpx;
  235. height:100rpx;
  236. border-radius: 50%;
  237. }
  238. }
  239. .name{
  240. font-size: 28rpx;
  241. font-weight: bold;
  242. color:#fff;
  243. }
  244. .money{
  245. margin-top: 10rpx;
  246. background-color: #B4FFF1;
  247. border-radius: 30rpx;
  248. padding:10rpx 15rpx;
  249. font-size: 24rpx;
  250. color:#16967F;
  251. }
  252. }
  253. .top1{
  254. margin-top: 40rpx;
  255. }
  256. .top2{
  257. margin-top: 120rpx;
  258. }
  259. }
  260. .list{
  261. position: relative;
  262. min-height: 800rpx;
  263. z-index: 101;
  264. background-color: #FFFFFF;
  265. margin: 0rpx 30rpx 30rpx;
  266. border-radius: 30rpx;
  267. .item{
  268. padding: 10rpx 30rpx;
  269. display: flex;
  270. align-items: center;
  271. justify-content: flex-start;
  272. .left{
  273. flex:1;
  274. display: flex;
  275. align-items: center;
  276. justify-content: flex-start;
  277. .num{
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. border-radius: 50%;
  282. background-color: #4FCBC1;
  283. width: 40rpx;
  284. height:40rpx;
  285. font-size: 28rpx;
  286. font-weight: bold;
  287. color: #fff;
  288. }
  289. .head{
  290. margin-left: 10rpx;
  291. width: 80rpx;
  292. height:80rpx;
  293. display: flex;
  294. align-items: center;
  295. justify-content: center;
  296. image{
  297. border-radius: 50%;
  298. width: 100%;
  299. height:100%;
  300. }
  301. }
  302. .name{
  303. margin-left: 10rpx;
  304. font-size: 32rpx;
  305. color: #111;
  306. font-weight: bold;
  307. }
  308. }
  309. .right{
  310. .money{
  311. font-size: 28rpx;
  312. color: #40403F ;
  313. font-weight: bold;
  314. }
  315. }
  316. }
  317. }
  318. }
  319. </style>