card.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="">
  3. <view class="card" style="display: flex;" v-for="(item,index) in cardList" :key="index">
  4. <view v-if="checkAllShow" class="center" style="width: 10%;background-color: #F1F1F1;">
  5. <u-checkbox shape="circle" @change="checkboxChange" v-model="item.checked" :name="index"></u-checkbox>
  6. </view>
  7. <navigator :url="`/pages/activity/detail?id=${item.id}&current=${current}`" hover-class="none" class="">
  8. <image class="bg" :src="item.pic"></image>
  9. <view class="content">
  10. <text class="text-cut-1 title">{{item.title}}</text>
  11. <view class="cu-tag btn-bg-color round sm tag" v-for="(item1,index1) in item.labels" :key="index1">
  12. {{item1}}
  13. </view>
  14. <view class="time">
  15. <text>报名截至时间:{{item.endTime}}</text>
  16. </view>
  17. </view>
  18. <image v-if="item.auditStatus==4" class="status" src="@/static/icon/await.png" mode="widthFix"></image>
  19. <image v-if="item.auditStatus==1" class="status" src="@/static/icon/pass.png" mode="widthFix"></image>
  20. <image v-if="item.auditStatus==2" class="status" src="@/static/icon/fail.png" mode="widthFix"></image>
  21. </navigator>
  22. </view>
  23. <block v-if="checkAllShow">
  24. <view class="" style="height: 110rpx;"></view>
  25. <view class="bottom-bar">
  26. <view class="left">
  27. <u-checkbox @change="checkAllChange" shape="circle" v-model="checkAll">
  28. 全选
  29. </u-checkbox>
  30. </view>
  31. <view @click="operate" style="font-size: 28rpx;" class="btn-bg-color center round right">
  32. <text v-if="current==0">结束活动</text>
  33. <text v-if="current==1">参加活动</text>
  34. <text v-if="current==2">退出活动</text>
  35. </view>
  36. </view>
  37. </block>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. props: {
  43. cardList: Array,
  44. current: Number
  45. },
  46. data() {
  47. return {
  48. checkAllShow: false,
  49. }
  50. },
  51. computed: {
  52. checkAll: {
  53. get() {
  54. let tmpList = this.cardList.filter(item => item.checked == true)
  55. if (tmpList.length == this.cardList.length) {
  56. return true
  57. }
  58. return false
  59. },
  60. set() {
  61. }
  62. }
  63. },
  64. methods: {
  65. showCheckAll() {
  66. this.checkAllShow = !this.checkAllShow
  67. },
  68. hideCheckAll() {
  69. this.checkAllShow = false
  70. },
  71. checkboxChange(e) {
  72. this.$emit('checkboxChange', e)
  73. },
  74. checkAllChange(e) {
  75. this.$emit('checkAllChange', e)
  76. },
  77. operate() {
  78. this.$emit('operate')
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .bottom-bar {
  85. position: fixed;
  86. bottom: env(safe-area-inset-bottom);
  87. z-index: 99;
  88. width: 100%;
  89. background-color: #FFFFFF;
  90. height: 100rpx;
  91. display: flex;
  92. padding: 20rpx 30rpx;
  93. .left {
  94. width: 75%;
  95. display: flex;
  96. flex-direction: column;
  97. justify-content: flex-end;
  98. padding-left: 30rpx;
  99. }
  100. .right {
  101. width: 25%;
  102. }
  103. }
  104. .card {
  105. overflow: hidden;
  106. position: relative;
  107. background-color: #FFFFFF;
  108. margin: 20rpx;
  109. border-radius: 20rpx;
  110. .bg {
  111. border-radius: 20rpx 20rpx 0 0;
  112. width: 100vw;
  113. height: 250rpx;
  114. }
  115. .status {
  116. position: absolute;
  117. right: 10rpx;
  118. bottom: 10rpx;
  119. width: 100rpx;
  120. }
  121. .content {
  122. padding: 10rpx 20rpx;
  123. .title {
  124. font-weight: 800;
  125. font-size: 30rpx;
  126. }
  127. .tag {
  128. padding: 20rpx 32rpx;
  129. margin: 20rpx 20rpx 20rpx 0;
  130. }
  131. .time {
  132. font-size: 24rpx;
  133. margin-bottom: 20rpx;
  134. }
  135. }
  136. }
  137. </style>