소스 검색

fix: hide signup count while activity is enrolling

Developer 4 주 전
부모
커밋
d5499a73aa
1개의 변경된 파일과 14개의 추가작업 그리고 12개의 파일을 삭제
  1. 14 12
      components/pages/nonprofitActivety/index.vue

+ 14 - 12
components/pages/nonprofitActivety/index.vue

@@ -24,10 +24,10 @@
 				</view>
 			</view>
 		</view>
-		<view class="na-bottom adfacjb" v-if="item.activeState!==-1">
-			<view class="na-bottom-left adf">
-				{{ statusCfg[item.activeState] }} · 已报{{ item.recruitmentNow || 0 }}{{ item.recruitmentMax ? '/' + item.recruitmentMax : '' }}人
-			</view>
+		<view class="na-bottom adfacjb" v-if="item.activeState!==-1">
+			<view class="na-bottom-left adf">
+				{{ signupText }}
+			</view>
 			<!-- <view class="na-bottom-right" @click.stop="toApply">立即报名</view> -->
 		</view>
 	</view>
@@ -57,13 +57,15 @@
 		3:'已结束'
 	})
 
-	// 「报名中 · 已报 X 人」或「已报 X/Y 人」
-	const signupText = computed(() => {
-		const it = props.item || {}
-		const now = it.recruitmentNow || 0
-		const max = it.recruitmentMax
-		return `报名中 · 已报${now}${max ? '/' + max : ''}人`
-	})
+	// 报名未满时只显示状态,避免出现「报名中 · 已报0/12人」
+	const signupText = computed(() => {
+		const it = props.item || {}
+		const status = statusCfg.value[it.activeState] || ''
+		const now = Number(it.recruitmentNow) || 0
+		const max = Number(it.recruitmentMax) || 0
+		if (it.activeState === 1 && (!max || now < max)) return status
+		return `${status} · 已报${now}${max ? '/' + max : ''}人`
+	})
 
 	const handleDetail = item => {
 		if(!isLogin()) return
@@ -183,4 +185,4 @@
 			}
 		}
 	}
-</style>
+</style>