rank.vue 9.6 KB

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