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 @@
@@ -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();
+ }
+ });
}
})