PromoterRank.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="PromoterRank">
  3. <div class="redBg bg-color-red">
  4. <div class="header">
  5. <div class="nav acea-row row-center-wrapper">
  6. <div
  7. class="item"
  8. :class="active === index ? 'font-color-red' : ''"
  9. v-for="(item, index) in navList"
  10. :key="index"
  11. @click="active = index"
  12. >
  13. {{ item }}
  14. </div>
  15. </div>
  16. <div class="rank acea-row row-bottom row-around">
  17. <div class="item" v-show="Two.uid">
  18. <div class="pictrue"><img :src="Two.avatar" /></div>
  19. <div class="name line1">{{ Two.nickname }}</div>
  20. <div class="num">{{ Two.count }}人</div>
  21. </div>
  22. <div class="item" v-if="One.uid">
  23. <div class="pictrue"><img :src="One.avatar" /></div>
  24. <div class="name line1">{{ One.nickname }}</div>
  25. <div class="num">{{ One.count }}人</div>
  26. </div>
  27. <div class="item" v-if="Three.uid">
  28. <div class="pictrue"><img :src="Three.avatar" /></div>
  29. <div class="name line1">{{ Three.nickname }}</div>
  30. <div class="num">{{ Three.count }}人</div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="list" v-if="rankList.length">
  36. <div
  37. class="item acea-row row-between-wrapper"
  38. v-for="(item, index) in rankList"
  39. :key="index"
  40. >
  41. <div class="num">{{ index + 4 }}</div>
  42. <div class="picTxt acea-row row-between-wrapper">
  43. <div class="pictrue"><img :src="item.avatar" /></div>
  44. <div class="text line1">{{ item.nickname }}</div>
  45. </div>
  46. <div class="people font-color-red">{{ item.count }}人</div>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <style scoped>
  52. .PromoterRank .redBg {
  53. padding: 0.45rem 0 0.3rem 0;
  54. }
  55. .PromoterRank .header {
  56. background: url("../../../assets/images/integralbg.jpg") no-repeat;
  57. width: 100%;
  58. height: 4.6rem;
  59. background-size: 100% 100%;
  60. }
  61. .PromoterRank .header .nav {
  62. width: 4.5rem;
  63. height: 0.66rem;
  64. border: 1px solid #fff;
  65. border-radius: 0.33rem;
  66. font-size: 0.3rem;
  67. color: #fff;
  68. margin: 0 auto;
  69. }
  70. .PromoterRank .header .nav .item {
  71. width: 2.23rem;
  72. height: 100%;
  73. text-align: center;
  74. line-height: 0.64rem;
  75. }
  76. .PromoterRank .header .nav .item.font-color-red:nth-of-type(1) {
  77. background-color: #fff;
  78. border-radius: 0.33rem 0 0 0.33rem;
  79. }
  80. .PromoterRank .header .nav .item.font-color-red:nth-of-type(2) {
  81. background-color: #fff;
  82. border-radius: 0 0.33rem 0.33rem 0;
  83. }
  84. .PromoterRank .header .rank {
  85. padding: 0 0.2rem;
  86. margin-top: 0.3rem;
  87. }
  88. .PromoterRank .header .rank .item .pictrue {
  89. background: url("../../../assets/images/twoT.png") no-repeat;
  90. background-size: 100% 100%;
  91. width: 1.36rem;
  92. height: 1.77rem;
  93. position: relative;
  94. margin: 0 auto;
  95. }
  96. .PromoterRank .header .rank .item .pictrue img {
  97. position: absolute;
  98. width: 1.3rem;
  99. height: 1.3rem;
  100. display: block;
  101. bottom: 0.02rem;
  102. border-radius: 50%;
  103. left: 50%;
  104. margin-left: -0.65rem;
  105. }
  106. .PromoterRank .header .rank .item:nth-of-type(2) .pictrue {
  107. background-image: url("../../../assets/images/oneT.png");
  108. width: 1.56rem;
  109. height: 2.05rem;
  110. }
  111. .PromoterRank .header .rank .item:nth-of-type(2) .pictrue img {
  112. width: 1.5rem;
  113. height: 1.5rem;
  114. margin-left: -0.75rem;
  115. }
  116. .PromoterRank .header .rank .item:nth-of-type(3) .pictrue {
  117. background-image: url("../../../assets/images/threeT.png");
  118. }
  119. .PromoterRank .header .rank .item:nth-of-type(3) .pictrue img {
  120. margin-left: -0.64rem;
  121. }
  122. .PromoterRank .header .rank .item .name {
  123. font-size: 0.3rem;
  124. color: #fff;
  125. margin-top: 0.22rem;
  126. text-align: center;
  127. width: 1.7rem;
  128. }
  129. .PromoterRank .header .rank .item .num {
  130. font-size: 0.3rem;
  131. color: #fff;
  132. text-align: center;
  133. }
  134. .PromoterRank .list {
  135. width: 7.1rem;
  136. background-color: #fff;
  137. border-radius: 0.2rem;
  138. margin: -0.6rem auto 0 auto;
  139. padding: 0 0.3rem;
  140. }
  141. .PromoterRank .list .item {
  142. border-bottom: 1px solid #f3f3f3;
  143. height: 1.01rem;
  144. font-size: 0.28rem;
  145. }
  146. .PromoterRank .list .item .num {
  147. color: #666;
  148. width: 0.7rem;
  149. }
  150. .PromoterRank .list .item .picTxt {
  151. width: 3.5rem;
  152. }
  153. .PromoterRank .list .item .picTxt .pictrue {
  154. width: 0.68rem;
  155. height: 0.68rem;
  156. }
  157. .PromoterRank .list .item .picTxt .pictrue img {
  158. width: 100%;
  159. height: 100%;
  160. display: block;
  161. border-radius: 50%;
  162. }
  163. .PromoterRank .list .item .picTxt .text {
  164. width: 2.62rem;
  165. color: #333;
  166. }
  167. .PromoterRank .list .item .people {
  168. width: 1.75rem;
  169. text-align: right;
  170. }
  171. </style>
  172. <script>
  173. import { getRankList } from "@api/user";
  174. const NAME = "PromoterRank";
  175. export default {
  176. name: NAME,
  177. props: {},
  178. data: function() {
  179. return {
  180. navList: ["周榜", "月榜"],
  181. active: 0,
  182. page: 1,
  183. limit: 10,
  184. loading: false,
  185. loadend: false,
  186. rankList: [],
  187. One: {},
  188. Two: {},
  189. Three: {},
  190. type: "week"
  191. };
  192. },
  193. watch: {
  194. $route(n) {
  195. if (n.name === NAME) {
  196. this.loaded = false;
  197. this.page = 1;
  198. this.$set(this, "rankList", []);
  199. this.getRankList();
  200. }
  201. },
  202. active: function(n) {
  203. this.type = n ? "month" : "week";
  204. this.page = 1;
  205. this.loaded = false;
  206. this.$set(this, "rankList", []);
  207. this.getRankList();
  208. }
  209. },
  210. mounted: function() {
  211. this.getRankList();
  212. this.$scroll(this.$refs.container, () => {
  213. !this.loading && this.getRankList();
  214. });
  215. },
  216. methods: {
  217. getRankList: function() {
  218. getRankList({
  219. page: this.page,
  220. limit: this.limit,
  221. type: this.type
  222. })
  223. .then(res => {
  224. let list = res.data;
  225. this.rankList.push.apply(this.rankList, list);
  226. if (this.page == 1) {
  227. this.One = this.rankList.shift() || {};
  228. this.Two = this.rankList.shift() || {};
  229. this.Three = this.rankList.shift() || {};
  230. }
  231. this.page++;
  232. this.loading = false;
  233. this.loaded = list.length < this.limit;
  234. this.$set(this, "rankList", this.rankList);
  235. })
  236. .catch(() => {
  237. this.loading = false;
  238. });
  239. }
  240. }
  241. };
  242. </script>