RankPage.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <ion-page>
  3. <ion-content class="rank-page">
  4. <div class="top">
  5. <img src="../assets/png-bg-paihang.jpg" alt="" class="bg" />
  6. <!-- <img
  7. src="../assets/png-shuzi.png"
  8. class="img1 animate__tada animate__slow animate__animated animate__infinite"
  9. alt=""
  10. /> -->
  11. <div class="top-num-box">
  12. <div class="top-num animate__tada animate__slow animate__animated animate__infinite">
  13. <span>{{ showBouns }}</span>
  14. </div>
  15. </div>
  16. <div class="lottie-box">
  17. <Vue3Lottie :width="100" :speed="1.2" :animationData="prizeJSON" />
  18. </div>
  19. <img
  20. src="../assets/png-yaoqing-btn.png"
  21. class="img2 animate__heartBeat animate__animated animate__infinite"
  22. alt=""
  23. @click="goInvite"
  24. />
  25. </div>
  26. <div class="rank-bg" :style="{ backgroundImage: `url(${rankBg})` }">
  27. <div class="rank">
  28. <div class="tabs-wrapper">
  29. <div class="tabs">
  30. <div class="tab" :class="{ active: tab === 1 }" @click="tab = 1">
  31. {{ $t('rank.rankByInvite') }}
  32. </div>
  33. <div class="tab" :class="{ active: tab === 0 }" @click="tab = 0">
  34. {{ $t('rank.rankByProfit') }}
  35. </div>
  36. <div class="tabs-box" :style="{ left: tab === 0 ? 'calc(50% + 3px)' : '3px' }"></div>
  37. </div>
  38. </div>
  39. <div class="rank-content-wrapper" :class="tab === 0 ? 'profit' : 'invite'">
  40. <div class="rank-content">
  41. <div class="row head">
  42. <div class="col-1">{{ $t('rank.rank') }}</div>
  43. <div class="col-2">{{ $t('rank.userInfo') }}</div>
  44. <!-- <div class="col-2-1" v-if="tab === 0">
  45. {{ $t('rank.stake') }}
  46. </div> -->
  47. <div class="col-3">{{ tab === 0 ? $t('rank.profit') : $t('rank.inviteNum') }}</div>
  48. </div>
  49. <div class="row" v-for="(item, i) in tab === 0 ? profitList : inviteList" :key="i">
  50. <div class="col-1">
  51. <img v-if="i < 3" :src="rankImg[i]" />
  52. <div v-else>{{ i + 1 }}</div>
  53. </div>
  54. <div class="col-2">
  55. <van-image
  56. class="avatar"
  57. :src="item.avatar"
  58. radius="4"
  59. width="24"
  60. height="24"
  61. fit="cover"
  62. />
  63. <div class="name">{{ item.nickname }}</div>
  64. </div>
  65. <div
  66. class="rank-val"
  67. :class="[`rank-val_${i}`]"
  68. v-if="tab === 1 && i < 10 && item.juniorCount > 0"
  69. >
  70. <img class="val-bg" :src="rankValue[i].img" alt="" />
  71. <div class="val-content">
  72. <div class="text1">{{ rankValue[i].label }}</div>
  73. <div class="text2">
  74. <span class="nor">{{ $t('balance.symbol') }} </span>
  75. {{ getRankVal(rankValue[i].val) }}
  76. </div>
  77. </div>
  78. </div>
  79. <!-- <div class="col-2-1" v-if="tab === 0">{{ $t('balance.symbol') }}{{ item.stake }}</div> -->
  80. <div class="col-3" :class="'rank_' + (i + 1)" v-if="tab === 0">
  81. <!-- {{ $t('balance.withdraw') }}{{ item.withdrawAccumulation }} -->
  82. <span class="nor"> {{ $t('balance.symbol') }}</span
  83. >{{ item.money }}
  84. </div>
  85. <div class="col-3" :class="'rank_' + (i + 1)" v-else>
  86. {{ item.juniorCount }}
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </ion-content>
  94. </ion-page>
  95. </template>
  96. <script setup>
  97. import { ref, computed } from 'vue'
  98. import { http } from '@/plugins/http'
  99. import { onIonViewWillEnter } from '@ionic/vue'
  100. import rank1 from '@/assets/rank_1.png'
  101. import rank2 from '@/assets/rank_2.png'
  102. import rank3 from '@/assets/rank_3.png'
  103. import rankBg1 from '@/assets/png - shou yi-laxing1.png'
  104. import rankBg2 from '@/assets/png - shou yi-laxing2.png'
  105. import rankBg3 from '@/assets/png - shou yi-laxing3.png'
  106. import rankBg4 from '@/assets/png - shou yi-laxing4.png'
  107. import { Vue3Lottie } from 'vue3-lottie'
  108. import prizeJSON from '@/assets/lottie/prize.json'
  109. import '@/styles/animate.css'
  110. import rankBg from '@/assets/png-bg-paihang-xiahua.jpg'
  111. import { useIonRouter } from '@ionic/vue'
  112. import { accMul } from '@/plugins/calc.js'
  113. const rankImg = [rank1, rank2, rank3]
  114. const rankValue = [
  115. {
  116. img: rankBg1,
  117. label: '40%',
  118. val: 0.4
  119. },
  120. {
  121. img: rankBg2,
  122. label: '20%',
  123. val: 0.2
  124. },
  125. {
  126. img: rankBg3,
  127. label: '10%',
  128. val: 0.1
  129. },
  130. {
  131. img: rankBg4,
  132. label: '8%',
  133. val: 0.08
  134. },
  135. {
  136. img: rankBg4,
  137. label: '7%',
  138. val: 0.07
  139. },
  140. {
  141. img: rankBg4,
  142. label: '5%',
  143. val: 0.05
  144. },
  145. {
  146. img: rankBg4,
  147. label: '4%',
  148. val: 0.04
  149. },
  150. {
  151. img: rankBg4,
  152. label: '3%',
  153. val: 0.03
  154. },
  155. {
  156. img: rankBg4,
  157. label: '2%',
  158. val: 0.02
  159. },
  160. {
  161. img: rankBg4,
  162. label: '1%',
  163. val: 0.01
  164. }
  165. ]
  166. const showBouns = computed(() => {
  167. return bonus.value ? bonus.value.amount : 0
  168. })
  169. function getRankVal(val) {
  170. return accMul(showBouns.value, val)
  171. }
  172. const tab = ref(1)
  173. const profitList = ref([])
  174. const inviteList = ref([])
  175. const bonus = ref(0)
  176. onIonViewWillEnter(getRank)
  177. function getRank() {
  178. http.get('/financeOrder/rank').then(res => {
  179. profitList.value = res
  180. })
  181. http.get('/user/rankByInvite').then(res => {
  182. inviteList.value = res
  183. })
  184. http.get('/bonus/today').then(res => {
  185. bonus.value = res
  186. })
  187. }
  188. const router = useIonRouter()
  189. function goInvite() {
  190. router.replace({ name: 'distribution1', query: { showShare: true } })
  191. }
  192. </script>
  193. <style lang="less" scoped>
  194. .bg {
  195. position: relative;
  196. display: block;
  197. width: 100%;
  198. z-index: 1;
  199. }
  200. .rank-page {
  201. .f-col();
  202. }
  203. .top {
  204. position: relative;
  205. .top-num-box {
  206. position: absolute;
  207. z-index: 3;
  208. top: 49.6vw;
  209. left: 50%;
  210. transform: translateX(-50%);
  211. }
  212. .top-num {
  213. background: linear-gradient(270deg, #d32dff 0%, #834efc 48%, #2b73f8 100%);
  214. border-radius: 18px;
  215. border: 1px solid #ffffff;
  216. line-height: 36px;
  217. padding: 0 12px;
  218. font-size: 30px;
  219. font-family: alibabaPuHui;
  220. font-weight: bold;
  221. }
  222. .img1 {
  223. position: absolute;
  224. top: 49.6vw;
  225. left: 50%;
  226. width: 160px;
  227. z-index: 3;
  228. margin-left: -80px;
  229. }
  230. .img2 {
  231. position: absolute;
  232. width: 150px;
  233. height: 46px;
  234. bottom: 30.9vw;
  235. left: 50%;
  236. margin-left: -75px;
  237. z-index: 2;
  238. }
  239. .lottie-box {
  240. position: absolute;
  241. width: 53.3vw;
  242. height: 53.3vw;
  243. overflow: hidden;
  244. top: 40vw;
  245. left: 50%;
  246. margin-left: -26.6vw;
  247. z-index: 2;
  248. border-radius: 100%;
  249. }
  250. .text {
  251. position: absolute;
  252. top: 41px;
  253. left: 18px;
  254. font-size: 10px;
  255. color: rgba(var(--ion-text-color-rgb), 0.6);
  256. line-height: 10px;
  257. }
  258. }
  259. .rank-bg {
  260. background-repeat: repeat-y;
  261. background-size: 100% auto;
  262. }
  263. .rank {
  264. flex-grow: 1;
  265. min-height: calc(100% - 116.2vw);
  266. padding: 0 10px;
  267. position: relative;
  268. .f-col();
  269. z-index: 2;
  270. transform: translateY(-21.3vw);
  271. }
  272. .tabs-wrapper {
  273. position: relative;
  274. height: 50px;
  275. border-radius: 8px;
  276. padding: 2px;
  277. background: linear-gradient(360deg, rgba(104, 13, 214, 1), rgba(225, 181, 255, 1));
  278. .tabs {
  279. .f();
  280. align-items: stretch;
  281. border-radius: 8px;
  282. position: relative;
  283. height: 100%;
  284. background: #19064f;
  285. .tab {
  286. width: 50%;
  287. text-align: center;
  288. position: relative;
  289. color: #fff;
  290. font-size: 12px;
  291. z-index: 1;
  292. .f();
  293. justify-content: center;
  294. transition: all 0.2s;
  295. &.active {
  296. color: #fff;
  297. font-size: 16px;
  298. font-family: TsangerYuMo;
  299. }
  300. }
  301. .tabs-box {
  302. position: absolute;
  303. width: calc(50% - 6px);
  304. z-index: 0;
  305. background: #6728f9;
  306. border-radius: 8px;
  307. left: 3px;
  308. top: 3px;
  309. bottom: 3px;
  310. transition: left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  311. }
  312. }
  313. }
  314. .rank-content-wrapper {
  315. margin-top: 12px;
  316. padding: 2px;
  317. background: linear-gradient(162deg, rgba(104, 13, 214, 1), rgba(225, 181, 255, 1));
  318. border-radius: 8px;
  319. .rank-content {
  320. background: #19064f;
  321. padding: 0 12px;
  322. overflow: auto;
  323. min-height: 0;
  324. flex-basis: 0;
  325. flex-grow: 1;
  326. border-radius: 6px;
  327. }
  328. .row {
  329. .f();
  330. background: #4722ad linear-gradient(90deg, #6728f9 0%, #5724e3 100%);
  331. border-radius: 4px;
  332. font-size: 12px;
  333. height: 54px;
  334. margin-bottom: 12px;
  335. color: #ffffff;
  336. .col-1 {
  337. .f();
  338. justify-content: center;
  339. text-align: center;
  340. font-size: 16px;
  341. font-weight: bold;
  342. width: 52px;
  343. img {
  344. width: 32px;
  345. height: 32px;
  346. }
  347. }
  348. .col-2 {
  349. .f();
  350. min-width: 0;
  351. flex: 1 1 0;
  352. width: 80px;
  353. margin-left: 20px;
  354. .avatar {
  355. margin-right: 8px;
  356. }
  357. font-size: 12px;
  358. }
  359. .col-2-1 {
  360. flex: 1;
  361. }
  362. .col-3 {
  363. flex: 1;
  364. font-size: 14px;
  365. font-weight: bold;
  366. line-height: 24px;
  367. min-width: 50px;
  368. text-align: right;
  369. margin-right: 10px;
  370. }
  371. }
  372. .head {
  373. height: 49px;
  374. .f();
  375. background: #19064f;
  376. color: #fff;
  377. border-radius: 8px 8px 0 0;
  378. margin-bottom: 0;
  379. > * {
  380. font-size: 12px !important;
  381. font-weight: 400 !important;
  382. }
  383. }
  384. }
  385. .rank-val {
  386. position: relative;
  387. .val-bg {
  388. width: 66px;
  389. display: block;
  390. }
  391. .val-content {
  392. position: absolute;
  393. top: 0;
  394. left: 0;
  395. right: 0;
  396. bottom: 0;
  397. .f-col();
  398. align-items: center;
  399. justify-content: center;
  400. .text1 {
  401. font-size: 12px;
  402. font-weight: bold;
  403. color: #4d4d4d;
  404. line-height: 14px;
  405. }
  406. .text2 {
  407. font-size: 12px;
  408. font-weight: bold;
  409. color: #4d4d4d;
  410. line-height: 12px;
  411. margin-top: 4px;
  412. .nor {
  413. font-weight: normal;
  414. }
  415. }
  416. }
  417. &.rank-val_0 {
  418. .val-content {
  419. .text1 {
  420. .gradient-text(#ed5701, #c40800);
  421. }
  422. .text2 {
  423. .gradient-text(#ed5701, #c40800);
  424. }
  425. }
  426. }
  427. &.rank-val_1 {
  428. .val-content {
  429. .text1 {
  430. .gradient-text(#004f84, #0a4268);
  431. }
  432. .text2 {
  433. .gradient-text(#004f84, #0a4268);
  434. }
  435. }
  436. }
  437. &.rank-val_2 {
  438. .val-content {
  439. .text1 {
  440. .gradient-text(#ae4432, #9d1c06);
  441. }
  442. .text2 {
  443. .gradient-text(#ae4432, #9d1c06);
  444. }
  445. }
  446. }
  447. }
  448. .nor {
  449. font-weight: normal;
  450. }
  451. </style>