feat(users): normalize center routes and withdrawal limits

This commit is contained in:
2026-08-12 19:44:47 +08:00
parent 9004f7093f
commit dacd0095bf
24 changed files with 326 additions and 174 deletions
+6 -5
View File
@@ -124,16 +124,17 @@
}
function tabFromUrl() {
var m = window.location.search.match(/[?&]tab=([^&]+)/);
var name = m ? decodeURIComponent(m[1]) : (cfg.activeTab || defaultTab);
var pathParts = window.location.pathname.replace(/\/+$/, '').split('/');
var pathTab = pathParts.length > 2 && pathParts[pathParts.length - 2] === 'user' ? pathParts[pathParts.length - 1] : '';
var name = pathTab || (cfg.activeTab || defaultTab);
if (name === 'balance') name = 'credits';
return tabAliases[name] || name;
}
function updateUrl(name) {
if (!window.history.replaceState) return;
var u = new URL(window.location);
if (name === defaultTab) u.searchParams.delete('tab');
else u.searchParams.set('tab', name);
var pathTab = name === 'credits' ? 'balance' : name;
var u = new URL('/user/' + pathTab + '/', window.location.origin);
window.history.replaceState({}, '', u);
}