rank.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view :style="vuex_skin">
  3. <view class="" v-show="!loading">
  4. <u-navbar v-show="navbarShow" title-color="#fff" :border-bottom="false" back-icon-color="#fff" title="排行榜"
  5. :background="{'backgroundColor': '#f03538'}"></u-navbar>
  6. <back v-show="!navbarShow"></back>
  7. <view class="bg-img flex-direction flex justify-center "
  8. style="background-image: url(https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/4872ea85f7e74a75a920135ce1384262-bg.png);height: 380rpx;">
  9. <view class="title" style="padding: 80rpx 0 0 60rpx;">排行榜</view>
  10. </view>
  11. <view class="flex justify-center align-center padding-bottom">
  12. <view class="search">
  13. <u-search search-icon="/static/rank/search.png" :show-action="false" bg-color="#fff"
  14. style="width: 100%;" placeholder-color="#CCCCCC"></u-search>
  15. </view>
  16. </view>
  17. <block v-for="(item, index) in 20" :key="index">
  18. <block v-if="index == 0 || index == 1 || index == 2">
  19. <view class=" flex align-center"
  20. style="height: 230rpx;position: relative;margin: 10rpx 20rpx 20rpx 20rpx;"
  21. :class="index == 0 ? 'first' : index == 1 ? 'second' : index == 2 ? 'third' : '' ">
  22. <u-image width="220" height="220" border-radius="10" src="/static/test/test.png"></u-image>
  23. <view class="flex justify-between container" style="width: 100%;">
  24. <view class="left" style="width: 95%;">
  25. <view class="name text-cut">小学生法律小知识</view>
  26. <view class="padding-tb-sm text-sm center"
  27. style="color: #888888;justify-content: flex-start">
  28. <u-avatar src="/static/test/avatar.png" size="56"></u-avatar>
  29. <text class="margin-left-10">一只可乐喵</text>
  30. </view>
  31. <view class="flex justify-between">
  32. <view class="hot-value center" style="justify-content: flex-start;">
  33. <image src="../../static/rank/hot.png" style="width: 36rpx;height: 36rpx;"
  34. mode=""></image>
  35. <text>3085</text>
  36. </view>
  37. <button class="cu-btn round bg-base sm text-white"
  38. style="padding: 20rpx 38rpx;margin-bottom: 30rpx;">
  39. <text>去投票</text>
  40. </button>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="" style="position: absolute;right: -16rpx;top: -16rpx;">
  45. <image v-if="index==0" style="width: 70rpx;height: 70rpx;" src="../../static/rank/no1.png"
  46. mode=""></image>
  47. <image v-if="index==1" style="width: 70rpx;height: 70rpx;" src="../../static/rank/no2.png"
  48. mode=""></image>
  49. <image v-if="index==2" style="width: 70rpx;height: 70rpx;" src="../../static/rank/no3.png"
  50. mode=""></image>
  51. </view>
  52. </view>
  53. </block>
  54. <view v-else class="flex margin-20">
  55. <view class="center text-bold text-lg" style="margin:0 20rpx;">
  56. <text>{{index + 1}}</text>
  57. </view>
  58. <view class=" flex align-center "
  59. style="background-color: #FFFFFF;border-radius: 20rpx;height: 200rpx;width: 95%;">
  60. <u-image width="190" height="190" border-radius="10" src="/static/test/test.png"></u-image>
  61. <view class="flex justify-between container" style="width: 100%;">
  62. <view class="left" style="width: 95%;">
  63. <view class="name text-cut"
  64. style="font-size: 28rpx;font-weight: 600;padding-top: 20rpx;">小学生法律小知识</view>
  65. <view class="padding-top-20 text-sm center"
  66. style="color: #888888;justify-content: flex-start">
  67. <u-avatar src="/static/test/avatar.png" size="56"></u-avatar>
  68. <text class="margin-left-10">一只可乐喵</text>
  69. </view>
  70. <view class="flex justify-between">
  71. <view class="hot-value center" style="justify-content: flex-start;">
  72. <image src="../../static/rank/hot.png" style="width: 36rpx;height: 36rpx;"
  73. mode=""></image>
  74. <text>3085</text>
  75. </view>
  76. <button class="cu-btn round bg-base sm text-white"
  77. style="padding: 20rpx 38rpx;margin-bottom: 30rpx;">
  78. <text>去投票</text>
  79. </button>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </block>
  86. </view>
  87. <loading ref="loading" type="3" theme="2" />
  88. </view>
  89. </template>
  90. <script>
  91. import back from '@/components/back.vue'
  92. export default {
  93. components:{
  94. back
  95. },
  96. data() {
  97. return {
  98. loading: true,
  99. navbarShow: false,
  100. rankList: [],
  101. //搜索关键字
  102. keyword: '',
  103. }
  104. },
  105. watch: {
  106. keyword() {
  107. let that = this
  108. //节流函数
  109. if (this.timer) {
  110. clearTimeout(this.timer) //阻止setTimeout函数的执行
  111. }
  112. this.timer = setTimeout(() => {
  113. that.pageCurrent = 1
  114. that.rankList = []
  115. that.getRankList()
  116. }, 700)
  117. },
  118. },
  119. onPageScroll(res) {
  120. if (res.scrollTop > 40) {
  121. this.navbarShow = true
  122. } else {
  123. this.navbarShow = false
  124. }
  125. },
  126. onLoad(options) {
  127. this.$refs.loading.showLoading()
  128. setTimeout(() => {
  129. this.loading = false
  130. this.$refs.loading.hide()
  131. }, 500)
  132. },
  133. methods: {
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .search {
  139. margin-top: -60upx;
  140. width: 80%;
  141. border-radius: 50upx;
  142. line-height: 60upx;
  143. background-color: #FFFFFF;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. color: #9D9D9D;
  148. font-size: 20upx;
  149. }
  150. .title {
  151. font-size: 52upx;
  152. font-family: PingFang SC;
  153. font-weight: 800;
  154. color: #FFFFFF;
  155. }
  156. .first {
  157. background-color: #FFFBE7;
  158. border-radius: 20upx;
  159. }
  160. .second {
  161. background-color: #F5F3FD;
  162. border-radius: 20upx;
  163. margin: 0 20upx;
  164. }
  165. .third {
  166. background-color: #FFF5F1;
  167. border-radius: 20upx;
  168. margin: 20upx;
  169. }
  170. .container {
  171. .left {
  172. padding-left: 20upx;
  173. .name {
  174. padding-top: 30rpx;
  175. font-size: 32upx;
  176. font-family: PingFang SC;
  177. font-weight: 800;
  178. color: #333;
  179. }
  180. .hot-value {
  181. font-size: 24upx;
  182. font-family: PingFang SC;
  183. font-weight: 400;
  184. color: #353535;
  185. }
  186. }
  187. .right {
  188. text-align: center;
  189. padding-right: 10upx;
  190. .rank {
  191. height: 70%;
  192. font-size: 36upx;
  193. font-family: PingFang SC;
  194. font-weight: 800;
  195. font-style: italic;
  196. }
  197. }
  198. }
  199. .music {
  200. .name {
  201. font-size: 30upx;
  202. font-family: PingFang SC;
  203. font-weight: 400;
  204. color: #000000;
  205. }
  206. .author {
  207. font-size: 14upx;
  208. font-family: PingFang SC;
  209. font-weight: 400;
  210. color: #9A9A9A;
  211. }
  212. .hot-vaule {
  213. margin-top: 10upx;
  214. font-size: 14upx;
  215. font-family: PingFang SC;
  216. font-weight: 400;
  217. color: #3F372A;
  218. }
  219. }
  220. .lines-purple::after {
  221. border-color: #5a3ee8;
  222. }
  223. .lines-purple {
  224. color: #5a3ee8;
  225. }
  226. </style>