点击立即开关

This commit is contained in:
zogodo
2020-02-21 12:06:52 +08:00
parent ce9ee3aecb
commit e93fedf8f8
4 changed files with 319 additions and 321 deletions

View File

@@ -48,7 +48,7 @@
<label for="socket1">Socket-1</label>
</td>
<td style="width:10px;">
<input type="checkbox" id="socket1" name="socket">
<input type="checkbox" id="socket1" name="socket" onchange="SetSocket()">
</td>
</tr>
<tr>
@@ -56,7 +56,7 @@
<label for="socket2">Socket-2</label>
</td>
<td>
<input type="checkbox" id="socket2" name="socket">
<input type="checkbox" id="socket2" name="socket" onchange="SetSocket()">
</td>
</tr>
<tr>
@@ -64,7 +64,7 @@
<label for="socket3">Socket-3</label>
</td>
<td>
<input type="checkbox" id="socket3" name="socket">
<input type="checkbox" id="socket3" name="socket" onchange="SetSocket()">
</td>
</tr>
<tr>
@@ -72,7 +72,7 @@
<label for="socket4">Socket-4</label>
</td>
<td>
<input type="checkbox" id="socket4" name="socket">
<input type="checkbox" id="socket4" name="socket" onchange="SetSocket()">
</td>
</tr>
<tr>
@@ -80,7 +80,7 @@
<label for="socket5">Socket-5</label>
</td>
<td>
<input type="checkbox" id="socket5" name="socket">
<input type="checkbox" id="socket5" name="socket" onchange="SetSocket()">
</td>
</tr>
<tr>
@@ -88,7 +88,7 @@
<label for="socket6">Socket-6</label>
</td>
<td>
<input type="checkbox" id="socket6" name="socket" onclick="SetSocket()">
<input type="checkbox" id="socket6" name="socket" onchange="SetSocket()">
</td>
</tr>
</table>
@@ -396,13 +396,11 @@ function SetIng(i) {
}
function SetSocket() {
SetIng(0);
var sockets_st = "";
for (var i = 0; i < checkboxs.length; i++) {
sockets_st += (checkboxs[i].checked ? "1," : "0,");
}
HttpPost("/socket", function (re) {
SetOK(0);
}, sockets_st);
}
@@ -488,19 +486,19 @@ function SubmitNetwork() {
alert("mode error: " + mode);
return;
}
SetIng(1);
SetIng(0);
HttpPost("/wifi/config", function (re) {
alert(re);
SetOK(1);
SetOK(0);
}, params);
}
function SubmitMqtt() {
SetIng(2);
SetIng(1);
var params = mqtt_addr_ipt.value + " " + mqtt_port_ipt.value;
HttpPost("/mqtt/config", function (re) {
alert(re);
SetOK(2);
SetOK(1);
}, params);
}
@@ -585,9 +583,9 @@ function AddTimedTask() {
alert("CMD ERROR!");
}
SetIng(3);
SetIng(2);
HttpPost("/task", function (re) {
SetOK(3);
SetOK(2);
GetTimedTask();
}, cmd);
}
@@ -595,16 +593,16 @@ function AddTimedTask() {
function DelTimedTask() {
var time = "123456";
HttpPost("/task?time="+time, function (re) {
SetOK(3);
SetOK(2);
GetTimedTask();
}, time);
}
function OtaStart() {
ato_url = document.getElementById("ato_url").value;
SetIng(4);
SetIng(3);
HttpPost("/ota", function (re) {
SetOK(4);
SetOK(3);
OtaStatus();
}, ato_url);
}