activity-view.vue 6.8 KB

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