index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="nonprofit-activety" @click.self="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. import { useUserStore } from '@/common/stores/user';
  48. const userStore = useUserStore();
  49. import { useGlobalShare } from '@/common/composables/useGlobalShare';
  50. const { isLogin } = useGlobalShare();
  51. const statusCfg = ref({
  52. '-1': '已取消',
  53. 0:'未开始',
  54. 1:'报名中',
  55. 2:'进行中',
  56. 3:'已结束'
  57. })
  58. // 报名未满时只显示状态,避免出现「报名中 · 已报0/12人」
  59. const signupText = computed(() => {
  60. const it = props.item || {}
  61. const status = statusCfg.value[it.activeState] || ''
  62. const now = Number(it.recruitmentNow) || 0
  63. const max = Number(it.recruitmentMax) || 0
  64. if (it.activeState === 1 && (!max || now < max)) return status
  65. return `${status} · 已报${now}${max ? '/' + max : ''}人`
  66. })
  67. const handleDetail = item => {
  68. if(!isLogin()) return
  69. uni.navigateTo({
  70. url:'/pagesHome/activityDetail?id='+item.id
  71. })
  72. }
  73. const toApply = () => {
  74. userStore.openLoginModal();
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. .nonprofit-activety{
  79. background: linear-gradient( 45deg, #FFFFFF 80%, #F2FFE8 100%);
  80. border-radius: 16rpx;
  81. padding: 36rpx 24rpx 32rpx;
  82. margin-top: 20rpx;
  83. .na-top{
  84. &-left{
  85. width: 158rpx;
  86. height: 214rpx;
  87. position: relative;
  88. border-radius: 16rpx;
  89. image{
  90. width: 100%;
  91. height: 100%;
  92. border-radius: 16rpx;
  93. }
  94. &-status{
  95. width: 108rpx;
  96. height: 40rpx;
  97. background: url('https://oss.familydaf.cn/sxsnfile/20251218/c2a2c624e39e4c719841c9c13b0836be.png') no-repeat;
  98. background-size: 100% 100%;
  99. background-position: -1rpx -1rpx;
  100. font-family: PingFang-SC, PingFang-SC;
  101. font-weight: bold;
  102. font-size: 24rpx;
  103. color: #151B29;
  104. line-height: 39rpx;
  105. position: absolute;
  106. left: 0;
  107. top: 0;
  108. border-radius: 16rpx 0 0 0;
  109. text-indent: 12rpx;
  110. }
  111. }
  112. &-right{
  113. width: calc(100% - 158rpx);
  114. padding-left: 20rpx;
  115. box-sizing: border-box;
  116. .p{
  117. font-family: PingFang-SC, PingFang-SC;
  118. font-weight: bold;
  119. font-size: 32rpx;
  120. color: #151B29;
  121. line-height: 40rpx;
  122. margin-bottom: 5rpx;
  123. }
  124. .tip{
  125. margin-top: 25rpx;
  126. &-left{
  127. width: 160rpx;
  128. image{
  129. width: 24rpx;
  130. height: 24rpx;
  131. }
  132. text{
  133. font-family: PingFangSC, PingFang SC;
  134. font-weight: 400;
  135. font-size: 24rpx;
  136. color: #676775;
  137. line-height: 24rpx;
  138. padding-left: 10rpx;
  139. box-sizing: border-box;
  140. }
  141. }
  142. &-right{
  143. width: calc(100% - 160rpx);
  144. font-family: PingFangSC, PingFang SC;
  145. font-weight: 400;
  146. font-size: 24rpx;
  147. color: #676775;
  148. line-height: 24rpx;
  149. box-sizing: border-box;
  150. }
  151. }
  152. }
  153. }
  154. .na-bottom{
  155. margin-top: 24rpx;
  156. &-left{
  157. font-family: PingFangSC, PingFang SC;
  158. font-weight: 400;
  159. font-size: 24rpx;
  160. color: #676775;
  161. line-height: 24rpx;
  162. }
  163. &-status{
  164. color: #70CF52;
  165. }
  166. &-count{
  167. color: #70CF52;
  168. }
  169. &-right{
  170. background: #B7F358;
  171. border-radius: 27rpx;
  172. padding: 12rpx 30rpx;
  173. font-family: PingFang-SC, PingFang-SC;
  174. font-weight: bold;
  175. font-size: 24rpx;
  176. color: #151B29;
  177. line-height: 30rpx;
  178. }
  179. }
  180. }
  181. </style>