|
@@ -67,16 +67,29 @@
|
|
|
// 假设设备信息的容器元素是一个 <div> 标签,并具有类名 "data_bottom"
|
|
|
const container = document.querySelector('.data_bottom');
|
|
|
var requestData;
|
|
|
+ let shouldRefresh = true; // 一个标志,用于确定页面是否应该刷新
|
|
|
function init(){
|
|
|
+
|
|
|
callAPI();
|
|
|
// 首次调用函数开始刷新
|
|
|
- refreshPage();
|
|
|
+ setInterval(function() {
|
|
|
+ refreshPage();
|
|
|
+ }, 10000); // 设置10秒钟的定时器
|
|
|
}
|
|
|
function refreshPage() {
|
|
|
- setTimeout(function() {
|
|
|
- location.reload(true); // 重新加载页面,参数为 true 表示强制从服务器重新加载
|
|
|
- callAPI();
|
|
|
- }, 10000); // 设置10秒钟的定时器
|
|
|
+ $.ajax({
|
|
|
+ url: "/bigScreen/getRefresh",
|
|
|
+ type: "GET", // 指定请求类型为 POST
|
|
|
+ dataType: "JSON",
|
|
|
+ success: function (resp) {
|
|
|
+ if(resp.data ||resp.data == null){
|
|
|
+ location.reload(true); // 重新加载页面,参数为 true 表示强制从服务器重新加载
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.error("发生错误:", error);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -88,6 +101,7 @@
|
|
|
"openPage": "NO"
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
$.ajax({
|
|
|
url:"/admin/page/crudQuery/aDevice",
|
|
|
type: "POST", // 指定请求类型为 POST
|
|
@@ -172,18 +186,6 @@
|
|
|
document.body.appendChild(link);
|
|
|
link.click();
|
|
|
|
|
|
- // 发送新的请求
|
|
|
- /*$.ajax({
|
|
|
- url: "/admin/page/crudQuery/deviceDetail",
|
|
|
- type: "POST",
|
|
|
- contentType: "application/json",
|
|
|
- dataType: "JSON",
|
|
|
- data: JSON.stringify(detailRequestData),
|
|
|
- success: function(detailResp) {
|
|
|
- // 成功返回数据后,渲染新页面
|
|
|
- renderDetailPage(detailResp);
|
|
|
- }
|
|
|
- });*/
|
|
|
});
|
|
|
});
|
|
|
|