预备开门页面及接口
This commit is contained in:
55
web/openDoor.html
Normal file
55
web/openDoor.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!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%;
|
||||
height: 300px;
|
||||
margin-top: 35%;
|
||||
margin-left: 35%;
|
||||
}
|
||||
|
||||
.button {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</html>
|
||||
Reference in New Issue
Block a user