rank.vue 8.9 KB

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