feat(player-desktop): 优化注单侧栏面板折叠、隐藏首页滚动条、默认选中联赛、主页添加近期热门快速下注

This commit is contained in:
2026-06-30 17:42:50 +08:00
parent 8a1ba0fd95
commit 178787e89a
9 changed files with 583 additions and 90 deletions

View File

@@ -27,6 +27,23 @@ export type SlipMode = 'single' | 'parlay';
export type ParlaySlipError = ParlayRejectReason | 'MAX_LEGS' | 'SAME_MATCH';
const BET_SLIP_STORAGE_PREFIX = 'player:betSlip:v1';
const DESKTOP_PANEL_EXPANDED_KEY = 'player:desktopBetSlipExpanded:v1';
function readDesktopPanelExpanded() {
try {
return localStorage.getItem(DESKTOP_PANEL_EXPANDED_KEY) !== '0';
} catch {
return true;
}
}
function writeDesktopPanelExpanded(expanded: boolean) {
try {
localStorage.setItem(DESKTOP_PANEL_EXPANDED_KEY, expanded ? '1' : '0');
} catch {
// ignore quota / private mode errors
}
}
interface BetSlipPersisted {
singleItem: SlipItem | null;
@@ -370,6 +387,11 @@ export const useBetSlipStore = defineStore('betSlip', () => {
);
const drawerOpen = ref(false);
const panelExpanded = ref(readDesktopPanelExpanded());
watch(panelExpanded, (expanded) => {
writeDesktopPanelExpanded(expanded);
});
function openDrawer() {
drawerOpen.value = true;
@@ -379,6 +401,18 @@ export const useBetSlipStore = defineStore('betSlip', () => {
drawerOpen.value = false;
}
function expandPanel() {
panelExpanded.value = true;
}
function collapsePanel() {
panelExpanded.value = false;
}
function togglePanelExpanded() {
panelExpanded.value = !panelExpanded.value;
}
function updateSelectionOdds(selectionId: string, odds: number, oddsVersion: string) {
if (singleItem.value?.selectionId === selectionId) {
singleItem.value = { ...singleItem.value, odds, oddsVersion };
@@ -414,6 +448,7 @@ export const useBetSlipStore = defineStore('betSlip', () => {
canSubmit,
lastParlayError,
drawerOpen,
panelExpanded,
setMode,
setSingleItem,
addItem,
@@ -428,6 +463,9 @@ export const useBetSlipStore = defineStore('betSlip', () => {
clearAll,
openDrawer,
closeDrawer,
expandPanel,
collapsePanel,
togglePanelExpanded,
updateSelectionOdds,
getItemStake,
setItemStake,