index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view>
  3. <view class="bg-white" style="padding: 30upx; 30upx 0upx 30upx">
  4. <u-swiper height="268" :list="imgList" name="url" bg-color="#fff" interval="5000"></u-swiper>
  5. </view>
  6. <view>
  7. <search-bar :disabled="false" @onSearch="onSearch" placeholder="请输入活动名称"></search-bar>
  8. </view>
  9. <!-- <view class="padding-lr-sm bg-white flex flex-wrap" style="padding-bottom: 10upx;">
  10. <block v-for="(item, index) in activityTags" :key="index">
  11. <view class="activity-tag">{{item}}</view>
  12. </block>
  13. </view> -->
  14. <block v-for="(item, index) in activityList" :key="index">
  15. <view class="container" @click="navWithParm(item.id)">
  16. <view class="flex align-center">
  17. <view style="margin: 30upx 0 10upx 20upx;">
  18. <image :src="item.cover" style="width: 234upx;height: 188upx;border-radius: 16upx;"></image>
  19. </view>
  20. <view class="padding-lr-sm">
  21. <view class="flex">
  22. <view style="width: 80%">
  23. <view class="text-lg text-bold">{{item.name}}</view>
  24. <view class="text-sm margin-tb-xs">{{item.beginTime.split(' ')[0]}} - {{item.endTime.split(' ')[0]}}</view>
  25. <view class="text-sm text-cut-2" style="width: 330upx;height: 70upx;">
  26. {{item.description}}
  27. </view>
  28. </view>
  29. <view style="margin-top: 10upx;" v-if="item.activityStatus == 0">
  30. <image src="/static/index/ing.png" style="width: 85upx;height: 73upx;"></image>
  31. </view>
  32. <view style="margin-top: 10upx;" v-if="item.activityStatus == 1">
  33. <image src="/static/index/ing.png" style="width: 100upx;height: 86upx;"></image>
  34. </view>
  35. <view style="margin-top: 10upx;" v-if="item.activityStatus == 2">
  36. <image src="/static/index/finish.png" style="width: 100upx;height: 86upx;"></image>
  37. </view>
  38. </view>
  39. <!-- <view class="text-sm flex flex-wrap">
  40. <block v-for="(item, index) in awardTags" :key="index">
  41. <view class="award-tag">{{item}}</view>
  42. </block>
  43. </view> -->
  44. </view>
  45. </view>
  46. <view class="flex justify-end padding-right-sm">
  47. <block v-for="(item, index) in item.tags.split(',')" :key="index">
  48. <view class="tag">{{item}}</view>
  49. </block>
  50. </view>
  51. <view class="flex align-center justify-end text-sm" style="padding: 20upx 30upx 30upx ;">
  52. <text class="cuIcon-hotfill text-orange"></text>
  53. <view class="padding-left-xs">已有{{item.applyNum}}人报名</view>
  54. </view>
  55. </view>
  56. </block>
  57. </view>
  58. </template>
  59. <script>
  60. import searchBar from "@/components/basic/search-bar.vue";
  61. export default {
  62. components: {searchBar},
  63. data() {
  64. return {
  65. imgList: [],
  66. activityList: [],
  67. awardTags: ['1万RMB','点歌机','100000积分'],
  68. }
  69. },
  70. onLoad() {
  71. this.getAdsList();
  72. this.getActivityList();
  73. },
  74. methods: {
  75. navWithParm(id) {
  76. uni.navigateTo({
  77. url: "/pages/activityList/home/home?activityId=" + id
  78. })
  79. },
  80. getAdsList() {
  81. this.$u.api.activity.getAdsList().then(res => {
  82. this.imgList = res.records;
  83. });
  84. },
  85. getActivityList() {
  86. this.$u.api.activity.list().then(res => {
  87. this.activityList = res.records;
  88. })
  89. },
  90. onSearch(item) {
  91. console.log(item)
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .activity-tag {
  98. margin: 10upx;
  99. padding: 0 10upx;
  100. font-size: 24upx;
  101. line-height: 40upx;
  102. background-color: #efefef;
  103. border-radius: 16upx;
  104. }
  105. .award-tag {
  106. margin: 10upx;
  107. padding: 0 10upx;
  108. font-size: 20upx;
  109. line-height: 40upx;
  110. background-color: #fff0d9;
  111. border-radius: 10upx;
  112. color: #feac65;
  113. }
  114. .tag {
  115. border-radius: 30upx;
  116. border: #fd8678 1upx solid;
  117. color: #fd8678;
  118. background-color: #FFFFFF;
  119. line-height: 40upx;
  120. font-size: 20upx;
  121. padding: 0 20upx;
  122. margin: 0 8upx;
  123. }
  124. .container {
  125. margin: 20upx;
  126. background-color: #FFFFFF;
  127. border-radius: 20upx;
  128. }
  129. </style>