pageAdmin add setActivePageComputedByRoute function

This commit is contained in:
Cindy Chang
2024-06-05 13:08:52 +08:00
parent 427b9b6aed
commit 5f0e12ef1a
10 changed files with 213 additions and 135 deletions

View File

@@ -111,17 +111,12 @@ export function followTimeLabel(second, max, fixedNumber = 0) {
const day = 24 * 60 * 60;
const hour = 60 * 60;
const minutes = 60;
console.log("max / day", max / day);
console.log("max % day", max % day);
console.log('(max % day) / hour', (max % day) / hour);
console.log('max % hour', max % hour);
console.log('(max % hour) / minutes', (max % hour) / minutes);
const dd = Math.floor(max / day);
const hh = Math.floor((max % day) / hour);
const mm = Math.floor((max % hour) / minutes);
let maxUnit = '';
let result;
console.log("所以dd, hh, mm", dd, hh, mm)
maxUnit = dd > 0 ? 'd' : hh > 0 ? 'h' : mm > 0 ? 'm' : 's';
switch (maxUnit) {
case 'd':
@@ -149,7 +144,6 @@ console.log("所以dd, hh, mm", dd, hh, mm)
result = second.toFixed(fixedNumber) + 's';
break;
}
console.log("followTimeLabel() result", max, result)
return result;
}
/**