2025-05-20 13:54:27 +08:00
|
|
|
<!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">
|
|
|
|
|
<link href="js/layui2.7.6/css/layui.css" type="text/css" rel="stylesheet">
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<div class="tou centers">
|
|
|
|
|
<div class="login">
|
|
|
|
|
<div style="height: 10%;width: 100%; margin-top: 5%;">
|
|
|
|
|
<div class="message">线路施工承载力管控系统</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="height: 10%;width: 100%; ">
|
|
|
|
|
<div class="message">欢迎登录!</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="width: 76%; margin-left: 5%; margin-top: 18%;">
|
|
|
|
|
<div class="input-container">
|
|
|
|
|
<span class="icon photo"></span> <!-- 用户名图标 -->
|
|
|
|
|
<input id="username" name="username" placeholder="请输入手机号" type="text" autocomplete="off">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<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">
|
|
|
|
|
|
|
|
|
|
<div class="input-container">
|
|
|
|
|
<span class="icon code"></span> <!-- 验证码 -->
|
|
|
|
|
<input style="width: 60%;" id="verifyCode" name="verifyCode" placeholder="请输入验证码" type="text"
|
|
|
|
|
maxlength="4" autocomplete="off">
|
|
|
|
|
|
|
|
|
|
<input id="uuid" type="hidden" name="uuid" />
|
|
|
|
|
<img id="vCode" class="vCode" title="看不清,请点我" onclick="getVerifyCode()"
|
|
|
|
|
onmouseover="mouseover(this)" style=" position: relative;left: 18px;" />
|
|
|
|
|
<!-- <span class=" refresh"> </span>-->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr class="hr15">
|
|
|
|
|
|
|
|
|
|
<div class="input-container" style="display: flex;justify-content: space-between;">
|
|
|
|
|
<label style="color: #666666;font-size: 15px;">
|
|
|
|
|
<input type="checkbox" name="remember" id="remember" value="1">记住密码
|
|
|
|
|
</label>
|
|
|
|
|
<!-- <a href="#" style="font-size: 16px;color: #1991FF">忘记密码?</a>-->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr class="hr15">
|
|
|
|
|
<button
|
|
|
|
|
style="width: 100%;height: 40px; background-color: rgba(0,133,255,0.9);color: #ffffff;letter-spacing: 5px; font-size: 16px;"
|
|
|
|
|
type="submit" onclick="login(this)">
|
|
|
|
|
登录
|
|
|
|
|
</button>
|
|
|
|
|
<span id="info" style="color: red"></span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!--<div class="login">
|
|
|
|
|
<div class="message">后台管理系统</div>
|
|
|
|
|
<div id="darkbannerwrap"></div>
|
|
|
|
|
|
|
|
|
|
<form id="login-form" method="post" onsubmit="return false;">
|
|
|
|
|
<input id="username" name="username" placeholder="用户名" type="text" value="admin"
|
|
|
|
|
autocomplete="off">
|
|
|
|
|
<hr class="hr15">
|
|
|
|
|
<input id="password" name="password" placeholder="密码" type="password" value="admin"
|
|
|
|
|
autocomplete="off">
|
|
|
|
|
<input type="text" class="form-control" id="verifyCode" name="verifyCode" maxlength="4" required="required" placeholder="请输入验证码">
|
|
|
|
|
<input id="uuid" type="hidden" name="uuid" />
|
|
|
|
|
<img id="vCode" class="vCode" title="看不清,请点我" onclick="getVerifyCode()" onmouseover="mouseover(this)" />
|
|
|
|
|
<hr class="hr15">
|
|
|
|
|
<button style="width: 100%;" type="submit"
|
|
|
|
|
onclick="login(this)">登录</button>
|
|
|
|
|
<hr class="hr20">
|
|
|
|
|
<span id="info" style="color: red"></span>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>-->
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
<script src="js/jquery/jquery-3.6.0.js"></script>
|
|
|
|
|
<script src="js/layui2.7.6/layui.js"></script>
|
|
|
|
|
<script src="js/aes.js"></script>
|
|
|
|
|
<script src="js/publicJs.js"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
layui.use('layer', function () {
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
getVerifyCode();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 在页面加载完成后执行的函数
|
|
|
|
|
window.onload = function () {
|
|
|
|
|
// 获取记住密码复选框元素
|
|
|
|
|
var rememberCheckbox = document.getElementById('remember');
|
|
|
|
|
|
|
|
|
|
// 获取用户名和密码输入框元素
|
|
|
|
|
var usernameInput = document.getElementById('username');
|
|
|
|
|
var passwordInput = document.getElementById('password');
|
|
|
|
|
|
|
|
|
|
// 检查本地存储中是否存在记住的用户名和密码
|
|
|
|
|
if (localStorage.getItem('rememberedUsername') && localStorage.getItem('rememberedPassword')) {
|
|
|
|
|
// 填充用户名和密码到输入框
|
|
|
|
|
usernameInput.value = localStorage.getItem('rememberedUsername');
|
|
|
|
|
passwordInput.value = localStorage.getItem('rememberedPassword');
|
|
|
|
|
|
|
|
|
|
// 将记住密码复选框选中
|
|
|
|
|
rememberCheckbox.checked = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.login(function () {
|
|
|
|
|
$("#info").html('');
|
|
|
|
|
});
|
|
|
|
|
if (top != self) {
|
2025-10-28 14:37:54 +08:00
|
|
|
location.href = contentPath+'/login.html';
|
2025-05-20 13:54:27 +08:00
|
|
|
}
|
|
|
|
|
var token = localStorage.getItem("token");
|
|
|
|
|
if (token != null && token.trim().length != 0) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'get',
|
|
|
|
|
url: ctxPath + '/users/current?token=' + token,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
localStorage.setItem("userId", data.id);
|
2025-10-28 14:56:50 +08:00
|
|
|
<<<<<<< .mine
|
2025-10-28 14:37:54 +08:00
|
|
|
window.location.href=contentPath+"/index.html";
|
2025-10-28 14:56:50 +08:00
|
|
|
|
|
|
|
|
=======
|
2025-05-20 16:19:38 +08:00
|
|
|
// location.href = ctxPath + '/index.html';
|
|
|
|
|
location.href = pagesPath + '/index.html';
|
2025-10-28 14:56:50 +08:00
|
|
|
>>>>>>> .theirs
|
2025-05-20 13:54:27 +08:00
|
|
|
},
|
|
|
|
|
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",
|
|
|
|
|
//请求的媒体类型
|
2025-10-28 14:56:50 +08:00
|
|
|
<<<<<<< .mine
|
2025-10-28 14:37:54 +08:00
|
|
|
// contentType: "application/json;charset=UTF-8",
|
|
|
|
|
|
2025-10-28 14:56:50 +08:00
|
|
|
=======
|
2025-05-20 16:19:38 +08:00
|
|
|
// contentType: "application/json;charset=UTF-8",
|
2025-10-28 14:56:50 +08:00
|
|
|
|
|
|
|
|
>>>>>>> .theirs
|
2025-05-20 13:54:27 +08:00
|
|
|
//请求地址
|
|
|
|
|
url: url,
|
|
|
|
|
//请求成功
|
|
|
|
|
success: function (result) {
|
|
|
|
|
console.log(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) {
|
|
|
|
|
$(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: {
|
2025-10-28 14:37:54 +08:00
|
|
|
username: encrypt(username),
|
|
|
|
|
password: encrypt(password),
|
2025-05-20 13:54:27 +08:00
|
|
|
verifyCode: verifyCode,
|
|
|
|
|
uuid: uuid
|
|
|
|
|
},
|
|
|
|
|
success: function (data) {
|
|
|
|
|
localStorage.setItem("token", data.token);
|
|
|
|
|
var rememberCheckbox = document.getElementById('remember');
|
|
|
|
|
if (rememberCheckbox.checked) {
|
|
|
|
|
// 保存用户名和密码到本地存储
|
|
|
|
|
localStorage.setItem('rememberedUsername', username);
|
|
|
|
|
localStorage.setItem('rememberedPassword', password);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
localStorage.setItem('userName', encrypt(username));
|
|
|
|
|
localStorage.setItem('passWord', encrypt(password));
|
|
|
|
|
//以前密码复杂度校验
|
|
|
|
|
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 () {
|
2025-10-28 14:56:50 +08:00
|
|
|
<<<<<<< .mine
|
2025-05-20 13:54:27 +08:00
|
|
|
// location.href = ctxPath + '/index.html';
|
2025-10-28 14:37:54 +08:00
|
|
|
window.location.href=contentPath+"/index.html";
|
|
|
|
|
//location.href = '/index.html';
|
2025-10-28 14:56:50 +08:00
|
|
|
=======
|
2025-05-20 16:19:38 +08:00
|
|
|
location.href = pagesPath + '/index.html';
|
|
|
|
|
// location.href = 'http://127.0.0.1:5502/index.html';
|
2025-10-28 14:56:50 +08:00
|
|
|
|
|
|
|
|
>>>>>>> .theirs
|
2025-05-20 13:54:27 +08:00
|
|
|
});
|
|
|
|
|
} else {
|
2025-10-28 14:56:50 +08:00
|
|
|
<<<<<<< .mine
|
2025-05-20 13:54:27 +08:00
|
|
|
// location.href = ctxPath + '/index.html';
|
2025-10-28 14:37:54 +08:00
|
|
|
window.location.href=contentPath+"/index.html";
|
2025-10-28 14:56:50 +08:00
|
|
|
=======
|
2025-05-20 16:19:38 +08:00
|
|
|
location.href = pagesPath + '/index.html';
|
|
|
|
|
// location.href = 'http://127.0.0.1:5502/index.html';
|
2025-10-28 14:56:50 +08:00
|
|
|
>>>>>>> .theirs
|
2025-05-20 13:54:27 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
|
|
|
var msg = xhr.responseText;
|
|
|
|
|
var response = JSON.parse(msg);
|
|
|
|
|
$("#info").html(response.message);
|
|
|
|
|
getVerifyCode();
|
|
|
|
|
$(obj).attr("disabled", false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当日时间
|
|
|
|
|
*/
|
|
|
|
|
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>
|
|
|
|
|
<script>
|
|
|
|
|
$(document).keydown(function (event) {
|
|
|
|
|
if (event.keyCode == 13) {
|
|
|
|
|
document.getElementById("login").click();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
</html>
|