From 6870859266b3b3f67ef3ea32c84be7a31b1901a2 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Mon, 13 Apr 2026 12:25:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E8=B0=83=E6=95=B4=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pageHome/ph-daily-note-resin.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/pageHome/ph-daily-note-resin.vue b/src/components/pageHome/ph-daily-note-resin.vue index 7a2b8403..fe3eec7e 100644 --- a/src/components/pageHome/ph-daily-note-resin.vue +++ b/src/components/pageHome/ph-daily-note-resin.vue @@ -29,14 +29,15 @@ type PhDailyNoteResinProps = { const props = defineProps(); const remainedTime = ref(0); -const initialRecoveryTime = ref(0); const initialCurrent = ref(0); const max = computed(() => props.maxResin ?? 200); const current = computed(() => { - const totalSecondsPassed = initialRecoveryTime.value - remainedTime.value; - const resinToRecover = Math.floor(totalSecondsPassed / 540); - return Math.min(initialCurrent.value + resinToRecover, max.value); + const totalToRecover = max.value - initialCurrent.value; + if (totalToRecover <= 0) return max.value; + if (remainedTime.value <= 0) return max.value; + const recovered = Math.floor(totalToRecover - remainedTime.value / 540); + return Math.min(initialCurrent.value + Math.max(recovered, 0), max.value); }); const full = computed(() => current.value === max.value); const formattedTime = computed(() => { @@ -68,7 +69,6 @@ function initTime(): void { initialCurrent.value = props.currentResin || 0; const time = props.recoveryTime; remainedTime.value = typeof time === "string" ? parseInt(time) : time || 0; - initialRecoveryTime.value = remainedTime.value; } function startTimer(): void {