feat(admin,api,player): 赛事分组管理、盘口独立页与多语言展示优化

- 管理端按联赛展示单场,新增赛事/单场流程与列表展开状态保持

- 盘口赔率迁至独立页面,保存按钮仅在有修改时高亮

- API 新增联赛列表与子场查询,按 locale 返回队名并修复编译

- 波胆其它选项与促销标签等 i18n 补齐,文案更易懂
This commit is contained in:
2026-06-04 16:25:03 +08:00
parent c68abadceb
commit cc737e2924
39 changed files with 3330 additions and 378 deletions

View File

@@ -0,0 +1,51 @@
/** 赛事列表 UI 状态(返回列表时恢复展开等) */
const STORAGE_KEY = 'admin_matches_list_ui';
export type MatchesListUiState = {
expandedLeagueIds: string[];
page: number;
pageSize: number;
filterStatus: string;
keyword: string;
};
function defaultState(): MatchesListUiState {
return {
expandedLeagueIds: [],
page: 1,
pageSize: 10,
filterStatus: '',
keyword: '',
};
}
export function readMatchesListUiState(): MatchesListUiState | null {
try {
const raw = sessionStorage.getItem(STORAGE_KEY);
if (!raw) return null;
const parsed = JSON.parse(raw) as MatchesListUiState;
if (!Array.isArray(parsed.expandedLeagueIds)) return null;
return parsed;
} catch {
return null;
}
}
export function writeMatchesListUiState(state: MatchesListUiState) {
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(state));
}
export function patchMatchesListUiState(patch: Partial<MatchesListUiState>) {
const base = readMatchesListUiState() ?? defaultState();
writeMatchesListUiState({ ...base, ...patch });
}
/** 从子页返回前确保该赛事行处于展开记录中 */
export function ensureLeagueExpanded(leagueId: string) {
if (!leagueId) return;
const base = readMatchesListUiState() ?? defaultState();
const ids = new Set(base.expandedLeagueIds);
ids.add(leagueId);
writeMatchesListUiState({ ...base, expandedLeagueIds: [...ids] });
}