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

@@ -54,6 +54,7 @@ export async function saveFilter(addFilterId) {
fileName = '';
return true;
} else { // 點擊取消或空白處,為存檔失敗。
// console.log("PageAdminStore.activePage", PageAdminStore.activePage);
PageAdminStore.keepPreviousPage();
return false;
}
@@ -100,6 +101,7 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
});
if(result.isConfirmed) {
console.log('popup confirm case', );
if(allMapDataStore.createFilterId) {
await allMapDataStore.updataFilter();
@@ -116,13 +118,17 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
logOut ? logOut() : next(toPath);
} else if(result.dismiss === 'cancel') {
console.log('popup cancel case', );
// Handle page admin issue
console.log("PageAdminStore.activePage", PageAdminStore.activePage);
pageAdminStore.keepPreviousPage();
allMapDataStore.tempFilterId = null;
logOut ? logOut() : next(toPath);
} else if(result.dismiss === 'backdrop') {
console.log('popup backdrop case', );
// Handle page admin issue
console.log("PageAdminStore.activePage", PageAdminStore.activePage);
pageAdminStore.keepPreviousPage();
logOut ? null : next(false);

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;
}
/**