From fbeb9787dc5cfc280b3f0dd67b161d2e8c725766 Mon Sep 17 00:00:00 2001 From: li Date: Sat, 30 May 2026 22:27:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(agent-report):=20=E6=B3=A8=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=96=B0=E5=A2=9E=E4=BB=8A=E6=97=A5=E6=B3=A8?= =?UTF-8?q?=E5=8D=95=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=E5=BC=80=E5=85=B3?= =?UTF-8?q?(=E9=BB=98=E8=AE=A4=E5=BC=80,10=E7=A7=92=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=9F=A5=E8=AF=A2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原自动刷新仅在线管理(online=1)进入时生效;现普通注单查询页也支持, 带开关(localStorage持久化)+倒计时显示,免手动点刷新。 --- application/agent/view/report/bet.html | 47 +++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/application/agent/view/report/bet.html b/application/agent/view/report/bet.html index 5be4e0a..fa372a7 100644 --- a/application/agent/view/report/bet.html +++ b/application/agent/view/report/bet.html @@ -77,7 +77,10 @@
{$lang['refresh']} - + +
@@ -187,16 +190,44 @@ $(function(){ var online = $('#online').val(); var refreshUrl = $('#refreshUrl').val(); - var countDown = 10; - if(online == 1){ - $('.countDown').show(); - setInterval(function(){ + var INTERVAL = 10; // 自动刷新间隔(秒) + var countDown = INTERVAL; + var autoTimer = null; + + function startAuto(reloadFn){ + countDown = INTERVAL; + $('.countDown').show().html(countDown); + autoTimer = setInterval(function(){ countDown = countDown - 1; $('.countDown').html(countDown); - if(countDown == 0){ - location.href = refreshUrl; + if(countDown <= 0){ + reloadFn(); } - },1000); + }, 1000); + } + function stopAuto(){ + if(autoTimer){ clearInterval(autoTimer); autoTimer = null; } + $('.countDown').hide(); + } + + if(online == 1){ + // 从“在线管理”进入:保持原有自动刷新行为 + startAuto(function(){ location.href = refreshUrl; }); + }else{ + // 注单查询:可开关的今日实时自动刷新(默认开,刷新当前查询条件) + var saved = localStorage.getItem('bet_auto_refresh'); + var enabled = (saved === null) ? true : (saved === '1'); + $('#autoRefresh').prop('checked', enabled); + if(enabled){ startAuto(function(){ location.replace(location.href); }); } + $('#autoRefresh').on('change', function(){ + if($(this).is(':checked')){ + localStorage.setItem('bet_auto_refresh','1'); + startAuto(function(){ location.replace(location.href); }); + }else{ + localStorage.setItem('bet_auto_refresh','0'); + stopAuto(); + } + }); } })