index.vue 3.9 KB

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