199 lines
5.6 KiB
HTML
199 lines
5.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta http-equiv="Pragma" content="no-cache">
|
|
<meta http-equiv="Cache-Control" content="no-cache">
|
|
<meta http-equiv="Expires" content="0">
|
|
<title>登录</title>
|
|
<link href="css/login.css" type="text/css" rel="stylesheet">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="tou centers">
|
|
<div class="login">
|
|
<div class="centers title">
|
|
<!--线路施工承载力管控系统-->
|
|
湘送承载力管控系统
|
|
</div>
|
|
|
|
<form id="login-form" method="post" onsubmit="return false;">
|
|
<div class="input-container">
|
|
<span class="icon photo"></span> <!-- 用户名图标 -->
|
|
<input id="username" name="username" placeholder="请输入用户名" type="text" autocomplete="off">
|
|
</div>
|
|
|
|
<hr class="hr15">
|
|
<hr class="hr15">
|
|
<div class="input-container">
|
|
<span class="icon pwd"></span> <!-- 密码图标 -->
|
|
<input id="password" name="password" placeholder="请输入密码" type="password" autocomplete="off">
|
|
</div>
|
|
|
|
<hr class="hr15">
|
|
<hr class="hr15">
|
|
<div class="input-container">
|
|
<span class="icon code"></span> <!-- 验证码 -->
|
|
<input style="width: 60%;" id="verifyCode" name="verifyCode" placeholder="请输入验证码" type="text"
|
|
maxlength="6" autocomplete="off">
|
|
|
|
<input id="uuid" type="hidden" name="uuid" />
|
|
<img id="vCode" title="验证码" onclick="getVerifyCode()" onmouseover="mouseover(this)"
|
|
style="margin-left: 9.5%; position: relative;top: 15px;left: 18px;" />
|
|
|
|
</div>
|
|
|
|
<hr class="hr15">
|
|
<hr class="hr15">
|
|
|
|
<div class="input-container" style="display: flex;justify-content: space-between;">
|
|
<label style="color: #D0D5DC;font-size: 16px;">
|
|
<input type="checkbox" name="remember" value="1">记住密码
|
|
</label>
|
|
<a href="#" style="font-size: 16px;">忘记密码?</a>
|
|
</div>
|
|
|
|
<hr class="hr15">
|
|
<hr class="hr15">
|
|
<button
|
|
style="width: 100%; background-color: #099EF1;color: #ffffff; letter-spacing: 5px; font-size: 18px;"
|
|
type="submit" onclick="login(this)">
|
|
登录
|
|
</button>
|
|
<hr class="hr20">
|
|
<span id="info" style="color: red"></span>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
<script src="js/libs/jquery.min.js"></script>
|
|
<script src="js/aes.js"></script>
|
|
<script src="js/publicJs.js"></script>
|
|
<script type="text/javascript">
|
|
var code;
|
|
var uuid;
|
|
$(document).ready(function () {
|
|
getVerifyCode();
|
|
});
|
|
if (top != self) {
|
|
// parent.location.href = '/login.html';
|
|
}
|
|
window.login(function () {
|
|
$("#info").html('');
|
|
});
|
|
if (top != self) {
|
|
//parent.location.href = '/login.html';
|
|
}
|
|
var token = localStorage.getItem("czldp-token");
|
|
// if (token != null && token.trim().length != 0) {
|
|
// $.ajax({
|
|
// type: 'get',
|
|
// url: ctxPath + '/users/current?token=' + token,
|
|
// success: function (data) {
|
|
// location.href = pagesPath + '/pages/home/home.html';
|
|
// },
|
|
// error: function (xhr, textStatus, errorThrown) {
|
|
// var msg = xhr.responseText;
|
|
// var response = JSON.parse(msg);
|
|
// var code = response.code;
|
|
// var message = response.message;
|
|
// if (code == 401) {
|
|
// localStorage.removeItem("token");
|
|
// }
|
|
// }
|
|
// });
|
|
// }
|
|
//获取验证码
|
|
function getVerifyCode() {
|
|
var url = ctxPath + "/getCode/vCode?" + Math.random();
|
|
$.ajax({
|
|
//请求方式
|
|
type: "GET",
|
|
//请求的媒体类型
|
|
// contentType: "application/json;charset=UTF-8",
|
|
//请求地址
|
|
url: url,
|
|
//请求成功
|
|
success: function (result) {
|
|
console.log(result);
|
|
$("#uuid").val(result.obj.uuid);
|
|
$("#vCode").attr("src", "data:image/png;base64," + result.obj.img);
|
|
code = result.resMsg;
|
|
uuid = result.obj.uuid;
|
|
//fastLogin();
|
|
},
|
|
//请求失败,包含具体的错误信息
|
|
error: function (e) {
|
|
console.log(e.status);
|
|
console.log(e.responseText);
|
|
}
|
|
});
|
|
}
|
|
|
|
function mouseover(obj) {
|
|
obj.style.cursor = "pointer";
|
|
}
|
|
|
|
|
|
function login(obj) {
|
|
//$(obj).attr("disabled", true);
|
|
var username = $.trim($('#username').val());
|
|
var password = $.trim($('#password').val());
|
|
var verifyCode = $.trim($('#verifyCode').val());
|
|
var uuid = $.trim($('#uuid').val());
|
|
|
|
if (username == "" || password == "") {
|
|
$("#info").html('用户名或者密码不能为空');
|
|
$(obj).attr("disabled", false);
|
|
} else {
|
|
$.ajax({
|
|
type: 'post',
|
|
url: ctxPath + '/login',
|
|
data: {
|
|
username: encrypt(username),
|
|
password: encrypt(password),
|
|
verifyCode: verifyCode,
|
|
uuid: uuid
|
|
},
|
|
success: function (data) {
|
|
localStorage.setItem("czldp-token", data.token);
|
|
location.href = 'pages/home/home.html';
|
|
//以前密码复杂度校验
|
|
// let pattern = /^(?![0-9]+$)(?![0-9\W]+$)(?![0-9A-Z]+$)(?![0-9a-z]+$)(?![a-z\W]+$)(?![A-Z\W]+$)[0-9A-Za-z\W]{8,16}$/;
|
|
// if(!pattern.test(password)) {
|
|
// parent.layer.msg('密码过于简单,请尽快修改密码', {icon: 2, time: 3000,area: ['350px', '70px']},function () {
|
|
// location.href = ctxPath + '/index.html';
|
|
// });
|
|
// }else{
|
|
// location.href = ctxPath + '/home.html';
|
|
// }
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
var msg = xhr.responseText;
|
|
var response = JSON.parse(msg);
|
|
$("#info").html(response.message);
|
|
getVerifyCode();
|
|
//$(obj).attr("disabled", false);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
$(document).keydown(function (event) {
|
|
if (event.keyCode == 13) {
|
|
document.getElementById("login").click();
|
|
}
|
|
});
|
|
function GetQueryString(name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (r != null) return unescape(r[2]); return null;
|
|
}
|
|
|
|
</script>
|
|
|
|
</html> |