rank.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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="searchWorks" 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 rankList" :key="item.id">
  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="item.imgUrl"></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 ">{{item.title}}</view>
  26. <view class="padding-tb-sm text-sm center"
  27. style="color: #888888;justify-content: flex-start">
  28. <u-avatar :src="item.userImg?item.userImg:'/static/icon/unlogin.png'" size="56"></u-avatar>
  29. <text class="margin-left-10">{{item.username || '暂无信息'}}</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>{{item.voteCount}}</text>
  36. </view>
  37. <button
  38. @click.stop="$jump('/pages/activity/activityDetail?id='+item.id)"
  39. class="cu-btn round bg-base sm text-white"
  40. style="padding: 20rpx 38rpx;margin-bottom: 30rpx;">
  41. <text>去投票</text>
  42. </button>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="" style="position: absolute;right: -16rpx;top: -16rpx;">
  47. <image v-if="index==0" style="width: 70rpx;height: 70rpx;" src="../../static/rank/no1.png"
  48. mode=""></image>
  49. <image v-if="index==1" style="width: 70rpx;height: 70rpx;" src="../../static/rank/no2.png"
  50. mode=""></image>
  51. <image v-if="index==2" style="width: 70rpx;height: 70rpx;" src="../../static/rank/no3.png"
  52. mode=""></image>
  53. </view>
  54. </view>
  55. </block>
  56. <view v-else class="flex margin-20">
  57. <view class="center text-bold text-lg" style="margin:0 20rpx;">
  58. <text>{{index + 1}}</text>
  59. </view>
  60. <view class=" flex align-center "
  61. style="background-color: #FFFFFF;border-radius: 20rpx;height: 200rpx;width: 95%;">
  62. <u-image width="190" height="190" border-radius="10" :src="item.imgUrl"></u-image>
  63. <view class="flex justify-between container" style="width: 100%;">
  64. <view class="left" style="width: 95%;">
  65. <view class="name text-cut "
  66. style="font-size: 28rpx;font-weight: 600;padding-top: 20rpx;width: 430rpx;">{{item.title}}</view>
  67. <view class="padding-top-20 text-sm center"
  68. style="color: #888888;justify-content: flex-start">
  69. <u-avatar :src="item.userImg?item.userImg:'/static/icon/unlogin.png'" size="56"></u-avatar>
  70. <text class="margin-left-10">{{item.username || '暂无信息'}}</text>
  71. </view>
  72. <view class="flex justify-between">
  73. <view class="hot-value center" style="justify-content: flex-start;">
  74. <image src="../../static/rank/hot.png" style="width: 36rpx;height: 36rpx;"
  75. mode=""></image>
  76. <text>{{item.voteCount}}</text>
  77. </view>
  78. <button
  79. @click.stop="$jump('/pages/activity/activityDetail?id='+item.id)"
  80. class="cu-btn round bg-base sm text-white"
  81. style="padding: 20rpx 38rpx;margin-bottom: 30rpx;">
  82. <text>去投票</text>
  83. </button>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </block>
  90. </view>
  91. <loading ref="loading" type="3" theme="2" />
  92. </view>
  93. </template>
  94. <script>
  95. import back from '@/components/back.vue'
  96. export default {
  97. components:{
  98. back
  99. },
  100. data() {
  101. return {
  102. loading: true,
  103. navbarShow: false,
  104. rankList: [],
  105. //搜索关键字
  106. keyword: '',
  107. }
  108. },
  109. watch: {
  110. keyword() {
  111. let that = this
  112. //节流函数
  113. if (this.timer) {
  114. clearTimeout(this.timer) //阻止setTimeout函数的执行
  115. }
  116. this.timer = setTimeout(() => {
  117. that.pageCurrent = 1
  118. that.rankList = []
  119. that.getRankList()
  120. }, 700)
  121. },
  122. },
  123. onPageScroll(res) {
  124. if (res.scrollTop > 40) {
  125. this.navbarShow = true
  126. } else {
  127. this.navbarShow = false
  128. }
  129. },
  130. onLoad(options) {
  131. this.$refs.loading.showLoading()
  132. setTimeout(() => {
  133. this.loading = false
  134. this.$refs.loading.hide()
  135. }, 500)
  136. this.getList(0);
  137. },
  138. methods: {
  139. getList(page){
  140. const { defaultActiveId:activeId ,rankTotal }= this.$store.state['vuex_active_setting'];
  141. this.$api.activity.getWorksList({ activeId , start: page,end: page+rankTotal }).then(res => {
  142. this.rankList.push(...res.data.data);
  143. });
  144. },
  145. searchWorks(value){
  146. this.$api.activity.searchWork(value).then(res => {
  147. this.rankList = res.data.data;
  148. })
  149. }
  150. }
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. .search {
  155. margin-top: -60upx;
  156. width: 80%;
  157. border-radius: 50upx;
  158. line-height: 60upx;
  159. background-color: #FFFFFF;
  160. display: flex;
  161. justify-content: center;
  162. align-items: center;
  163. color: #9D9D9D;
  164. font-size: 20upx;
  165. }
  166. .title {
  167. font-size: 52upx;
  168. font-family: PingFang SC;
  169. font-weight: 800;
  170. color: #FFFFFF;
  171. }
  172. .first {
  173. background-color: #FFFBE7;
  174. border-radius: 20upx;
  175. }
  176. .second {
  177. background-color: #F5F3FD;
  178. border-radius: 20upx;
  179. margin: 0 20upx;
  180. }
  181. .third {
  182. background-color: #FFF5F1;
  183. border-radius: 20upx;
  184. margin: 20upx;
  185. }
  186. .container {
  187. .left {
  188. padding-left: 20upx;
  189. .name {
  190. padding-top: 30rpx;
  191. font-size: 32upx;
  192. font-family: PingFang SC;
  193. font-weight: 800;
  194. color: #333;
  195. }
  196. .hot-value {
  197. font-size: 24upx;
  198. font-family: PingFang SC;
  199. font-weight: 400;
  200. color: #353535;
  201. }
  202. }
  203. .right {
  204. text-align: center;
  205. padding-right: 10upx;
  206. .rank {
  207. height: 70%;
  208. font-size: 36upx;
  209. font-family: PingFang SC;
  210. font-weight: 800;
  211. font-style: italic;
  212. }
  213. }
  214. }
  215. .music {
  216. .name {
  217. font-size: 30upx;
  218. font-family: PingFang SC;
  219. font-weight: 400;
  220. color: #000000;
  221. }
  222. .author {
  223. font-size: 14upx;
  224. font-family: PingFang SC;
  225. font-weight: 400;
  226. color: #9A9A9A;
  227. }
  228. .hot-vaule {
  229. margin-top: 10upx;
  230. font-size: 14upx;
  231. font-family: PingFang SC;
  232. font-weight: 400;
  233. color: #3F372A;
  234. }
  235. }
  236. .lines-purple::after {
  237. border-color: #5a3ee8;
  238. }
  239. .lines-purple {
  240. color: #5a3ee8;
  241. }
  242. </style>