fix: 能量进度条满问题

This commit is contained in:
bietiaop 2024-07-08 13:55:06 +08:00
parent 1c65f10e24
commit ac96925c70
3 changed files with 6 additions and 3 deletions

View file

@ -52,6 +52,7 @@ export class EnergyProgress {
constructor(max, current) {
this.max = max;
this.current = current;
this.percent = parseInt((Number(current) / Number(max)) * 100);
}
}
@ -64,11 +65,10 @@ export class Energy {
* @param {number} restore
*/
constructor(progress, restore) {
this.progress = progress;
this.progress = new EnergyProgress(progress.max, progress.current);
this.restore = restore;
const leftHM = converSecondsToHM(restore);
this.progress.rest = `${leftHM[0]}小时${leftHM[1]}分钟`;
this.percent = parseInt((progress.current / progress.max) * 100);
}
}