songRank.vue 7.5 KB

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