2021-12-20 00:47:02 +08:00
|
|
|
<!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">
|
|
|
|
开 门
|
|
|
|
</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%;
|
2021-12-20 00:59:16 +08:00
|
|
|
height: 40%;
|
|
|
|
margin-top: 15%;
|
2021-12-20 00:47:02 +08:00
|
|
|
margin-left: 35%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.button {
|
|
|
|
width: 300px;
|
|
|
|
height: 300px;
|
|
|
|
font-size: 3em;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</html>
|