|
|
@ -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) |
|
|
|
|
|
|
|
// 根据进度计算剩余时间 (15分钟对应100%进度) |
|
|
|
const usedTime = (progressPercent / 100) * 15 |
|
|
|
const remainingTime = Math.max(0, 15 - usedTime) |
|
|
|
|
|
|
|
usRemainingTime.value = Math.round(remainingTime) |
|
|
|
// 计算剩余时间 - 初始15分钟,每满100人减少1分钟 |
|
|
|
const initialTime = 15 // 初始时间15分钟 |
|
|
|
const hundredsCount = Math.floor(currentCount / 100) // 计算满100的次数 |
|
|
|
const remainingTime = Math.max(0, initialTime - hundredsCount) // 每满100人减少1分钟 |
|
|
|
|
|
|
|
usRemainingTime.value = remainingTime |
|
|
|
} |
|
|
|
|
|
|
|
console.log(`${marketName.value}助力人数: ${currentCount}/${totalPeople}, 进度: ${currentCount >= totalPeople ? '100' : progressPercent.toFixed(1)}%, 剩余时间: ${usRemainingTime.value}分钟, 完成状态: ${isCompleted.value}`) |
|
|
|