activity-view.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view>
  3. <view class="searchBar">
  4. <search-bar :disabled="true" @onNavigator="navByIcon('/pages/activityList/activity/hot', 2)"></search-bar>
  5. </view>
  6. <view class="padding-tb bg-white">
  7. <u-image width="100%" height="350" :src="activity.cover" @click="navByIcon('/pages/activityList/activity/activityDetail', 0)"></u-image>
  8. </view>
  9. <view class="flex justify-around text-center padding-tb bg-white">
  10. <block v-for="(item,index) in icons" :key="index">
  11. <view @click="navByIcon(item.url, index)">
  12. <image :src="item.image" style="width: 80upx;height: 80upx;"></image>
  13. <view class="margin-top-xs text-sm text-bold">{{item.name}}</view>
  14. </view>
  15. </block>
  16. </view>
  17. <view class="margin-top-sm bg-white flex justify-around align-end" style="height: 350upx;">
  18. <view class="second text-center" @click="navWithParm(rankList[1].userId)" v-if="!$u.test.isEmpty(rankList[1])">
  19. <view class="margin-top-sm">
  20. <u-avatar :src="rankList[1].avatar" size="120"></u-avatar>
  21. </view>
  22. <view class="text-bold text-lg text-black">{{rankList[1].totalHotValue}}</view>
  23. <view class="flex justify-center">
  24. <view class="hot-btn margin-top-xs">
  25. <text class="cuIcon-hotfill padding-right-xs"></text>
  26. <text>打榜</text>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="first text-center" @click="navWithParm(rankList[0].userId)" v-if="!$u.test.isEmpty(rankList[0])">
  31. <view class="margin-top-sm">
  32. <u-avatar :src="rankList[0].avatar" size="130"></u-avatar>
  33. </view>
  34. <view class="margin-top-xs text-bold text-lg text-black">{{rankList[0].totalHotValue}}</view>
  35. <view class="flex justify-center">
  36. <view class="hot-btn margin-top-xs">
  37. <text class="cuIcon-hotfill padding-right-xs"></text>
  38. <text>打榜</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="third text-center" @click="navWithParm(rankList[2].userId)" v-if="!$u.test.isEmpty(rankList[2])">
  43. <view class="margin-top-sm">
  44. <u-avatar :src="rankList[2].avatar" size="120"></u-avatar>
  45. </view>
  46. <view class="text-bold text-lg text-black">{{rankList[2].totalHotValue}}</view>
  47. <view class="flex justify-center">
  48. <view class="hot-btn margin-top-xs">
  49. <text class="cuIcon-hotfill padding-right-xs"></text>
  50. <text>打榜</text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <block v-for="(item, index) in rankList.slice(3, rankList.length + 1)" :key="index">
  56. <view class="padding-sm flex justify-between align-center bg-white" @click="navWithParm(item.userId)">
  57. <view class="flex justify-around align-center">
  58. <view class="padding-right text-black text-bold">{{index + 4}}</view>
  59. <view class="padding-right">
  60. <u-avatar :src="item.avatar" size="130"></u-avatar>
  61. </view>
  62. <view>
  63. <view class="text-bold text-black">{{item.name}}</view>
  64. <view class="margin-tb-xs">{{item.totalHotValue}} 热力值</view>
  65. </view>
  66. </view>
  67. <view class="padding-right">
  68. <button class="cu-btn round text-white" style="background-color: #583ce6;height: 68upx;">
  69. <text class="cuIcon-hotfill padding-right-xs"></text>
  70. <text>打榜</text>
  71. </button>
  72. </view>
  73. </view>
  74. </block>
  75. <view class="text-center bg-white" style="line-height: 80upx;" @click="navByIcon('/pages/activityList/activity/hot', 2)" v-if="!$u.test.isEmpty(rankList)">
  76. <text class="text-bold text-black">全部歌手</text>
  77. <text class="cuIcon-right"></text>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import {authUrl} from '@/common/conf/config.js'
  83. import searchBar from "@/components/basic/search-bar.vue";
  84. export default {
  85. components: {
  86. searchBar,
  87. },
  88. props: {
  89. activityId: {
  90. type: String,
  91. default: ''
  92. },
  93. imgList: {
  94. type: Array,
  95. default() {
  96. return []
  97. }
  98. },
  99. },
  100. data() {
  101. return {
  102. icons: [
  103. {image: '/static/song.png', name: '活动介绍', url: '/pages/activityList/activity/activityDetail'},
  104. {image: '/static/signUp.png', name: '点击报名', url: '/pages/activityList/activity/signUp'},
  105. {image: '/static/hot.png', name: '热度榜', url: '/pages/activityList/activity/hot'},
  106. {image: '/static/activity.png', name: '我的奖金', url: '/pages/activityList/activity/awards'},
  107. {image: '/static/more.png', name: '更多', url: '/pages/activityList/activity/songRank'},
  108. ],
  109. activity: {},
  110. rankList: [],
  111. }
  112. },
  113. mounted() {
  114. this.getRankList();
  115. this.getActivityDetail();
  116. },
  117. methods: {
  118. getActivityDetail() {
  119. this.$u.api.activity.detail({id: this.activityId}).then(res => {
  120. this.activity = res;
  121. })
  122. },
  123. getRankList() {
  124. this.$u.api.activity.rankList({activityId: this.activityId}).then(res => {
  125. this.rankList = res.records;
  126. })
  127. },
  128. navByIcon(path, index) {
  129. let url;
  130. if (index == 0) { //图片 和 活动详情
  131. url = path + "?poster=" + this.activity.poster;
  132. }
  133. if (index == 1) { //报名
  134. url = path + "?activityId=" + this.activityId;
  135. }
  136. if (index == 2) { //热榜
  137. let userId = uni.getStorageSync("userId")
  138. if (this.$u.test.isEmpty(userId)) {
  139. window.location.href = authUrl(this.activityId);
  140. } else {
  141. url = path + "?activityId=" + this.activityId;
  142. }
  143. }
  144. if (index == 3) { //我的奖金
  145. url = path;
  146. }
  147. if (index == 4) { //更多
  148. url = path;
  149. }
  150. uni.navigateTo({
  151. url: url,
  152. })
  153. },
  154. //跳转需要带惨方法
  155. navWithParm(id) {
  156. uni.navigateTo({
  157. url: "/pages/activityList/activity/boost?activityId=" + this.activityId + "&receiverId=" + id,
  158. })
  159. },
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .first {
  165. height: 300upx;
  166. width: 30%;
  167. border-radius: 30upx;
  168. box-shadow: -1upx -1upx 60upx #d8d8d8;
  169. }
  170. .second {
  171. height: 260upx;
  172. width: 27%;
  173. border-radius: 30upx;
  174. box-shadow: -1upx -1upx 60upx #d8d8d8;
  175. }
  176. .third {
  177. height: 260upx;
  178. width: 27%;
  179. border-radius: 30upx;
  180. box-shadow: -1upx -1upx 60upx #d8d8d8;
  181. }
  182. .hot-btn {
  183. color: #FFFFFF;
  184. line-height: 56upx;
  185. width: 70%;
  186. border-radius: 30upx;
  187. background-color: #583ce6;
  188. font-weight: bold;
  189. }
  190. </style>