activity-view.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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].id)" 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].score}}</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].id)" 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].score}}</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].id)" 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].score}}</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.id)">
  57. <view class="flex justify-around align-center">
  58. <view class="padding-right text-black text-bold">{{item.rank}}</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.nickName}}</view>
  64. <view class="margin-tb-xs">{{+item.score}} 热力值</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. let params={
  125. activityId:this.activityId,
  126. type:0,//选手排名
  127. current:1,
  128. size:20
  129. }
  130. this.$u.api.activity.rankList(params).then(res => {
  131. this.rankList = res.records;
  132. })
  133. },
  134. navByIcon(path, index) {
  135. let url;
  136. if (index == 0) { //图片 和 活动详情
  137. url = path + "?poster=" + this.activity.poster;
  138. }
  139. if (index == 1) { //报名
  140. let changeTime = new Date() - Date.parse(this.activity.applyEndTime.replace(/-/g, '/'));//时间戳差值
  141. if (changeTime > 0) { //检查活动是否已经停止报名
  142. uni.showToast({
  143. icon: "none",
  144. title: "报名已结束"
  145. })
  146. return;
  147. } else {
  148. let userId = uni.getStorageSync("userId")
  149. if (this.$u.test.isEmpty(userId)) { //是否已经登录
  150. let param = "pages/activityList/home/home?activityId=" + this.activityId;
  151. window.location.href = authUrl(param);
  152. } else {
  153. url = path + "?activityId=" + this.activityId;
  154. }
  155. }
  156. }
  157. if (index == 2) { //热榜
  158. url = path + "?activityId=" + this.activityId;
  159. }
  160. if (index == 3) { //我的奖金
  161. url = path;
  162. }
  163. if (index == 4) { //更多
  164. url = path + "?activityId=" + this.activityId;
  165. }
  166. uni.navigateTo({
  167. url: url,
  168. })
  169. },
  170. //跳转需要带惨方法
  171. navWithParm(id) {
  172. uni.navigateTo({
  173. url: "/pages/activityList/activity/authorBoost?activityId=" + this.activityId + "&receiverId=" + id,
  174. })
  175. },
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .first {
  181. height: 300upx;
  182. width: 30%;
  183. border-radius: 30upx;
  184. box-shadow: -1upx -1upx 60upx #d8d8d8;
  185. }
  186. .second {
  187. height: 260upx;
  188. width: 27%;
  189. border-radius: 30upx;
  190. box-shadow: -1upx -1upx 60upx #d8d8d8;
  191. }
  192. .third {
  193. height: 260upx;
  194. width: 27%;
  195. border-radius: 30upx;
  196. box-shadow: -1upx -1upx 60upx #d8d8d8;
  197. }
  198. .hot-btn {
  199. color: #FFFFFF;
  200. line-height: 56upx;
  201. width: 70%;
  202. border-radius: 30upx;
  203. background-color: #583ce6;
  204. font-weight: bold;
  205. }
  206. </style>