< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" / >
< title > 系统登录< / title >
< link rel = "stylesheet" type = "text/css" href = "./admin/css/other/login.css" / >
< script type = "text/javascript" src = "./admin/js/jquery-3.6.0.min.js" > < / script >
< script type = "text/javascript" src = "./admin/js/jsencrypt.min.js" > < / script >
< / head >
< body >
< div id = "header" style = "margin-top: 15px;" >
< img src = "./admin/images/jyjlogo_1.png" style = "margin-left: 30px;margin-top: 8px;width: 96px;height:96px" / >
< span style = "font-size:36px;display: block;margin-left: 133px;margin-top: -84px;font-weight:bold"
id="system_name">< / span >
< / div >
< div class = "login-wrap" style = "margin-top: 45px;" >
< div class = "wrap clearfix" >
< img src = "./admin/images/login-img.png" style = "margin-top: 22px;" / >
< div class = "form-box fr loginV2" style = "display: block;" >
< ul class = "form-tab clearfix" >
< li class = "tab-li cur" >
< a href = "javascript:;" tjjj = "passport.login_type.login_name" > 账户登录< / a > < / li >
< / ul >
< div class = "form-con" >
< div class = "login-normal" style = "display: block;" >
< form id = "nameLoginForm" >
< div class = "form-error" style = "" >
< i >
< / i >
< label class = "text" > < / label >
< / div >
< dl class = "clearfix" >
< dt > 账< em > < / em > 户:< / dt >
< dd >
< input type = "text" name = "loginName" id = "usernameTxt" value = "" class = "input-text"
autocomplete="off" placeholder="账户名"/>< / dd >
< / dl >
< dl class = "top1 clearfix" >
< dt > 密< em > < / em > 码:< / dt >
< dd >
< input type = "password" name = "password" id = "passwordTxt" value = "" class = "input-text"
placeholder="请输入密码">< / dd >
< / dl >
< dl class = "top2 clearfix" >
< dt > 验证码:< / dt >
< dd >
< input name = "smsCaptcha" type = "text" id = "captchaTxt" class = "input-yzm" maxlength = "4" autocomplete = "off" / >
< span class = "span-yzm" >
< img id = "userCaptchaImage" src = "/dsBase/loginPerson/getCaptcha?id=1" title = "点击图片刷新校验码" alt = "点击图片刷新校验码" style = "cursor:pointer" onclick = "javascript:refreshCaptcha()" / >
< a onclick = "javascript:refreshCaptcha()" class = "forget-pass" style = "cursor:pointer" > 换一张< / a > < / span >
< / dd >
< / dl >
< div class = "btn-box clearfix" style = "margin-top: 10px;" >
< input id = "loginBtn" class = "btn-settlement" type = "button" value = "登 录"
tjjj="passport.button.login">< / div >
< / form >
< / div >
< / div >
< / div >
< / div >
< / div >
< div style = "text-align:center" id = "copyright" >
< / div >
< / body >
< script type = "text/javascript" >
$(function () {
$("#loginBtn").click(function () {
doLogin();
});
//获取页面信息,包括系统名称,版权信息
getPageInfo();
});
$(document).keydown(function (event) {
if (event.keyCode === 13) {//回车键对应code值为13
doLogin();
}
});
//刷新验证码
function refreshCaptcha() {
$("#userCaptchaImage").attr("src", "/dsBase/loginPerson/getCaptcha?id=" + new Date() + Math.floor(Math.random() * 24));
}
function doLogin() {
var username = $("#usernameTxt").val();
var password = $("#passwordTxt").val();
var captcha = $("#captchaTxt").val();
userLogin(username, password, captcha);
}
//用户名登录
function userLogin(username, password,captcha) {
var publicKey = "-----BEGIN PUBLIC KEY-----\MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcd+0zTY9Gn94iqkQJTlxYnEnCeFsLkk0a7hoAvi2B74VzDVV3xH0ZO9RkXvo1SgCB+uzbEWdrgQkzTqyjfTtgOguu3OnkVxIMJF34ibchTY0LWHGxq1m2gLGuVVqrlu1LtdV0X7xo/5zc8Mr+46veWb86kSpqe6rOAm69WWo5GwIDAQAB\-----END PUBLIC KEY-----";
var encrypt = new JSEncrypt();
encrypt.setPublicKey(publicKey);
if (userLoginCheck(username, password,captcha)) {
$.ajax({
type: "POST",
dataType: "json",
url: "/dsBase/loginPerson/doLogin",
data: {
"username": username,
"password": encrypt.encrypt(password),
"captcha": captcha
},
async: false,
success: function (result) {
if (result.success) {
window.location.href = '/dsBase/index.html';
}
else {
showError(result.msg);
refreshCaptcha();
}
}
});
}
}
//用户登录检查
function userLoginCheck(username, password,captcha) {
if (username == null || username == "") {
showError("用户名不允许为空!");
return false;
}
if (password == null || password == "") {
showError("密码不允许为空!");
return false;
}
if (captcha == null || captcha == "") {
showError("验证码不允许为空!");
return false;
}
return true;
}
//开启错误提示
function showError(error) {
$(".form-error").find("label").html(error);
$(".form-error").show();
}
//获取页面信息
function getPageInfo() {
$.ajax({
type: "POST",
dataType: "json",
url: "/dsBase/global/getGlobalValueByKey",
data: {
"key": "title,copy_right"
},
async: false,
success: function (result) {
if (result.success) {
$("#system_name").html(result.title);
$("#copyright").html(result.copy_right);
$('title').html(result.title);
}
}
});
}
< / script >
< / html >