index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="PromoterRank">
  4. <!-- #ifdef MP -->
  5. <view class="accountTitle">
  6. <view :style="{height:getHeight.barTop+'px'}"></view>
  7. <view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
  8. <view>推广人排行</view>
  9. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  10. </view>
  11. </view>
  12. <view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
  13. <!-- #endif -->
  14. <view class="header">
  15. <view class="acea-row row-middle row-right">
  16. <view class="left">
  17. <view class="pictrue">
  18. <image src="../static/ranking.png"></image>
  19. </view>
  20. <view class="tips" v-if="rankInfo.rank">您目前的排名<text class="num">{{rankInfo.rank}}</text>名</view>
  21. <view class="tips" v-else>您目前暂无排名</view>
  22. </view>
  23. <view class="trophy">
  24. <image :src="imgHost+'/statics/images/users/trophy.png'"></image>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="wrapper">
  29. <view class="nav acea-row row-around">
  30. <view class="item" :class="active == index ? 'on' : ''" v-for="(item,index) in navList"
  31. :key="index" @click="switchTap(index)">
  32. {{ item }}
  33. </view>
  34. </view>
  35. <view class="list" v-if="rankList.length">
  36. <view class="item acea-row row-between-wrapper" v-for="(item,index) in rankList" :key="index">
  37. <view class="acea-row row-middle">
  38. <view class="num" v-if="index <= 2">
  39. <image :src="'../static/no'+(index+1)+'.png'"></image>
  40. </view>
  41. <view class="num" v-else>
  42. {{index+1}}
  43. </view>
  44. <view class="pictrue">
  45. <image :src="item.avatar"></image>
  46. </view>
  47. <view class="text line1">{{item.nickname}}</view>
  48. </view>
  49. <view class="people">{{item.count}}人</view>
  50. </view>
  51. </view>
  52. <view v-if="!rankList.length">
  53. <emptyPage title="暂无排行榜数据哦~"></emptyPage>
  54. </view>
  55. </view>
  56. <view style="height: 130rpx;" v-if="rankInfo.position>0"></view>
  57. <view class="footer acea-row row-between-wrapper" v-if="rankInfo.position>0">
  58. <view class="acea-row row-middle">
  59. <view class="me">我</view>
  60. <view class="pictrue">
  61. <image :src="rankInfo.avatar"></image>
  62. </view>
  63. <view class="name line1">{{rankInfo.nickname}}</view>
  64. <view class="ranking">第{{rankInfo.position}}名</view>
  65. </view>
  66. <view class="num">¥{{rankInfo.brokerage_price}}</view>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. getRankList
  74. } from '@/api/user.js';
  75. import {
  76. toLogin
  77. } from '@/libs/login.js';
  78. import emptyPage from '@/components/emptyPage.vue'
  79. import {
  80. mapGetters
  81. } from "vuex";
  82. import home from '@/components/home';
  83. import colors from '@/mixins/color.js';
  84. import {
  85. HTTP_REQUEST_URL
  86. } from '@/config/app';
  87. export default {
  88. components: {
  89. home,
  90. emptyPage
  91. },
  92. mixins: [colors],
  93. data() {
  94. return {
  95. imgHost: HTTP_REQUEST_URL,
  96. // #ifdef MP
  97. getHeight: this.$util.getWXStatusHeight(),
  98. // #endif
  99. navList: ["周排行", "月排行"],
  100. active: 0,
  101. page: 1,
  102. limit: 20,
  103. type: 'week',
  104. loading: false,
  105. loadend: false,
  106. rankInfo:{
  107. position:0,
  108. avatar:'',
  109. brokerage_price:'',
  110. nickname:''
  111. },
  112. rankList: [],
  113. isShowAuth: false
  114. };
  115. },
  116. computed: mapGetters(['isLogin']),
  117. watch: {
  118. isLogin: {
  119. handler: function(newV, oldV) {
  120. if (newV) {
  121. this.getRanklist();
  122. }
  123. },
  124. deep: true
  125. }
  126. },
  127. onLoad() {
  128. if (this.isLogin) {
  129. this.getRanklist();
  130. } else {
  131. toLogin()
  132. }
  133. },
  134. onShow() {
  135. uni.removeStorageSync('form_type_cart');
  136. },
  137. methods: {
  138. onLoadFun() {
  139. this.getRanklist();
  140. this.isShowAuth = false;
  141. },
  142. // 授权关闭
  143. authColse: function(e) {
  144. this.isShowAuth = e
  145. },
  146. goarrow(){
  147. uni.navigateBack()
  148. },
  149. getRanklist: function() {
  150. let that = this;
  151. if (that.loadend) return;
  152. if (that.loading) return;
  153. that.loading = true;
  154. getRankList({
  155. page: that.page,
  156. limit: that.limit,
  157. type: that.type
  158. }).then(res => {
  159. let list = res.data.list;
  160. that.rankInfo = res.data;
  161. that.rankList.push.apply(that.rankList, list);
  162. that.loadend = list.length < that.limit;
  163. that.loading = false;
  164. that.$set(that, 'rankList', that.rankList);
  165. that.page = that.page + 1;
  166. }).catch(err => {
  167. that.loading = false;
  168. })
  169. },
  170. switchTap: function(index) {
  171. if (this.active === index) return;
  172. this.active = index;
  173. this.type = index ? 'month' : 'week';
  174. this.page = 1;
  175. this.loadend = false;
  176. this.$set(this, 'rankList', []);
  177. this.getRanklist();
  178. },
  179. },
  180. onReachBottom: function() {
  181. this.getRanklist();
  182. }
  183. }
  184. </script>
  185. <style scoped lang="scss">
  186. .accountTitle{
  187. background: linear-gradient(180deg, #FFC48D 0%, #FCCEA4 100%);
  188. position: fixed;
  189. left:0;
  190. top:0;
  191. width: 100%;
  192. z-index: 99;
  193. .sysTitle{
  194. width: 100%;
  195. position: relative;
  196. font-weight: 500;
  197. color: #333333;
  198. font-size: 30rpx;
  199. .iconfont{
  200. position: absolute;
  201. font-size: 36rpx;
  202. left:11rpx;
  203. width: 60rpx;
  204. }
  205. }
  206. }
  207. .PromoterRank{
  208. padding-bottom: 30rpx;
  209. .footer{
  210. position: fixed;
  211. height: 128rpx;
  212. background-color: #fff;
  213. font-size: 28rpx;
  214. width: 100%;
  215. bottom: 0;
  216. left:0;
  217. border-top: 1px solid #EEEEEE;
  218. padding: 0 64rpx;
  219. .me{
  220. color: #FF7D00;
  221. }
  222. .pictrue{
  223. width: 80rpx;
  224. height: 80rpx;
  225. margin-left: 48rpx;
  226. image{
  227. width: 100%;
  228. height: 100%;
  229. border-radius: 50%;
  230. }
  231. }
  232. .name{
  233. max-width: 164rpx;
  234. margin-left: 24rpx;
  235. }
  236. .ranking{
  237. color: #FF7D00;
  238. margin-left: 16rpx;
  239. }
  240. .num{
  241. color: #FF7D00;
  242. }
  243. }
  244. .header{
  245. background: linear-gradient(180deg, #FCCEA4 50%, #F5F5F5 100%);
  246. height: 560rpx;
  247. padding-top: 26rpx;
  248. .left{
  249. .pictrue{
  250. width: 352rpx;
  251. height: 76rpx;
  252. image{
  253. width: 100%;
  254. height: 100%;
  255. }
  256. }
  257. .tips{
  258. font-size: 28rpx;
  259. font-weight: 400;
  260. color: #D25F00;
  261. margin-top: 30rpx;
  262. .num{
  263. font-family: 'SemiBold';
  264. font-size: 40rpx;
  265. margin: 0 8rpx;
  266. }
  267. }
  268. }
  269. .trophy{
  270. width: 324rpx;
  271. height: 260rpx;
  272. margin-left: 38rpx;
  273. image{
  274. width: 100%;
  275. height: 100%;
  276. }
  277. }
  278. }
  279. .wrapper{
  280. width: 710rpx;
  281. background-color: #fff;
  282. border-radius: 20rpx;
  283. margin: -278rpx auto 0 auto;
  284. .nav{
  285. font-size: 28rpx;
  286. font-weight: 400;
  287. color: #999;
  288. .item{
  289. color: #999999;
  290. padding: 32rpx 0 12rpx 0;
  291. &.on{
  292. color: #333;
  293. font-size: 32rpx;
  294. position: relative;
  295. font-weight: 600;
  296. &::after{
  297. position: absolute;
  298. content: '';
  299. width: 56rpx;
  300. height: 4rpx;
  301. background: #E93323;
  302. border-radius: 2rpx;
  303. left:50%;
  304. margin-left: -28rpx;
  305. bottom: 0;
  306. }
  307. }
  308. }
  309. }
  310. .list{
  311. padding: 0 44rpx 72rpx 28rpx;
  312. .item{
  313. margin-top: 48rpx;
  314. .num{
  315. font-weight: 400;
  316. color: #999;
  317. font-size: 28rpx;
  318. width: 64rpx;
  319. height: 64rpx;
  320. text-align: center;
  321. line-height: 64rpx;
  322. image{
  323. width: 100%;
  324. height: 100%;
  325. display: block;
  326. }
  327. }
  328. .pictrue{
  329. width: 80rpx;
  330. height: 80rpx;
  331. margin-left: 28rpx;
  332. image{
  333. width: 100%;
  334. height: 100%;
  335. border-radius: 50%;
  336. }
  337. }
  338. .text{
  339. font-weight: 400;
  340. color: #333333;
  341. font-size: 28rpx;
  342. margin-left: 24rpx;
  343. width: 180rpx;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. </style>