This commit is contained in:
猫猫guowen
2025-09-30 15:33:28 +08:00
parent 6b40172345
commit 0f2721f479
20 changed files with 428 additions and 239 deletions

View File

@@ -1308,30 +1308,30 @@ $(document).ready(function () {
// **********************定期检查配置文件更新**********************
setInterval(function () {
$.ajax({
url: 'json/config.json',
type: 'GET',
dataType: 'json',
cache: false, // 禁用缓存,确保每次都获取最新的配置
success: function (data) {
// 如果配置有变化,更新显示(不论editMode状态)
if (JSON.stringify(data) !== JSON.stringify(config)) {
config = data;
// 确保deviceDraggable默认为false
if (typeof config.deviceDraggable === 'undefined') {
config.deviceDraggable = false;
}
// 更新全局config引用
window.config = config;
createBoxes();
// 更新设备拖动状态
updateDevicesDraggableState();
}
},
error: function (xhr, status, error) {
console.error('检查配置更新失败:', error);
}
});
}, 1000); // 每秒检查一次
// setInterval(function () {
// $.ajax({
// url: 'json/config.json',
// type: 'GET',
// dataType: 'json',
// cache: false, // 禁用缓存,确保每次都获取最新的配置
// success: function (data) {
// // 如果配置有变化,更新显示(不论editMode状态)
// if (JSON.stringify(data) !== JSON.stringify(config)) {
// config = data;
// // 确保deviceDraggable默认为false
// if (typeof config.deviceDraggable === 'undefined') {
// config.deviceDraggable = false;
// }
// // 更新全局config引用
// window.config = config;
// createBoxes();
// // 更新设备拖动状态
// updateDevicesDraggableState();
// }
// },
// error: function (xhr, status, error) {
// console.error('检查配置更新失败:', error);
// }
// });
// }, 1000); // 每秒检查一次
});