hn_cloud_web/login.html

149 lines
4.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="public/login/css/login.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="public/login/css/layui.css">
</head>
<body>
<div class="login" style="margin-left: 48%;">
<div class="message">后台管理系统</div>
<div class="message" style="color: red;width: 500px;margin-left: -10%;">涉密不上网,上网不涉密</div>
<div id="darkbannerwrap"></div>
<div id="loginDiv">
<div id="login-form" >
<div style="overflow: hidden;width: 100%;">
<img id="nameImg" src="public/login/image/我的.png" style="float: left;display: inline-block;margin-top: 3%;margin-right: 2%;">
<input id="username" name="username" placeholder="手机号" type="text" style="float: left;display: inline-block"
autocomplete="off">
<!-- <hr class="hr15">-->
</div>
<hr class="hr15">
<div style="overflow: hidden;width: 100%;">
<img id="passwordImg" src="public/login/image/密码.png" style="float: left;display: inline-block;margin-top: 3%;margin-right: 2%;">
<input id="pwd" name="password" placeholder="密码" type="password" style="float: left;display: inline-block"
autocomplete="off">
</div>
<hr class="hr15">
<div style="overflow: hidden;width: 100%;">
<img id="vCodeImg" src="public/login/image/验证码.png" style="float: left;display: inline-block;margin-top: 3%;margin-right: 2%;">
<input type="text" class="form-control" name="verifyCode" id="verifyCode" required="required" placeholder="验证码">
<input id="uuid" type="hidden" name="uuid" />
<img id="vCode" title="看不清,请点我" onclick="getVerifyCode()" onmouseover="mouseover(this)" style="margin-left: 9.5%" />
</div>
<hr class="hr15">
<button style="width: 92%;height: 37px;margin-left: 8%;" type="submit"
onclick="login(this);"></button>
<hr class="hr20">
<span id="info" style="color: red"></span>
</div>
</div>
</div>
</body>
<script src="public/login/js/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="public/login/js/layui.js"></script>
<script src="public/login/js/aes.js"></script>
<script src="public/login/public.js"></script>
<script type="text/javascript">
getVerifyCode();
//获取验证码
function getVerifyCode() {
var url = IP_ADDRESS+"/code?" + Math.random();
$.ajax({
//请求方式
type : "GET",
//请求的媒体类型
//请求地址
url : url,
//请求成功
success : function(result) {
$("#uuid").val(result.uuid);
$("#vCode").attr("src","data:image/png;base64," + result.img);
},
//请求失败,包含具体的错误信息
error : function(e){
console.log(e.status);
console.log(e.responseText);
}
});
}
function mouseover(obj) {
obj.style.cursor = "pointer";
}
function login(obj) {
var username = $.trim($('#username').val());
var password = $.trim($('#pwd').val());
var verifyCode = $.trim($('#verifyCode').val());
var uuid = $.trim($('#uuid').val());
if (username == "" || password == "") {
$("#info").html('用户名或者密码不能为空');
} else {
$.ajax({
type : 'post',
url : IP_ADDRESS + '/realname/allSystem/login',
contentType:'application/json;charset=UTF-8',
data :JSON.stringify( {
username:encryptCBC(username),
password:encryptCBC(password),
code:verifyCode,
uuid:uuid
}),
success : function(data) {
if(data && data.code){
if(data.code=='200'){
window.location.href="home.html";
}else{
$("#info").html(data.msg);
getVerifyCode();
}
}else{
$("#info").html(data.msg);
getVerifyCode();
}
},
error : function(xhr, textStatus, errorThrown) {
var msg = xhr.responseText;
var response = JSON.parse(msg);
$("#info").html(response.message);
getVerifyCode();
}
});
}
}
/**
* 获取当日时间
*/
function getNowTime() {
var nowDate = new Date();
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) :
nowDate.getMonth() + 1;
var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
var h =nowDate.getHours();
var m=nowDate.getMinutes();
var s=nowDate.getSeconds();
var dateStr = year + "-" + month + "-" + day+" "+h+":"+m+":"+s;
return dateStr;
}
</script>
</html>