Browse Source

修改后逻辑为助力人数每到达100时间减一;

zhangjiahao/feature-20250717125955-众筹
zhangjiahao 3 weeks ago
parent
commit
679ca0b746
  1. 16
      src/views/zhongchou/index.vue

16
src/views/zhongchou/index.vue

@ -199,21 +199,19 @@ async function fetchActivity() {
const totalPeople = 1500 // 1500
const currentCount = item.marketCount || 0 //
//
//
if (currentCount >= totalPeople) {
isCompleted.value = true //
usRemainingTime.value = 0 // 0
} else {
isCompleted.value = false
// (0-100)
const progressPercent = Math.min((currentCount / totalPeople) * 100, 100)
// (15100%)
const usedTime = (progressPercent / 100) * 15
const remainingTime = Math.max(0, 15 - usedTime)
usRemainingTime.value = Math.round(remainingTime)
// - 151001
const initialTime = 15 // 15
const hundredsCount = Math.floor(currentCount / 100) // 100
const remainingTime = Math.max(0, initialTime - hundredsCount) // 1001
usRemainingTime.value = remainingTime
}
console.log(`${marketName.value}助力人数: ${currentCount}/${totalPeople}, 进度: ${currentCount >= totalPeople ? '100' : progressPercent.toFixed(1)}%, 剩余时间: ${usRemainingTime.value}分钟, 完成状态: ${isCompleted.value}`)

Loading…
Cancel
Save