songRank.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view>
  3. <view class="bg-img flex justify-center align-center"
  4. style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/97d63ec49f544a33a6a8cc3c0b64b17a-songRankBgImg.png');height: 402upx;">
  5. <view class="title">歌曲排行榜</view>
  6. </view>
  7. <view class="flex justify-center align-center padding-bottom">
  8. <view class="search">
  9. <u-input confirm-type="search" v-model="keyword" style="margin: 0 20rpx;" placeholder="请输入搜索内容" />
  10. </view>
  11. </view>
  12. <u-sticky h5-nav-height="0">
  13. <u-tabs :list="list" active-color="#5c40e8" :bold="false" :is-scroll="false" :current="current"
  14. @change="change"></u-tabs>
  15. </u-sticky>
  16. <view class="flex align-center padding-left" style="margin-top: 40upx;">
  17. <image src="/static/songRank/medal.png" style="width: 32upx;height: 40upx"></image>
  18. <view style="font-size: 36upx;font-weight: 800;color: #000000;padding-left: 20upx;">提名歌曲</view>
  19. </view>
  20. <block v-for="(item, index) in rankList" :key="index">
  21. <block v-if="index == 0 || index == 1 || index == 2">
  22. <view class="margin-sm flex align-center"
  23. :class="index == 0 ? 'first' : index == 1 ? 'second' : index == 2 ? 'third' : '' "
  24. @click="musicBoost(item.production.id)">
  25. <u-image width="200" height="200" border-radius="16" :src="item.production.cover"
  26. v-if="item.production.urlsType==1"></u-image>
  27. <u-image width="200" height="200" border-radius="16" :src="item.production.urls" v-else></u-image>
  28. <view class="flex justify-between container"
  29. :style="{width: (index == 0 ? '70%': index == 1 ? '69%' : index == 2 ? '68%' : '60%')}">
  30. <view class="left" style="width: 65%;">
  31. <view class="name text-cut">{{item.production.title}}</view>
  32. <view class="padding-tb-sm text-sm">{{item.production.personName}}</view>
  33. <view class="hot-value">热力值 {{ +item.production.hotValue}}</view>
  34. </view>
  35. <view class="right">
  36. <view class="rank"
  37. :style="{coloar: (index == 0 ? '#ECDA47': index == 1 ? '#C1D4DA' : index == 2 ? '#C1D4DA' : '')}">
  38. NO.{{item.rank}}
  39. </view>
  40. <view>
  41. <button class="cu-btn round theme-bg-color sm text-white">
  42. <text class="cuIcon-hotfill"></text>
  43. <text class="padding-left-xs">打榜</text>
  44. </button>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </block>
  50. <block v-else>
  51. <view class="flex" style="padding: 10upx 30upx 30upx 40upx;" @click="musicBoost(item.production.id)">
  52. <view class="flex justify-center align-center text-bold text-lg padding-right">{{item.rank}}</view>
  53. <image v-if="item.production.urlsType==1" :src="item.production.cover"
  54. style="width: 120upx;height: 120upx;margin-right: 20upx;"></image>
  55. <image v-else :src="item.production.urls" style="width: 120upx;height: 120upx;margin-right: 20upx;">
  56. </image>
  57. <view style="width: 70%;">
  58. <view class="flex justify-between">
  59. <view class="music" style="width: 75%;">
  60. <view class="name text-cut">{{item.production.title}}</view>
  61. <view class="author">{{item.production.personName}}</view>
  62. <view class="hot-vaule">热力值 {{ +item.production.hotValue}}</view>
  63. </view>
  64. <view class="flex align-end">
  65. <button class="cu-btn round lines-purple sm" style="width: 110upx;">打榜</button>
  66. </view>
  67. </view>
  68. <view class="margin-top-xs">
  69. <u-line color="#cacaca"></u-line>
  70. </view>
  71. </view>
  72. </view>
  73. </block>
  74. </block>
  75. <u-loadmore :status="status" v-if="rankList.length>4"/>
  76. <view class="padding-top">
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. activityId: '',
  85. current: 0,
  86. list: [{
  87. name: '全部'
  88. }],
  89. rankList: [],
  90. //搜索关键字
  91. keyword: '',
  92. name: '', //榜单搜索
  93. //分页
  94. status: 'loadmore',
  95. pageCurrent: 1,
  96. pageSize: 10,
  97. }
  98. },
  99. watch: {
  100. keyword() {
  101. let that = this
  102. //节流函数
  103. if (this.timer) {
  104. clearTimeout(this.timer) //阻止setTimeout函数的执行
  105. }
  106. this.timer = setTimeout(() => {
  107. that.pageCurrent = 1
  108. that.rankList = []
  109. that.getRankList()
  110. }, 500)
  111. },
  112. },
  113. onLoad(options) {
  114. this.activityId = options.activityId;
  115. this.getActivityDetail()
  116. this.getRankList()
  117. },
  118. onReachBottom() {
  119. if (this.rankList.length < this.pageCurrent * 10) {
  120. this.status = 'nomore';
  121. return
  122. } else {
  123. this.status = 'loading';
  124. this.pageCurrent = ++this.pageCurrent;
  125. this.getRankList()
  126. }
  127. },
  128. methods: {
  129. change(index) {
  130. this.current = index;
  131. let name = this.list[index].name.replace("榜", '')
  132. if (name == '全部') {
  133. name = ""
  134. }
  135. this.rankList=[]
  136. this.name = name
  137. this.getRankList()
  138. },
  139. getActivityDetail() {
  140. this.$u.api.activity.detail({
  141. id: this.activityId
  142. }).then(res => {
  143. let arr = res.classification.split(",")
  144. arr.forEach(item => {
  145. let obj = {
  146. name: item + '榜'
  147. }
  148. this.list.push(obj)
  149. })
  150. })
  151. },
  152. getRankList(name) {
  153. let params = {
  154. type: 1,
  155. activityId: this.activityId,
  156. current: this.pageCurrent,
  157. size: this.pageSize
  158. }
  159. if (!this.$u.test.empty(this.name)) {
  160. params.productionType = this.name
  161. }
  162. if (!this.$u.test.empty(this.keyword)) {
  163. params.productionSearch = this.keyword
  164. }
  165. this.$u.api.production.getRankList(params).then(res => {
  166. this.rankList = [...this.rankList,...res.records]
  167. })
  168. },
  169. musicBoost(id) {
  170. uni.navigateTo({
  171. url: "/pages/activityList/activity/musicBoost?id=" + id
  172. })
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .search {
  179. margin-top: -40upx;
  180. width: 80%;
  181. border-radius: 50upx;
  182. line-height: 60upx;
  183. background-color: #FFFFFF;
  184. display: flex;
  185. justify-content: center;
  186. align-items: center;
  187. color: #9D9D9D;
  188. font-size: 20upx;
  189. box-shadow: 10upx 20upx 60upx #d8d8d8;
  190. }
  191. .title {
  192. font-size: 56upx;
  193. font-family: PingFang SC;
  194. font-weight: 800;
  195. color: #FFFFFF;
  196. }
  197. .first {
  198. background-color: #fbf8e5;
  199. border-radius: 20upx;
  200. box-shadow: -1upx -1upx 60upx #d8d8d8;
  201. }
  202. .second {
  203. background-color: #f0f5f9;
  204. border-radius: 20upx;
  205. box-shadow: -1upx -1upx 60upx #d8d8d8;
  206. margin: 0 30upx;
  207. }
  208. .third {
  209. background-color: #fef0ef;
  210. border-radius: 20upx;
  211. box-shadow: -1upx -1upx 60upx #d8d8d8;
  212. margin: 20upx 40upx;
  213. }
  214. .container {
  215. .left {
  216. padding-left: 20upx;
  217. .name {
  218. font-size: 30upx;
  219. font-family: PingFang SC;
  220. font-weight: 800;
  221. color: #000000;
  222. }
  223. .hot-value {
  224. font-size: 24upx;
  225. font-family: PingFang SC;
  226. font-weight: 400;
  227. color: #3F372A;
  228. }
  229. }
  230. .right {
  231. text-align: center;
  232. padding-right: 10upx;
  233. .rank {
  234. height: 70%;
  235. font-size: 36upx;
  236. font-family: PingFang SC;
  237. font-weight: 800;
  238. font-style: italic;
  239. }
  240. }
  241. }
  242. .music {
  243. .name {
  244. font-size: 30upx;
  245. font-family: PingFang SC;
  246. font-weight: 400;
  247. color: #000000;
  248. }
  249. .author {
  250. font-size: 14upx;
  251. font-family: PingFang SC;
  252. font-weight: 400;
  253. color: #9A9A9A;
  254. }
  255. .hot-vaule {
  256. margin-top: 10upx;
  257. font-size: 14upx;
  258. font-family: PingFang SC;
  259. font-weight: 400;
  260. color: #3F372A;
  261. }
  262. }
  263. .lines-purple::after {
  264. border-color: #5a3ee8;
  265. }
  266. .lines-purple {
  267. color: #5a3ee8;
  268. }
  269. </style>