rank.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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. <home-btn></home-btn>
  122. </view>
  123. </template>
  124. <script>
  125. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  126. import back from '@/components/back.vue'
  127. export default {
  128. mixins: [MescrollMixin],
  129. components: {
  130. back
  131. },
  132. data() {
  133. return {
  134. isH5:false,
  135. downOption: {
  136. auto: false
  137. },
  138. upOption: {
  139. auto: false,
  140. use: true
  141. },
  142. navbarShow: false,
  143. rankList: [],
  144. //搜索关键字
  145. keyword: '',
  146. activeId: '',
  147. }
  148. },
  149. onPageScroll(res) {
  150. if (res.scrollTop > 40) {
  151. this.navbarShow = true
  152. } else {
  153. this.navbarShow = false
  154. }
  155. },
  156. onLoad(options) {
  157. this.activeId = options.activeId
  158. // #ifdef MP-WEIXIN
  159. this.mescroll.resetUpScroll();
  160. // #endif
  161. // #ifdef H5
  162. this.isH5=true
  163. //h5端要延时才能获取到mescroll对象
  164. setTimeout(() => {
  165. this.mescroll.resetUpScroll();
  166. }, 20)
  167. // #endif
  168. },
  169. methods: {
  170. downCallback() {
  171. setTimeout(() => {
  172. this.mescroll.resetUpScroll();
  173. }, 1000)
  174. },
  175. async upCallback(mescroll) {
  176. try {
  177. let params = {
  178. current: mescroll.num,
  179. size: mescroll.size,
  180. activeId: this.activeId
  181. }
  182. this.$api.activity.sortListQuery(params).then(res => {
  183. let data = res.data.data.records
  184. let total = res.data.data.total
  185. mescroll.endBySize(data.length, total);
  186. if (mescroll.num == 1) this.rankList = []; //如果是第一页需手动制空列表
  187. this.rankList = this.rankList.concat(data); //追加新数据
  188. })
  189. } catch (e) {
  190. console.error(e);
  191. this.mescroll.endErr()
  192. }
  193. },
  194. searchWorks(value) {
  195. this.$api.activity.searchWork(value).then(res => {
  196. this.rankList = res.data.data;
  197. })
  198. },
  199. customBack() {
  200. uni.switchTab({
  201. url: "/pages/index/home"
  202. })
  203. }
  204. }
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. .marginTop{
  209. margin-top: -80rpx;
  210. }
  211. .search {
  212. margin-top: -60upx;
  213. width: 80%;
  214. border-radius: 50upx;
  215. line-height: 60upx;
  216. background-color: #FFFFFF;
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. color: #9D9D9D;
  221. font-size: 20upx;
  222. }
  223. .title {
  224. font-size: 52upx;
  225. font-family: PingFang SC;
  226. font-weight: 800;
  227. color: #FFFFFF;
  228. }
  229. .first {
  230. background-color: #FFFBE7;
  231. border-radius: 20upx;
  232. }
  233. .second {
  234. background-color: #F5F3FD;
  235. border-radius: 20upx;
  236. margin: 0 20upx;
  237. }
  238. .third {
  239. background-color: #FFF5F1;
  240. border-radius: 20upx;
  241. margin: 20upx;
  242. }
  243. .container {
  244. .left {
  245. padding-left: 20upx;
  246. .name {
  247. font-size: 32upx;
  248. font-family: PingFang SC;
  249. font-weight: 800;
  250. color: #333;
  251. }
  252. .hot-value {
  253. font-size: 24upx;
  254. font-family: PingFang SC;
  255. font-weight: 400;
  256. color: #353535;
  257. }
  258. }
  259. .right {
  260. text-align: center;
  261. padding-right: 10upx;
  262. .rank {
  263. height: 70%;
  264. font-size: 36upx;
  265. font-family: PingFang SC;
  266. font-weight: 800;
  267. font-style: italic;
  268. }
  269. }
  270. }
  271. .music {
  272. .name {
  273. font-size: 30upx;
  274. font-family: PingFang SC;
  275. font-weight: 400;
  276. color: #000000;
  277. }
  278. .author {
  279. font-size: 14upx;
  280. font-family: PingFang SC;
  281. font-weight: 400;
  282. color: #9A9A9A;
  283. }
  284. .hot-vaule {
  285. margin-top: 10upx;
  286. font-size: 14upx;
  287. font-family: PingFang SC;
  288. font-weight: 400;
  289. color: #3F372A;
  290. }
  291. }
  292. .lines-purple::after {
  293. border-color: #5a3ee8;
  294. }
  295. .lines-purple {
  296. color: #5a3ee8;
  297. }
  298. </style>