index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="nonprofit-activety" @click="handleDetail(item)" v-if="item" :style="{'margin-top':index===0?0:'20rpx'}">
  3. <view class="na-top adf">
  4. <view class="na-top-left">
  5. <image :src="item.coverFile"></image>
  6. <view class="na-top-left-status">{{statusCfg[item.activeState]}}</view>
  7. </view>
  8. <view class="na-top-right">
  9. <view class="p">{{item.activityName||''}}</view>
  10. <view class="tip adf">
  11. <view class="tip-left adfac">
  12. <image src="https://oss.familydaf.cn/sxsnfile/20251218/762878799914422d835e505291b9d4c6.png"></image>
  13. <text>截止报名:</text>
  14. </view>
  15. <!-- <view class="tip-right">{{item.endTimeText}}</view> -->
  16. <view class="tip-right">{{item.signupEndTime||''}}</view>
  17. </view>
  18. <view class="tip adf">
  19. <view class="tip-left adfac">
  20. <image src="https://oss.familydaf.cn/sxsnfile/20251218/57539643ab974aef9401d76818e1bf3b.png"></image>
  21. <text>活动地点:</text>
  22. </view>
  23. <view class="tip-right">{{item.provinceName||''}}{{item.cityName||''}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="na-bottom adfacjb" v-if="item.activeState!==-1">
  28. <view class="na-bottom-left adf">
  29. {{ signupText }}
  30. </view>
  31. <!-- <view class="na-bottom-right" @click.stop="toApply">立即报名</view> -->
  32. </view>
  33. </view>
  34. </template>
  35. <script setup name="nonprofitActivety">
  36. import { ref, computed } from 'vue'
  37. const props = defineProps({
  38. item:{
  39. typeof:Object,
  40. default:null
  41. },
  42. index:{
  43. typeof:Number,
  44. default:0
  45. }
  46. })
  47. const statusCfg = ref({
  48. '-1': '已取消',
  49. 0:'未开始',
  50. 1:'报名中',
  51. 2:'报名已截止',
  52. 3:'已结束'
  53. })
  54. // 报名未满时只显示状态,避免出现「报名中 · 已报0/12人」
  55. const signupText = computed(() => {
  56. const it = props.item || {}
  57. const status = statusCfg.value[it.activeState] || ''
  58. const now = Number(it.recruitmentNow) || 0
  59. const max = Number(it.recruitmentMax) || 0
  60. if (it.activeState === 1 && (!max || now < max)) return status
  61. return `${status} · 已报${now}${max ? '/' + max : ''}人`
  62. })
  63. const handleDetail = item => {
  64. uni.navigateTo({
  65. url:'/pagesHome/activityDetail?id='+item.id
  66. })
  67. }
  68. </script>
  69. <style scoped lang="scss">
  70. .nonprofit-activety{
  71. background: linear-gradient( 45deg, #FFFFFF 80%, #F2FFE8 100%);
  72. border-radius: 16rpx;
  73. padding: 36rpx 24rpx 32rpx;
  74. margin-top: 20rpx;
  75. .na-top{
  76. &-left{
  77. width: 158rpx;
  78. height: 214rpx;
  79. position: relative;
  80. border-radius: 16rpx;
  81. image{
  82. width: 100%;
  83. height: 100%;
  84. border-radius: 16rpx;
  85. }
  86. &-status{
  87. width: 108rpx;
  88. height: 40rpx;
  89. background: url('https://oss.familydaf.cn/sxsnfile/20251218/c2a2c624e39e4c719841c9c13b0836be.png') no-repeat;
  90. background-size: 100% 100%;
  91. background-position: -1rpx -1rpx;
  92. font-family: PingFang-SC, PingFang-SC;
  93. font-weight: bold;
  94. font-size: 24rpx;
  95. color: #151B29;
  96. line-height: 39rpx;
  97. position: absolute;
  98. left: 0;
  99. top: 0;
  100. border-radius: 16rpx 0 0 0;
  101. text-indent: 12rpx;
  102. }
  103. }
  104. &-right{
  105. width: calc(100% - 158rpx);
  106. padding-left: 20rpx;
  107. box-sizing: border-box;
  108. .p{
  109. font-family: PingFang-SC, PingFang-SC;
  110. font-weight: bold;
  111. font-size: 32rpx;
  112. color: #151B29;
  113. line-height: 40rpx;
  114. margin-bottom: 5rpx;
  115. }
  116. .tip{
  117. margin-top: 25rpx;
  118. &-left{
  119. width: 160rpx;
  120. image{
  121. width: 24rpx;
  122. height: 24rpx;
  123. }
  124. text{
  125. font-family: PingFangSC, PingFang SC;
  126. font-weight: 400;
  127. font-size: 24rpx;
  128. color: #676775;
  129. line-height: 24rpx;
  130. padding-left: 10rpx;
  131. box-sizing: border-box;
  132. }
  133. }
  134. &-right{
  135. width: calc(100% - 160rpx);
  136. font-family: PingFangSC, PingFang SC;
  137. font-weight: 400;
  138. font-size: 24rpx;
  139. color: #676775;
  140. line-height: 24rpx;
  141. box-sizing: border-box;
  142. }
  143. }
  144. }
  145. }
  146. .na-bottom{
  147. margin-top: 24rpx;
  148. &-left{
  149. font-family: PingFangSC, PingFang SC;
  150. font-weight: 400;
  151. font-size: 24rpx;
  152. color: #676775;
  153. line-height: 24rpx;
  154. }
  155. &-status{
  156. color: #70CF52;
  157. }
  158. &-count{
  159. color: #70CF52;
  160. }
  161. &-right{
  162. background: #B7F358;
  163. border-radius: 27rpx;
  164. padding: 12rpx 30rpx;
  165. font-family: PingFang-SC, PingFang-SC;
  166. font-weight: bold;
  167. font-size: 24rpx;
  168. color: #151B29;
  169. line-height: 30rpx;
  170. }
  171. }
  172. }
  173. </style>