rank.vue 8.4 KB

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