QQBot/web/openDoor.html
2021-12-20 01:01:07 +08:00

55 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>开门</title>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="myDiy">
<button id="myButton" type="button" class="button layui-btn-radius layui-btn layui-btn-lg layui-btn-normal">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</div>
</body>
<script src="layui/layui.js"></script>
<script src="layui/jquery-3.2.1.js"></script>
<script>
$('#myButton').click(function () {
$.get('/door/set.do?status=open', function (ret) {
if (ret === "1") {
let index = layer.load(2,{ shade: [0.45, '#57606f'] });
load(index)
}
})
})
function load(index) {
$.get("/door/status.do", function (ret) {
if(ret==="1"){
layer.close(index)
layer.msg("已开门")
}else {
load(index)
}
});
}
</script>
<style>
.myDiy {
width: 40%;
height: 300px;
margin-top: 100px;
margin-left: 35%;
}
.button {
width: 300px;
height: 300px;
font-size: 3em;
}
</style>
</html>