修复插座命名功能的一些问题

This commit is contained in:
Your Name
2025-03-18 23:43:17 +08:00
parent b36fce48f5
commit 4a20713693
6 changed files with 798 additions and 734 deletions

View File

@@ -885,18 +885,19 @@
// 弹窗编辑
var newName = prompt("请输入新的插座名称", oldName);
if (newName && newName.trim() !== "") {
if(newName.trim().includes(" ")){
ShowToast("名称不能包含空格");
return;
}
if(newName.trim().length>16){
ShowToast("名称不能超过16个字");
return;
}
$lang.text(newName.trim());
// 可选:更新序号
$index.text("");
// 🔸 编辑完成后,获取所有名称并拼接
var allNames = [];
$(".mdl-list__item .lang").each(function () {
allNames.push('"' + $(this).text().trim() + '"');
});
var nameString = allNames.join(',');
HttpPost("/socketNames", function (re) {
}, nameString);});
}
}, index+' '+newName.trim());}
});
document.getElementById("list-switch-all").addEventListener("click", function() {