rank.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view :style="vuex_skin">
  3. <view class="">
  4. <!-- #ifdef MP-WEIXIN -->
  5. <u-navbar v-show="navbarShow" :custom-back="customBack" title-color="#fff" :border-bottom="false"
  6. back-icon-color="#fff" title="排行榜" :background="{'backgroundColor': '#f03538'}"></u-navbar>
  7. <back v-show="!navbarShow" :custom-back="customBack"></back>
  8. <!-- #endif -->
  9. <view class="bg-img flex-direction flex justify-center"
  10. :class="isH5?'marginTop':''"
  11. style="background-image: url(https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/4872ea85f7e74a75a920135ce1384262-bg.png);height: 380rpx;">
  12. <view class="title" style="padding: 80rpx 0 0 60rpx;">排行榜</view>
  13. </view>
  14. <view class="flex justify-center align-center padding-bottom">
  15. <view class="search">
  16. <u-search @search="searchWorks" v-model="keyword" search-icon="/static/rank/search.png"
  17. :show-action="false" bg-color="#fff" style="width: 100%;" placeholder-color="#CCCCCC">
  18. </u-search>
  19. </view>
  20. </view>
  21. <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
  22. @up="upCallback">
  23. <block v-for="(item, index) in rankList" :key="item.id">
  24. <block v-if="index == 0 || index == 1 || index == 2">
  25. <view class=" flex align-center"
  26. style="height: 230rpx;position: relative;margin: 10rpx 20rpx 20rpx 20rpx;"
  27. :class="index == 0 ? 'first' : index == 1 ? 'second' : index == 2 ? 'third' : '' ">
  28. <view class="" style="width: 220rpx;">
  29. <u-image width="220" height="220" mode="aspectFill" border-radius="10"
  30. :src="item.imgUrl">
  31. </u-image>
  32. </view>
  33. <view class="flex justify-between container" style="width: 100%;">
  34. <view class="left" style="width: 95%;">
  35. <view class="padding-top-20 " style="display: flex;">
  36. <view class="center ">
  37. <view class="cu-tag sm bg-red light radius">
  38. 编号:{{item.productNo}}
  39. </view>
  40. </view>
  41. <view class="center">
  42. <text class="name text-cut-1">{{item.title}}</text>
  43. </view>
  44. </view>
  45. <view class="padding-tb-sm text-sm center"
  46. style="color: #888888;justify-content: flex-start">
  47. <u-avatar :src="item.userImg?item.userImg:'/static/icon/unlogin.png'" size="56">
  48. </u-avatar>
  49. <text class="margin-left-10">{{item.username || '暂无信息'}}</text>
  50. </view>
  51. <view class="flex justify-between">
  52. <view class="hot-value center" style="justify-content: flex-start;">
  53. <image src="../../static/rank/hot.png" style="width: 36rpx;height: 36rpx;"
  54. mode=""></image>
  55. <text style="padding-left: 4rpx;">{{item.voteCount}}</text>
  56. </view>
  57. <button
  58. @click.stop="$jump('/pages/activity/activityDetail?id='+item.id+'&isCustomBack=false')"
  59. class="cu-btn round bg-base sm text-white"
  60. style="padding: 20rpx 38rpx;margin-bottom: 30rpx;">
  61. <text>去投票</text>
  62. </button>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="" style="position: absolute;right: -16rpx;top: -16rpx;">
  67. <image v-if="index==0" style="width: 70rpx;height: 70rpx;"
  68. src="../../static/rank/no1.png" mode=""></image>
  69. <image v-if="index==1" style="width: 70rpx;height: 70rpx;"
  70. src="../../static/rank/no2.png" mode=""></image>
  71. <image v-if="index==2" style="width: 70rpx;height: 70rpx;"
  72. src="../../static/rank/no3.png" mode=""></image>
  73. </view>
  74. </view>
  75. </block>
  76. <view v-else class="flex margin-20">
  77. <view class="center text-bold text-lg" style="margin:0 20rpx;">
  78. <text>{{index + 1}}</text>
  79. </view>
  80. <view class=" flex align-center "
  81. style="background-color: #FFFFFF;border-radius: 20rpx;height: 200rpx;width: 95%;">
  82. <view class="" style="width: 190rpx;">
  83. <u-image width="190" height="190" border-radius="10" :src="item.imgUrl"></u-image>
  84. </view>
  85. <view class="flex justify-between container" style="width: 100%;">
  86. <view class="left" style="width: 95%;">
  87. <view class="flex" style="padding-top: 20rpx;width: 430rpx;">
  88. <view class="cu-tag sm bg-red light radius">
  89. 编号:{{item.productNo}}
  90. </view>
  91. <view class="name text-cut-1" style="font-size: 28rpx;font-weight: 600;">
  92. {{item.title}}
  93. </view>
  94. </view>
  95. <view class="padding-top-20 text-sm center"
  96. style="color: #888888;justify-content: flex-start">
  97. <u-avatar :src="item.userImg?item.userImg:'/static/icon/unlogin.png'" size="56">
  98. </u-avatar>
  99. <text class="margin-left-10">{{item.username || '暂无信息'}}</text>
  100. </view>
  101. <view class="flex justify-between">
  102. <view class="hot-value center" style="justify-content: flex-start;">
  103. <image src="../../static/rank/hot.png" style="width: 36rpx;height: 36rpx;"
  104. mode=""></image>
  105. <text style="padding-left: 4rpx;">{{item.voteCount}}</text>
  106. </view>
  107. <button
  108. @click.stop="$jump('/pages/activity/activityDetail?id='+item.id+'&isCustomBack=false')"
  109. class="cu-btn round bg-base sm text-white"
  110. style="padding: 20rpx 38rpx;margin-bottom: 30rpx;">
  111. <text>去投票</text>
  112. </button>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </block>
  119. </mescroll-body>
  120. </view>
  121. </view>
  122. </template>
  123. <script>
  124. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  125. import back from '@/components/back.vue'
  126. export default {
  127. mixins: [MescrollMixin],
  128. components: {
  129. back
  130. },
  131. data() {
  132. return {
  133. isH5:false,
  134. downOption: {
  135. auto: false
  136. },
  137. upOption: {
  138. auto: false,
  139. use: true
  140. },
  141. navbarShow: false,
  142. rankList: [],
  143. //搜索关键字
  144. keyword: '',
  145. activeId: '',
  146. }
  147. },
  148. onPageScroll(res) {
  149. if (res.scrollTop > 40) {
  150. this.navbarShow = true
  151. } else {
  152. this.navbarShow = false
  153. }
  154. },
  155. onLoad(options) {
  156. this.activeId = options.activeId
  157. // #ifdef MP-WEIXIN
  158. this.mescroll.resetUpScroll();
  159. // #endif
  160. // #ifdef H5
  161. this.isH5=true
  162. //h5端要延时才能获取到mescroll对象
  163. setTimeout(() => {
  164. this.mescroll.resetUpScroll();
  165. }, 20)
  166. // #endif
  167. },
  168. methods: {
  169. downCallback() {
  170. setTimeout(() => {
  171. this.mescroll.resetUpScroll();
  172. }, 1000)
  173. },
  174. async upCallback(mescroll) {
  175. try {
  176. let params = {
  177. current: mescroll.num,
  178. size: mescroll.size,
  179. activeId: this.activeId
  180. }
  181. this.$api.activity.sortListQuery(params).then(res => {
  182. let data = res.data.data.records
  183. let total = res.data.data.total
  184. mescroll.endBySize(data.length, total);
  185. if (mescroll.num == 1) this.rankList = []; //如果是第一页需手动制空列表
  186. this.rankList = this.rankList.concat(data); //追加新数据
  187. })
  188. } catch (e) {
  189. console.error(e);
  190. this.mescroll.endErr()
  191. }
  192. },
  193. searchWorks(value) {
  194. this.$api.activity.searchWork(value).then(res => {
  195. this.rankList = res.data.data;
  196. })
  197. },
  198. customBack() {
  199. uni.switchTab({
  200. url: "/pages/index/home"
  201. })
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .marginTop{
  208. margin-top: -80rpx;
  209. }
  210. .search {
  211. margin-top: -60upx;
  212. width: 80%;
  213. border-radius: 50upx;
  214. line-height: 60upx;
  215. background-color: #FFFFFF;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. color: #9D9D9D;
  220. font-size: 20upx;
  221. }
  222. .title {
  223. font-size: 52upx;
  224. font-family: PingFang SC;
  225. font-weight: 800;
  226. color: #FFFFFF;
  227. }
  228. .first {
  229. background-color: #FFFBE7;
  230. border-radius: 20upx;
  231. }
  232. .second {
  233. background-color: #F5F3FD;
  234. border-radius: 20upx;
  235. margin: 0 20upx;
  236. }
  237. .third {
  238. background-color: #FFF5F1;
  239. border-radius: 20upx;
  240. margin: 20upx;
  241. }
  242. .container {
  243. .left {
  244. padding-left: 20upx;
  245. .name {
  246. font-size: 32upx;
  247. font-family: PingFang SC;
  248. font-weight: 800;
  249. color: #333;
  250. }
  251. .hot-value {
  252. font-size: 24upx;
  253. font-family: PingFang SC;
  254. font-weight: 400;
  255. color: #353535;
  256. }
  257. }
  258. .right {
  259. text-align: center;
  260. padding-right: 10upx;
  261. .rank {
  262. height: 70%;
  263. font-size: 36upx;
  264. font-family: PingFang SC;
  265. font-weight: 800;
  266. font-style: italic;
  267. }
  268. }
  269. }
  270. .music {
  271. .name {
  272. font-size: 30upx;
  273. font-family: PingFang SC;
  274. font-weight: 400;
  275. color: #000000;
  276. }
  277. .author {
  278. font-size: 14upx;
  279. font-family: PingFang SC;
  280. font-weight: 400;
  281. color: #9A9A9A;
  282. }
  283. .hot-vaule {
  284. margin-top: 10upx;
  285. font-size: 14upx;
  286. font-family: PingFang SC;
  287. font-weight: 400;
  288. color: #3F372A;
  289. }
  290. }
  291. .lines-purple::after {
  292. border-color: #5a3ee8;
  293. }
  294. .lines-purple {
  295. color: #5a3ee8;
  296. }
  297. </style>