fix: close host center on back

This commit is contained in:
170-carry 2026-04-28 20:49:56 +08:00
parent 17ef7cb4bb
commit 3b0dd2e800
2 changed files with 22 additions and 3 deletions

View File

@ -146,6 +146,6 @@
<div class="loading-copy">loading....</div> <div class="loading-copy">loading....</div>
</div> </div>
</div> </div>
<script src="./script.js?v=20260428-2060" defer></script> <script src="./script.js?v=20260428-2070" defer></script>
</body> </body>
</html> </html>

View File

@ -214,7 +214,7 @@
if (window.location.protocol === "file:") return fallbackMessages[normalizedLang]; if (window.location.protocol === "file:") return fallbackMessages[normalizedLang];
try { try {
const response = await fetch(`./locales/${normalizedLang}.json?v=20260428-2060`, { cache: "no-store" }); const response = await fetch(`./locales/${normalizedLang}.json?v=20260428-2070`, { cache: "no-store" });
if (response.ok) return await response.json(); if (response.ok) return await response.json();
} catch (error) { } catch (error) {
return fallbackMessages[normalizedLang]; return fallbackMessages[normalizedLang];
@ -461,6 +461,25 @@
window.location.replace(buildPageURL("../join-agency/index.html")); window.location.replace(buildPageURL("../join-agency/index.html"));
} }
function closeHostCenterPage() {
try {
if (window.app && typeof window.app.closePage === "function") {
window.app.closePage();
return;
}
if (window.FlutterPageControl && typeof window.FlutterPageControl.postMessage === "function") {
window.FlutterPageControl.postMessage("close_page");
return;
}
if (window.history.length > 1) window.history.back();
} catch (error) {
console.error("close host center page failed:", error);
if (window.history.length > 1) window.history.back();
}
}
function formatCurrentSalary(value) { function formatCurrentSalary(value) {
const numericValue = Number(value); const numericValue = Number(value);
if (Number.isFinite(numericValue)) return numericValue.toFixed(2); if (Number.isFinite(numericValue)) return numericValue.toFixed(2);
@ -878,7 +897,7 @@
}); });
document.querySelector(".back-button")?.addEventListener("click", () => { document.querySelector(".back-button")?.addEventListener("click", () => {
if (window.history.length > 1) window.history.back(); closeHostCenterPage();
}); });
document.querySelector(".agency")?.addEventListener("click", () => { document.querySelector(".agency")?.addEventListener("click", () => {