index.vue 4.8 KB

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