activity-view.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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 v-if="!$u.test.isEmpty(rankList)" 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-if="!$u.test.isEmpty(rankList)" >
  56. <view class="padding-sm flex justify-between align-center bg-white" v-for="(item, index) in rankList.slice(3, rankList.length + 1)" :key="index" @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. rankList: {
  100. type: Array,
  101. default() {
  102. return []
  103. }
  104. },
  105. },
  106. data() {
  107. return {
  108. icons: [
  109. {image: '/static/song.png', name: '活动介绍', url: '/pages/activityList/activity/activityDetail'},
  110. {image: '/static/signUp.png', name: '点击报名', url: '/pages/activityList/activity/signUp'},
  111. {image: '/static/hot.png', name: '热度榜', url: '/pages/activityList/activity/hot'},
  112. {image: '/static/activity.png', name: '我的奖金', url: '/pages/activityList/activity/awards'},
  113. {image: '/static/more.png', name: '更多', url: '/pages/activityList/activity/songRank'},
  114. ],
  115. activity: {},
  116. }
  117. },
  118. mounted() {
  119. this.getActivityDetail();
  120. },
  121. methods: {
  122. getActivityDetail() {
  123. this.$u.api.activity.detail({id: this.activityId}).then(res => {
  124. this.activity = res;
  125. })
  126. },
  127. navByIcon(path, index) {
  128. let url;
  129. if (index == 0) { //图片 和 活动详情
  130. url = path + "?poster=" + this.activity.poster + "&activityId=" + this.activityId;
  131. }
  132. if (index == 1) { //报名
  133. let changeTime = new Date() - Date.parse(this.activity.applyEndTime.replace(/-/g, '/'));//时间戳差值
  134. if (changeTime > 0) { //检查活动是否已经停止报名
  135. uni.showToast({
  136. icon: "none",
  137. title: "报名已结束"
  138. })
  139. return;
  140. } else {
  141. let userId = uni.getStorageSync("userId")
  142. if (this.$u.test.isEmpty(userId)) { //是否已经登录
  143. let param = "pages/activityList/home/home?activityId=" + this.activityId;
  144. window.location.href = authUrl(param);
  145. } else {
  146. url = path + "?activityId=" + this.activityId;
  147. }
  148. }
  149. }
  150. if (index == 2) { //热榜
  151. url = path + "?activityId=" + this.activityId;
  152. }
  153. if (index == 3) { //我的奖金
  154. let userId = uni.getStorageSync("userId")
  155. if (this.$u.test.isEmpty(userId)) { //是否已经登录
  156. let param = "pages/activityList/home/home?activityId=" + this.activityId;
  157. window.location.href = authUrl(param);
  158. } else {
  159. url = path;
  160. }
  161. }
  162. if (index == 4) { //更多
  163. url = path + "?activityId=" + this.activityId;
  164. }
  165. uni.navigateTo({
  166. url: url,
  167. })
  168. },
  169. //跳转需要带惨方法
  170. navWithParm(id) {
  171. uni.navigateTo({
  172. url: "/pages/activityList/activity/authorBoost?activityId=" + this.activityId + "&receiverId=" + id,
  173. })
  174. },
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. .first {
  180. height: 300upx;
  181. width: 30%;
  182. border-radius: 30upx;
  183. box-shadow: -1upx -1upx 60upx #d8d8d8;
  184. }
  185. .second {
  186. height: 260upx;
  187. width: 27%;
  188. border-radius: 30upx;
  189. box-shadow: -1upx -1upx 60upx #d8d8d8;
  190. }
  191. .third {
  192. height: 260upx;
  193. width: 27%;
  194. border-radius: 30upx;
  195. box-shadow: -1upx -1upx 60upx #d8d8d8;
  196. }
  197. .hot-btn {
  198. color: #FFFFFF;
  199. line-height: 56upx;
  200. width: 70%;
  201. border-radius: 30upx;
  202. background-color: #583ce6;
  203. font-weight: bold;
  204. }
  205. </style>