login.html
3.1 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
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>智慧水库巡检系统</title>
<link rel="stylesheet" type="text/css" href="/inspection/com/login.css"/>
</head>
<body>
<div class="mask">
<div class="conbox">
<div class="left">
<p>HELLO!</p>
<p>欢迎使用</p>
<p>智慧水库巡检系统</p>
</div>
<div class="right">
<div class="box">
<div class="top">
<img src="/inspection/com/logo.png" >
<h3>登陆</h3>
<h4>欢迎使用 <br>智慧巡检</h4>
</div>
<div class="form">
<form id='form' method="POST" action="{:url('index/user/login')}">
<input type="hidden" name="url" value="{$url|htmlentities}"/>
{:token()}
<input type="text" name="account" placeholder="请输入账号"/>
<input type="password" name="password" placeholder="请输入密码"/>
<div class="check">
<input type="checkbox" name="keeplogin" value="1">
<label>记住账号</label>
</div>
<button class="btn" type="button" onclick="login()">登陆</button>
</form>
</div>
<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 class="tips">
<p>智慧水库巡检系统</p>
<p>Copyright © 2021 TENYES Incorporated. All rights reserved</p>
</div>
</div>
</div>
</div>
</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>