index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. mounted() {
  78. this.$shareConfig({}, this)
  79. },
  80. methods: {
  81. navWithParm(id) {
  82. uni.navigateTo({
  83. url: "/pages/activityList/home/home?activityId=" + id
  84. })
  85. },
  86. getAdsList() {
  87. this.$u.api.activity.getAdsList().then(res => {
  88. this.imgList = res.records;
  89. });
  90. },
  91. getActivityList() {
  92. this.$u.api.activity.list().then(res => {
  93. this.activityList = res.records;
  94. })
  95. },
  96. onSearch(item) {
  97. this.$u.api.activity.list({
  98. name: item
  99. }).then(res => {
  100. this.activityList = res.records;
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .activity-tag {
  108. margin: 10upx;
  109. padding: 0 10upx;
  110. font-size: 24upx;
  111. line-height: 40upx;
  112. background-color: #efefef;
  113. border-radius: 16upx;
  114. }
  115. .award-tag {
  116. margin: 10upx;
  117. padding: 0 10upx;
  118. font-size: 20upx;
  119. line-height: 40upx;
  120. background-color: #fff0d9;
  121. border-radius: 10upx;
  122. color: #feac65;
  123. }
  124. .tag {
  125. border-radius: 30upx;
  126. border: #fd8678 1upx solid;
  127. color: #fd8678;
  128. background-color: #FFFFFF;
  129. line-height: 40upx;
  130. font-size: 20upx;
  131. padding: 0 20upx;
  132. margin: 0 8upx;
  133. }
  134. .container {
  135. margin: 20upx;
  136. background-color: #FFFFFF;
  137. border-radius: 20upx;
  138. }
  139. </style>