<!DOCTYPE HTML>
< html lang = "zh" >
< head >
< meta charset = "utf-8" >
< meta name = "renderer" content = "webkit|ie-comp|ie-stand" >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" / >
< title > 长春市装备信息管理系统< / title >
< meta name = "viewport" content = "width=device-width,initial-scale=1,user-scalable=no" / >
<!-- 手机端禁止缩放 -->
< meta content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name = "viewport" / >
<!-- 关键词,5个左右,单个8汉字以内 -->
<!-- 网站描述 -->
<!-- 自己的样式 -->
< link href = "./tbcss/public.css" rel = "stylesheet" type = "text/css" / >
< link href = "./tbcss/SignIn.css" rel = "stylesheet" type = "text/css" >
< script src = "./component/pear/jsencrypt.min.js" > < / script >
< script src = "./admin/js/jquery-3.6.0.min.js" > < / script >
< script src = "./component/pear/base64.js" > < / script >
< / head >
< body >
< div class = "all-content" >
< div class = "content clearfix" >
< div class = "left-img" >
< img src = "./img/left-img_tk.png" >
< / div >
< div class = "right-content clearfix" >
< div class = "content-name" >
< p style = "font-size: 20px;font-weight: bolder;margin-left: 70px;color: #6998F4;" id = "system_name" > 长春市装备信息管理系统< / p >
< / div >
< form action = "" method = "post" >
< div class = "user-name" >
< div class = "user-name-li" >
< img src = "./img/user_tb.png" >
< input type = "text" placeholder = "用户名" name = "loginName" id = "usernameTxt" >
< / div >
< / div >
< div class = "password" >
< div class = "password-li" >
< img src = "./img/pass_tb.png" >
< input type = "password" autocomplete = "off" placeholder = "密码" name = "password" id = "passwordTxt" >
< / div >
< / div >
< div class = "vcode" >
< div class = "vcode-li" >
< img src = "./img/v_code_tb.png" >
< input type = "text" placeholder = "验证码" autocomplete = "off" name = "captcha" id = "captchaTxt"
value="dsideal">
< img class = "vcode-img" id = "userCaptchaImage" src = "/dsBase/loginPerson/getCaptcha"
alt="点击图片刷新校验码" style="cursor:pointer" onclick="javascript:refreshCaptcha()" />
< / div >
< / div >
< input id = "loginBtn" class = "input-button" type = "button" value = "登 录"
style="background-color: #6998F4;">
< / form >
< / div >
< / div >
< / div >
< div class = "footer" id = "footer" >
< / div >
< script >
$(function () {
$("#loginBtn").click(function () {
doLogin();
});
});
//刷新验证码
function refreshCaptcha() {
$("#userCaptchaImage").attr("src", "/dsBase/loginPerson/getCaptcha?rnd=" + Math.random().toString().slice(-6));
}
$(document).keydown(function (event) {
if (event.keyCode === 13) {//回车键对应code值为13
doLogin();
}
});
function doLogin() {
var username = $("#usernameTxt").val();
var password = $("#passwordTxt").val();
var captcha = $("#captchaTxt").val();
if (username.length === 0 || password.length === 0) {
alert("用户名或密码不允许为空!")
return;
}
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 (res) {
if (res.success) {
window.location.href = '/dsWeb/index.html';
}else{
alert(res.msg);
}
}
});
}
}
//用户登录检查
function userLoginCheck(username, password, captcha) {
if (username == null || username == "") {
alert("用户名不允许为空!");
return false;
}
if (password == null || password == "") {
alert("密码不允许为空!");
return false;
}
if (captcha == null || captcha == "") {
alert("验证码不允许为空!");
return false;
}
return true;
}
//开启错误提示
function showError(error) {
$(".form-error").find("label").html(error);
$(".form-error").show();
}
getPageInfo();
//获取页面信息
function getPageInfo() {
$.ajax({
type: "GET",
dataType: "json",
url: "/dsBase/global/getGlobalByCodes",
data: {
"global_codes": Base64.encode("system_name,copy_right")
},
async: false,
success: function (result) {
$('title').html(result.data[0].global_value);
$("#system_name").html(result.data[0].global_value);
$("#footer").html(result.data[1].global_value);
}
});
}
< / script >
< / body >
< / html >