list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view class="app-container">
  3. <custom
  4. :bgColor="'bg-them'"
  5. :backColor="'#FFFFFF'"
  6. :isBack="true"
  7. v-show="isCustom"
  8. >
  9. <text slot="content" style="color: #ffffff; font-size: 36rpx"
  10. >收益排行榜</text
  11. >
  12. </custom>
  13. <view class="menu-container" :style="cuStyle">
  14. <image @tap="toBack" src="@/static/icon/back.png"></image>
  15. </view>
  16. <view class="top-container">
  17. <image
  18. src="@/static/mine/ranking/bg.png"
  19. mode="widthFix"
  20. class="bg"
  21. ></image>
  22. <view class="content">
  23. <view class="list">
  24. <block v-for="(item, index) in top_ranking" :key="index">
  25. <view class="item" :class="'no_' + item.ranking">
  26. <view class="top">
  27. <block v-if="!item.nodata">
  28. <image
  29. :src="item.avatar"
  30. class="head"
  31. v-if="item.avatar.indexOf('http') >= 0"
  32. ></image>
  33. <image
  34. :src="imageUrl + item.avatar"
  35. class="head"
  36. v-else
  37. ></image>
  38. </block>
  39. <image :src="configInfo.minLogo3" class="head" v-else></image>
  40. <image
  41. :src="'/static/mine/ranking/No_' + item.ranking + '.png'"
  42. class="rank"
  43. ></image>
  44. </view>
  45. <block v-if="!item.nodata">
  46. <view class="money">¥{{ item.total }}</view>
  47. <view class="name">{{ item.workUserName }}</view>
  48. <view class="text">{{ item.websitName }}</view>
  49. </block>
  50. <block v-if="item.nodata">
  51. <view class="nodata">{{ item.nodata }}</view>
  52. </block>
  53. </view>
  54. </block>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="list-container">
  59. <view class="mine">
  60. <view class="left">
  61. <view class="rank">
  62. <view class="row1" :class="mine_ranking.ranking ? 'big' : ''">{{
  63. mine_ranking.ranking || '未入榜'
  64. }}</view>
  65. <view class="row2">我的排名</view>
  66. </view>
  67. <block v-if="mine_ranking.avatar">
  68. <image
  69. :src="mine_ranking.avatar"
  70. v-if="mine_ranking.avatar.indexOf('http') >= 0"
  71. ></image>
  72. <image :src="imageUrl + mine_ranking.avatar" v-else></image>
  73. </block>
  74. <view class="info">
  75. <view class="name">{{ mine_ranking.workUserName }}</view>
  76. <view class="text ellipsis-2">{{
  77. mine_ranking.websitName || ''
  78. }}</view>
  79. </view>
  80. </view>
  81. <view class="right">
  82. <view class="money">{{ mine_ranking.total | numToFixed }}</view>
  83. <view class="report" @tap="toMyReport">查看我的月报></view>
  84. </view>
  85. </view>
  86. <view class="list" v-if="bottom_ranking && bottom_ranking.length > 0">
  87. <block v-for="(item, index) in bottom_ranking" :key="index">
  88. <view class="item">
  89. <view class="rank">{{ index + 4 }}</view>
  90. <block v-if="item.avatar">
  91. <image
  92. :src="item.avatar"
  93. v-if="item.avatar.indexOf('http') >= 0"
  94. ></image>
  95. <image :src="imageUrl + item.avatar" v-else></image>
  96. </block>
  97. <view class="main">
  98. <view class="top">
  99. <view class="name">{{ item.workUserName }}</view>
  100. <view class="money">{{ item.total | numToFixed }}</view>
  101. </view>
  102. <view class="text ellipsis">{{ item.websitName }}</view>
  103. </view>
  104. </view>
  105. </block>
  106. </view>
  107. </view>
  108. <view class="bottom-container" v-if="statisticalDate.start"
  109. >统计时间:{{ statisticalDate.start }} 至 {{ statisticalDate.end }}</view
  110. >
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. data() {
  116. return {
  117. imageUrl: this.$imageUrl,
  118. configInfo: uni.getStorageSync('configInfo'),
  119. scrollTop: 0, // 滚动高度(用于控制自定义导航)
  120. isCustom: false, // 是否显示自定义导航
  121. top_ranking: [],
  122. bottom_ranking: [],
  123. mine_ranking: {},
  124. statisticalDate: {},
  125. };
  126. },
  127. watch: {
  128. scrollTop() {
  129. if (this.scrollTop > 100) {
  130. this.isCustom = true;
  131. } else {
  132. this.isCustom = false;
  133. }
  134. },
  135. },
  136. computed: {
  137. cuStyle() {
  138. return `height:${this.CustomBar - this.StatusBar}px;padding-top:${
  139. this.StatusBar
  140. }px;`;
  141. },
  142. },
  143. onPageScroll(res) {
  144. this.scrollTop = res.scrollTop;
  145. },
  146. onLoad() {
  147. this.getData();
  148. },
  149. methods: {
  150. // 获取数据
  151. getData() {
  152. this.$axios({
  153. url: '/user/rank',
  154. method: 'get',
  155. params: {},
  156. isLoading: 1,
  157. }).then((res) => {
  158. let rankList = res.data.rankList || [];
  159. let top_ranking = rankList.slice(0, 3);
  160. for (let i = 0; i < 3; i++) {
  161. if (!top_ranking[i]) {
  162. top_ranking.push({ nodata: '虚位以待', ranking: i + 1 });
  163. }
  164. }
  165. let bottom_ranking = rankList;
  166. bottom_ranking.splice(0, 3);
  167. this.top_ranking = top_ranking;
  168. this.bottom_ranking = bottom_ranking;
  169. this.mine_ranking = res.data.myRank;
  170. this.statisticalDate = {
  171. start: res.data.startPeriod,
  172. end: res.data.endPeriod,
  173. };
  174. });
  175. },
  176. // 去我的月报
  177. toMyReport() {
  178. uni.navigateTo({
  179. url: '/pages/mine/ranking/report',
  180. });
  181. },
  182. toBack() {
  183. uni.navigateBack({
  184. delta: 1,
  185. });
  186. },
  187. },
  188. };
  189. </script>
  190. <style lang="scss">
  191. .app-container {
  192. background: #ffffff;
  193. box-sizing: border-box;
  194. }
  195. .menu-container {
  196. position: fixed;
  197. top: 0;
  198. z-index: 999;
  199. width: 100%;
  200. display: flex;
  201. align-items: center;
  202. image {
  203. width: 32rpx;
  204. height: 32rpx;
  205. display: block;
  206. margin-left: 30rpx;
  207. }
  208. }
  209. .top-container {
  210. position: relative;
  211. height: 900rpx;
  212. .bg {
  213. display: block;
  214. width: 750rpx;
  215. height: 900rpx;
  216. position: absolute;
  217. top: 0;
  218. z-index: 0;
  219. }
  220. .content {
  221. position: relative;
  222. z-index: 1;
  223. .list {
  224. display: flex;
  225. padding-top: 350rpx;
  226. .item {
  227. display: flex;
  228. flex-direction: column;
  229. align-items: center;
  230. width: 33.33%;
  231. padding: 0 20rpx;
  232. box-sizing: border-box;
  233. .top {
  234. position: relative;
  235. .head {
  236. border-radius: 50%;
  237. display: block;
  238. }
  239. .rank {
  240. position: absolute;
  241. display: block;
  242. }
  243. }
  244. .nodata {
  245. font-size: 28rpx;
  246. color: #ffffff;
  247. line-height: 32rpx;
  248. margin-top: 16rpx;
  249. }
  250. .money {
  251. font-size: 32rpx;
  252. color: #ffffff;
  253. line-height: 32rpx;
  254. margin-top: 16rpx;
  255. }
  256. .name {
  257. font-size: 32rpx;
  258. color: #ffffff;
  259. line-height: 32rpx;
  260. margin-top: 16rpx;
  261. }
  262. .text {
  263. font-size: 24rpx;
  264. color: #ffffff;
  265. line-height: 28rpx;
  266. text-align: center;
  267. margin-top: 10rpx;
  268. opacity: 0.6;
  269. }
  270. }
  271. .item.no_1 {
  272. order: 2;
  273. .head {
  274. width: 160rpx;
  275. height: 160rpx;
  276. border: 2px solid #ffb103;
  277. }
  278. .rank {
  279. width: 80rpx;
  280. height: 58rpx;
  281. top: -50rpx;
  282. left: 50%;
  283. margin-left: -40rpx;
  284. }
  285. }
  286. .item.no_2 {
  287. order: 1;
  288. margin-top: 100rpx;
  289. .head {
  290. width: 140rpx;
  291. height: 140rpx;
  292. border: 2px solid #cccccc;
  293. }
  294. .rank {
  295. width: 72rpx;
  296. height: 52rpx;
  297. top: -44rpx;
  298. left: 50%;
  299. margin-left: -36rpx;
  300. }
  301. }
  302. .item.no_3 {
  303. order: 3;
  304. margin-top: 140rpx;
  305. .head {
  306. width: 140rpx;
  307. height: 140rpx;
  308. border: 2px solid #f59234;
  309. }
  310. .rank {
  311. width: 72rpx;
  312. height: 52rpx;
  313. top: -44rpx;
  314. left: 50%;
  315. margin-left: -36rpx;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. .list-container {
  322. padding: 0 20rpx;
  323. margin-top: -40rpx;
  324. position: relative;
  325. z-index: 2;
  326. .mine {
  327. border-radius: 10rpx;
  328. padding: 25rpx 20rpx;
  329. display: flex;
  330. justify-content: space-between;
  331. box-shadow: 0 0 6px 0 rgba(84, 84, 84, 0.23);
  332. background: #ffffff;
  333. .left {
  334. display: flex;
  335. align-items: center;
  336. .rank {
  337. flex-shrink: 0;
  338. text-align: center;
  339. .row1 {
  340. font-size: 24rpx;
  341. color: #fe781f;
  342. line-height: 24rpx;
  343. font-weight: 500;
  344. &.big {
  345. font-size: 32rpx;
  346. }
  347. }
  348. .row2 {
  349. font-size: 22rpx;
  350. color: #666666;
  351. line-height: 24rpx;
  352. margin-top: 10rpx;
  353. }
  354. }
  355. image {
  356. width: 100rpx;
  357. height: 100rpx;
  358. display: block;
  359. border-radius: 50%;
  360. flex-shrink: 0;
  361. margin-left: 10rpx;
  362. }
  363. .info {
  364. display: flex;
  365. flex-direction: column;
  366. justify-content: space-between;
  367. margin-left: 20rpx;
  368. height: 100rpx;
  369. .name {
  370. font-size: 28rpx;
  371. color: #333333;
  372. line-height: 32rpx;
  373. }
  374. .text {
  375. font-size: 24rpx;
  376. color: #666666;
  377. line-height: 28rpx;
  378. }
  379. }
  380. }
  381. .right {
  382. flex-shrink: 0;
  383. text-align: right;
  384. display: flex;
  385. flex-direction: column;
  386. justify-content: space-between;
  387. margin-left: 40rpx;
  388. .money {
  389. font-size: 32rpx;
  390. color: #fe781f;
  391. line-height: 32rpx;
  392. font-weight: 500;
  393. }
  394. .report {
  395. font-size: 24rpx;
  396. color: #3f9eff;
  397. line-height: 28rpx;
  398. }
  399. }
  400. }
  401. .list {
  402. margin-top: 20rpx;
  403. .item {
  404. border-bottom: 1px solid #eaeaea;
  405. display: flex;
  406. align-items: center;
  407. padding: 12rpx 0;
  408. .rank {
  409. width: 90rpx;
  410. text-align: center;
  411. font-size: 36rpx;
  412. font-weight: 500;
  413. flex-shrink: 0;
  414. }
  415. image {
  416. width: 100rpx;
  417. height: 100rpx;
  418. display: block;
  419. border-radius: 50%;
  420. flex-shrink: 0;
  421. margin-left: 10rpx;
  422. }
  423. .main {
  424. margin-left: 20rpx;
  425. width: 100%;
  426. height: 80rpx;
  427. display: flex;
  428. flex-direction: column;
  429. justify-content: space-between;
  430. .top {
  431. display: flex;
  432. justify-content: space-between;
  433. align-items: center;
  434. .name {
  435. font-size: 28rpx;
  436. color: #333333;
  437. line-height: 32rpx;
  438. }
  439. .money {
  440. font-size: 32rpx;
  441. color: #fe781f;
  442. line-height: 32rpx;
  443. font-weight: 500;
  444. }
  445. }
  446. .text {
  447. font-size: 24rpx;
  448. color: #666666;
  449. line-height: 28rpx;
  450. width: 490rpx;
  451. }
  452. }
  453. }
  454. }
  455. }
  456. .bottom-container {
  457. text-align: center;
  458. font-size: 24rpx;
  459. line-height: 28rpx;
  460. color: #999999;
  461. padding-top: 30rpx;
  462. padding-bottom: 60rpx;
  463. }
  464. </style>