userShareList.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. back(){
  102. uni.navigateBack({
  103. delta: 1, // 返回的页面数,默认为1
  104. });
  105. },
  106. changeType(type){
  107. console.log(type)
  108. this.type=type;
  109. this.list=[];
  110. this.page.page=1
  111. this.loaded=false;
  112. this.loading=false;
  113. this.getUserShareList();
  114. },
  115. getUserShareList: function () {
  116. let that = this;
  117. if (that.loaded || that.loading) return;
  118. that.loading = true;
  119. this.page.type=this.type;
  120. getUserShareList(this.page).then(
  121. res => {
  122. that.total=res.data.total;
  123. that.list.push.apply(that.list, res.data.list);
  124. that.loading = false;
  125. that.loaded = !res.data.hasNextPage;
  126. that.page.page = that.page.page + 1;
  127. uni.hideLoading()
  128. },
  129. err => {
  130. uni.showToast({
  131. title: err.msg || err.response.data.msg || err.response.data.message,
  132. icon: "none",
  133. duration: 2000
  134. });
  135. },
  136. 300
  137. );
  138. },
  139. }
  140. };
  141. </script>
  142. <style lang="less">
  143. .page{
  144. height: 100%;
  145. }
  146. .content{
  147. height: 100%;
  148. background-image: linear-gradient(#35E1B1,#C7FFF2);
  149. }
  150. .fixed-top-box{
  151. width: 100%;
  152. position: fixed;
  153. top: 0;
  154. left: 0;
  155. z-index: 1000;
  156. .back-box{
  157. height: 88upx;
  158. padding-left: 22upx;
  159. display: flex;
  160. align-items: center;
  161. justify-content: space-between;
  162. padding: 0 20upx;
  163. image{
  164. width: 40upx;
  165. height: 40upx;
  166. }
  167. .title{
  168. font-size: 32upx;
  169. font-family: PingFang SC;
  170. font-weight: 500;
  171. color: #FFFFFF;
  172. }
  173. }
  174. }
  175. .promoter-list{
  176. width: 100%;
  177. padding-top: 88rpx;
  178. .tab-box{
  179. margin: 30rpx 60rpx;
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. background-color:#FFFFFF ;
  184. border-radius: 36rpx;
  185. height: 60rpx;
  186. padding: 5rpx;
  187. .tab-item{
  188. height: 100%;
  189. border-radius: 30rpx;
  190. flex: 1;
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. color: #16967F;
  195. background-color:none ;
  196. font-size: 28rpx;
  197. }
  198. .active{
  199. color: #FFFFFF;
  200. background-color:#43CABC ;
  201. }
  202. }
  203. .top-box{
  204. z-index: 0;
  205. height: 450rpx;
  206. margin: 0rpx 60rpx;
  207. display: flex;
  208. align-items: flex-start;
  209. justify-content: center;
  210. position: relative;
  211. .bg{
  212. z-index: 0;
  213. bottom: -150rpx;
  214. position: absolute;
  215. height: 400rpx;
  216. width: 100%;
  217. image{
  218. height: 400rpx;
  219. width: 100%;
  220. }
  221. }
  222. .top-item{
  223. width: 33.33%;
  224. z-index: 10;
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. flex-direction: column;
  229. .head{
  230. position: relative;
  231. .head-bg{
  232. width: 120rpx;
  233. height:140rpx;
  234. }
  235. .bg{
  236. top:35rpx;
  237. left:10rpx;
  238. position: absolute;
  239. width: 100rpx;
  240. height:100rpx;
  241. border-radius: 50%;
  242. }
  243. }
  244. .name{
  245. font-size: 28rpx;
  246. font-weight: bold;
  247. color:#fff;
  248. }
  249. .money{
  250. margin-top: 10rpx;
  251. background-color: #B4FFF1;
  252. border-radius: 30rpx;
  253. padding:10rpx 15rpx;
  254. font-size: 24rpx;
  255. color:#16967F;
  256. }
  257. }
  258. .top1{
  259. margin-top: 40rpx;
  260. }
  261. .top2{
  262. margin-top: 120rpx;
  263. }
  264. }
  265. .list{
  266. position: relative;
  267. min-height: 800rpx;
  268. z-index: 101;
  269. background-color: #FFFFFF;
  270. margin: 0rpx 30rpx 30rpx;
  271. border-radius: 30rpx;
  272. .item{
  273. padding: 10rpx 30rpx;
  274. display: flex;
  275. align-items: center;
  276. justify-content: flex-start;
  277. .left{
  278. flex:1;
  279. display: flex;
  280. align-items: center;
  281. justify-content: flex-start;
  282. .num{
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. border-radius: 50%;
  287. background-color: #4FCBC1;
  288. width: 40rpx;
  289. height:40rpx;
  290. font-size: 28rpx;
  291. font-weight: bold;
  292. color: #fff;
  293. }
  294. .head{
  295. margin-left: 10rpx;
  296. width: 80rpx;
  297. height:80rpx;
  298. display: flex;
  299. align-items: center;
  300. justify-content: center;
  301. image{
  302. border-radius: 50%;
  303. width: 100%;
  304. height:100%;
  305. }
  306. }
  307. .name{
  308. margin-left: 10rpx;
  309. font-size: 32rpx;
  310. color: #111;
  311. font-weight: bold;
  312. }
  313. }
  314. .right{
  315. .money{
  316. font-size: 28rpx;
  317. color: #40403F ;
  318. font-weight: bold;
  319. }
  320. }
  321. }
  322. }
  323. }
  324. </style>