优化自动关闭

This commit is contained in:
2026-04-12 17:34:07 +08:00
parent 2090250967
commit 5b637d2c64
@@ -275,13 +275,15 @@
{{-- ─── 底部关闭 ─── --}}
<div
style="background:#fff; border-top:1px solid #d0e4f5; padding:14px 16px; display:flex; justify-content:center;">
style="background:#fff; border-top:1px solid #d0e4f5; padding:14px 16px; display:flex; flex-direction:column; align-items:center; gap:8px;">
<button @click="close()"
style="padding:10px 48px; min-width:140px; background:#f0f6ff; border:1px solid #b0d0ee; border-radius:12px;
font-size:14px; font-weight:bold; color:#336699; cursor:pointer; transition:all .15s;"
onmouseover="this.style.background='#ddeeff'" onmouseout="this.style.background='#f0f6ff'">
关闭
<span x-show="phase !== 'settled'">关闭</span>
<span x-show="phase === 'settled'" x-text="'关闭 (' + settledCountdown + 's)'"></span>
</button>
<div x-show="phase === 'settled'" style="font-size:11px; color:#94a3b8;">窗口将在倒计时结束后自动关闭</div>
</div>
</div>
</div>
@@ -381,6 +383,9 @@
countdown: 90,
countdownTimer: null,
settledCountdown: 10,
settledTimer: null,
// 马匹列表(含实时赔率)
horses: [],
positions: {}, // 跑马进度 {horse_id: 0~100}
@@ -540,6 +545,7 @@
*/
showResult(data) {
clearInterval(this.countdownTimer);
clearInterval(this.settledTimer);
this.phase = 'settled';
this.show = true;
this.totalPool = data.total_pool || this.totalPool;
@@ -565,6 +571,16 @@
this.updateFab(false);
this.loadHistory();
// 10秒倒计时自动关闭结果弹窗
this.settledCountdown = 10;
this.settledTimer = setInterval(() => {
this.settledCountdown--;
if (this.settledCountdown <= 0) {
clearInterval(this.settledTimer);
this.close();
}
}, 1000);
},
/**
@@ -591,6 +607,7 @@
*/
close() {
this.show = false;
clearInterval(this.settledTimer);
if (this.phase === 'betting') {
this.updateFab(true);
}