index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. this.$u.api.activity.list({name: item}).then(res => {
  92. this.activityList = res.records;
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .activity-tag {
  100. margin: 10upx;
  101. padding: 0 10upx;
  102. font-size: 24upx;
  103. line-height: 40upx;
  104. background-color: #efefef;
  105. border-radius: 16upx;
  106. }
  107. .award-tag {
  108. margin: 10upx;
  109. padding: 0 10upx;
  110. font-size: 20upx;
  111. line-height: 40upx;
  112. background-color: #fff0d9;
  113. border-radius: 10upx;
  114. color: #feac65;
  115. }
  116. .tag {
  117. border-radius: 30upx;
  118. border: #fd8678 1upx solid;
  119. color: #fd8678;
  120. background-color: #FFFFFF;
  121. line-height: 40upx;
  122. font-size: 20upx;
  123. padding: 0 20upx;
  124. margin: 0 8upx;
  125. }
  126. .container {
  127. margin: 20upx;
  128. background-color: #FFFFFF;
  129. border-radius: 20upx;
  130. }
  131. </style>