login.html
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>智慧水库监测设备集约化管控平台</title>
<script src="/equipment/com/check.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="/equipment/com/login.css" />
</head>
<body>
<div class="box">
<form id='form' method="POST" action="{:url('index/user/login')}" class="form">
<div class="top">
<h3>登陆</h3>
<div class="summary">
<h4>智慧水库监测设备集约化管控平台</h4>
</div>
<input type="hidden" name="url" value="{$url|htmlentities}"/>
{:token()}
<p>
<span>管理员账号:</span>
<input type="text" name="account" id="" value="" />
</p>
<p>
<span>管理员密码:</span>
<input type="password" name="password" id="" value="" />
</p>
<p class="check">
<input type="checkbox" name="keeplogin" value="1" >
<label>记住账号</label>
</p>
</div>
<button class="btn" type='button' onclick="login()">登陆</button>
</form>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.5.1/layer.js"></script>
<script>
function login(){
let account = $('input[name="account"]').val();
let password = $('input[name="password"]').val();
if(account==''){
layer.msg('请填写账号');
return;
}
let data = $('#form').serialize();
if(password==''){
layer.msg('请填写密码');
return;
}
$.post("{:url('index/user/login')}",data,function(res){
if(res.code==0){
layer.msg(res.msg);
$('input[name="__token__"]').val(res.data.token);
return;
}
setTimeout(function(){
layer.msg('登录成功');
location.href= $('input[name="url"]').val();
},1000)
});
}
</script>
</div>
<div class="tips">
<p>智慧水库监测设备集约化管控平台</p>
</div>
</body>
</html>
<script type="text/javascript">
document.body.onmousedown = function (event) {
event = event || window.event;
var target = event.target || event.srcElement;
if (target.type === 'radio') {
target.previousValue = target.checked;
}
}
document.body.onclick = function (event) {
event = event || window.event;
var target = event.target || event.srcElement;
if (target.type === 'radio') {
if (target.previousValue) {
target.checked = false;
}
}
}
</script>