|
@@ -9,11 +9,12 @@
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
<meta name="format-detection" content="telephone=no">
|
|
<meta name="format-detection" content="telephone=no">
|
|
|
- <link rel="stylesheet" href="lib/layui-v2.5.5/css/layui.css" media="all">
|
|
|
|
|
-<!-- <!–[if lt IE 9]>-->
|
|
|
|
|
-<!-- <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>-->
|
|
|
|
|
-<!-- <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>-->
|
|
|
|
|
-<!-- <![endif]–>-->
|
|
|
|
|
|
|
+ <link rel="icon" href="images/favicon.ico">
|
|
|
|
|
+ <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
|
|
|
|
|
+ <!--[if lt IE 9]>
|
|
|
|
|
+ <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
|
|
|
|
+ <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
|
|
|
|
+ <![endif]-->
|
|
|
<style>
|
|
<style>
|
|
|
html, body {
|
|
html, body {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -22,24 +23,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
body {
|
|
|
- /*background: #0C3A79;*/
|
|
|
|
|
- background-image: url("./images/loginBg.png");
|
|
|
|
|
- margin: 0;
|
|
|
|
|
- padding: 0;
|
|
|
|
|
- background-size: cover;
|
|
|
|
|
- background-repeat: no-repeat;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .admin-login-background {
|
|
|
|
|
- margin: 0 auto;
|
|
|
|
|
- margin-top: 20px;
|
|
|
|
|
- width: 360px;
|
|
|
|
|
- height: 300px;
|
|
|
|
|
- /*position: absolute;*/
|
|
|
|
|
- /*left: 50%;*/
|
|
|
|
|
- /*top: 40%;*/
|
|
|
|
|
- /*margin-left: -180px;*/
|
|
|
|
|
- /*margin-top: -100px;*/
|
|
|
|
|
|
|
+ background: #1E9FFF;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
body:after {
|
|
body:after {
|
|
@@ -65,6 +49,16 @@
|
|
|
overflow: hidden
|
|
overflow: hidden
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ .admin-login-background {
|
|
|
|
|
+ width: 360px;
|
|
|
|
|
+ height: 300px;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 50%;
|
|
|
|
|
+ top: 40%;
|
|
|
|
|
+ margin-left: -180px;
|
|
|
|
|
+ margin-top: -100px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.logo-title {
|
|
.logo-title {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
letter-spacing: 2px;
|
|
letter-spacing: 2px;
|
|
@@ -75,18 +69,14 @@
|
|
|
color: #1E9FFF;
|
|
color: #1E9FFF;
|
|
|
font-size: 25px;
|
|
font-size: 25px;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
- text-shadow:10px 10px 10px red;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.login-form {
|
|
.login-form {
|
|
|
- /*background-color: #fff;*/
|
|
|
|
|
- /*border: 1px solid #fff;*/
|
|
|
|
|
- /*border-radius: 3px;*/
|
|
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ border: 1px solid #fff;
|
|
|
|
|
+ border-radius: 3px;
|
|
|
padding: 14px 20px;
|
|
padding: 14px 20px;
|
|
|
- /*box-shadow: 0 0 8px #eeeeee;*/
|
|
|
|
|
- /*margin-top: 150%;*/
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- bottom: 0%;
|
|
|
|
|
|
|
+ box-shadow: 0 0 8px #eeeeee;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.login-form .layui-form-item {
|
|
.login-form .layui-form-item {
|
|
@@ -107,30 +97,6 @@
|
|
|
padding-left: 36px;
|
|
padding-left: 36px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .captcha-img img {
|
|
|
|
|
- height: 34px;
|
|
|
|
|
- border: 1px solid #e6e6e6;
|
|
|
|
|
- height: 36px;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- }
|
|
|
|
|
- .bg h1{
|
|
|
|
|
- text-align: center;
|
|
|
|
|
- font-weight: 900;
|
|
|
|
|
- color: #1660B9;
|
|
|
|
|
- text-shadow: 4px 4px 7px #FFF;
|
|
|
|
|
- margin-top: 450px;
|
|
|
|
|
- }
|
|
|
|
|
- .logo{
|
|
|
|
|
- width: 150px;
|
|
|
|
|
- height: 100px;
|
|
|
|
|
- background-image: url("./images/login_logo.png");
|
|
|
|
|
- background-repeat:no-repeat;
|
|
|
|
|
- background-size:cover;
|
|
|
|
|
- }
|
|
|
|
|
- .layui-container{
|
|
|
|
|
- padding: 0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
.captcha {
|
|
.captcha {
|
|
|
width: 60%;
|
|
width: 60%;
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
@@ -148,21 +114,20 @@
|
|
|
height: 36px;
|
|
height: 36px;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- #captchaPic{
|
|
|
|
|
- cursor: pointer;
|
|
|
|
|
- }
|
|
|
|
|
</style>
|
|
</style>
|
|
|
</head>
|
|
</head>
|
|
|
<body>
|
|
<body>
|
|
|
<div class="layui-container">
|
|
<div class="layui-container">
|
|
|
<div class="admin-login-background">
|
|
<div class="admin-login-background">
|
|
|
- <div class="layui-form login-form">
|
|
|
|
|
|
|
+ <div class="layui-form login-form" lay-filter="login-form">
|
|
|
<form class="layui-form" action="">
|
|
<form class="layui-form" action="">
|
|
|
|
|
+ <div class="layui-form-item logo-title">
|
|
|
|
|
+ <h1>廉政档案系统</h1>
|
|
|
|
|
+ </div>
|
|
|
<div class="layui-form-item">
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-icon layui-icon-username"></label>
|
|
<label class="layui-icon layui-icon-username"></label>
|
|
|
<input type="text" name="account" lay-verify="required|account" placeholder="用户名或者邮箱"
|
|
<input type="text" name="account" lay-verify="required|account" placeholder="用户名或者邮箱"
|
|
|
- autocomplete="off" class="layui-input" value="admin">
|
|
|
|
|
|
|
+ autocomplete="off" class="layui-input" value="">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-icon layui-icon-password"></label>
|
|
<label class="layui-icon layui-icon-password"></label>
|
|
@@ -173,11 +138,14 @@
|
|
|
<label class="layui-icon layui-icon-vercode"></label>
|
|
<label class="layui-icon layui-icon-vercode"></label>
|
|
|
<input type="text" name="captcha" lay-verify="required|captcha" placeholder="图形验证码"
|
|
<input type="text" name="captcha" lay-verify="required|captcha" placeholder="图形验证码"
|
|
|
autocomplete="off" class="layui-input verification captcha" value="">
|
|
autocomplete="off" class="layui-input verification captcha" value="">
|
|
|
- <div class="captcha-img">
|
|
|
|
|
- <canvas id="captchaPic" width="108" height="38"></canvas>
|
|
|
|
|
|
|
+ <div class="captcha-img" style="cursor:pointer">
|
|
|
|
|
+ <img id="captchaPic">
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="layui-form-item" style="margin-top: 30px">
|
|
|
|
|
|
|
+ <div class="layui-form-item">
|
|
|
|
|
+ <input type="checkbox" id="rememberMe" name="rememberMe" value="" lay-skin="primary" title="记住密码">
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="layui-form-item">
|
|
|
<button class="layui-btn layui-btn layui-btn-normal layui-btn-fluid" lay-submit=""
|
|
<button class="layui-btn layui-btn layui-btn-normal layui-btn-fluid" lay-submit=""
|
|
|
lay-filter="login">登 入
|
|
lay-filter="login">登 入
|
|
|
</button>
|
|
</button>
|
|
@@ -197,23 +165,36 @@
|
|
|
$ = layui.jquery,
|
|
$ = layui.jquery,
|
|
|
layer = layui.layer;
|
|
layer = layui.layer;
|
|
|
|
|
|
|
|
- var captcha = [];
|
|
|
|
|
-
|
|
|
|
|
// 登录过期的时候,跳出ifram框架
|
|
// 登录过期的时候,跳出ifram框架
|
|
|
if (top.location != self.location) top.location = self.location;
|
|
if (top.location != self.location) top.location = self.location;
|
|
|
|
|
|
|
|
- // // 粒子线条背景
|
|
|
|
|
- // $(document).ready(function () {
|
|
|
|
|
- // $('.layui-container').particleground({
|
|
|
|
|
- // dotColor: '#7ec7fd',
|
|
|
|
|
- // lineColor: '#7ec7fd'
|
|
|
|
|
- // });
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ // 粒子线条背景
|
|
|
|
|
+ $(document).ready(function () {
|
|
|
|
|
+ $('.layui-container').particleground({
|
|
|
|
|
+ dotColor: '#7ec7fd',
|
|
|
|
|
+ lineColor: '#7ec7fd'
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ let readCachePassword = function (){
|
|
|
|
|
+ let a = layui.data('rememberMe')
|
|
|
|
|
+ if (a){
|
|
|
|
|
+ form.val("login-form", a.data);
|
|
|
|
|
+ form.render();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 生成验证码
|
|
|
|
|
+ let generatePictureCaptcha = function () {
|
|
|
|
|
+ http.get('system/auth/generatePictureCaptcha', {}, true, res => {
|
|
|
|
|
+ $("#captchaPic").prop('src',res.data)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 进行登录操作
|
|
// 进行登录操作
|
|
|
form.on('submit(login)', function (data) {
|
|
form.on('submit(login)', function (data) {
|
|
|
data = data.field;
|
|
data = data.field;
|
|
|
- if (data.username == '') {
|
|
|
|
|
|
|
+ if (data.account == '') {
|
|
|
layer.msg('用户名不能为空');
|
|
layer.msg('用户名不能为空');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -221,107 +202,36 @@
|
|
|
layer.msg('密码不能为空');
|
|
layer.msg('密码不能为空');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- // 正确验证码
|
|
|
|
|
- var captchaCode = captcha.join("");
|
|
|
|
|
- // 用户填写验证码
|
|
|
|
|
- var captchaUser = data.captcha;
|
|
|
|
|
- if (captchaUser == '') {
|
|
|
|
|
|
|
+ if (data.captcha == '') {
|
|
|
layer.msg('验证码不能为空');
|
|
layer.msg('验证码不能为空');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- if (captchaCode.toUpperCase() != captchaUser.toUpperCase()){
|
|
|
|
|
- layer.msg('验证码不正确');
|
|
|
|
|
- // 错误刷新验证码
|
|
|
|
|
- draw(captcha);
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- http.post('system/auth/login', JSON.stringify(data), false, function (res) {
|
|
|
|
|
- if (res.code != 200) {
|
|
|
|
|
- layer.msg(res.msg, {
|
|
|
|
|
- icon: 2
|
|
|
|
|
- },function () {
|
|
|
|
|
- console.log('刷新')
|
|
|
|
|
- draw(captcha);
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- layer.msg('登录成功', {
|
|
|
|
|
- icon: 1
|
|
|
|
|
- }, function () {
|
|
|
|
|
- window.location = 'jump.html';
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
|
|
|
- return false;
|
|
|
|
|
- });
|
|
|
|
|
- // 绘制验证码
|
|
|
|
|
- draw(captcha);
|
|
|
|
|
-
|
|
|
|
|
- // 点击刷新验证码
|
|
|
|
|
- $(document).on('click','#captchaPic',function(){
|
|
|
|
|
- draw(captcha);
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生成验证码
|
|
|
|
|
- */
|
|
|
|
|
- function draw(show_num) {
|
|
|
|
|
- var canvas_width=$('#captchaPic').width();
|
|
|
|
|
- var canvas_height=$('#captchaPic').height();
|
|
|
|
|
- var canvas = document.getElementById("captchaPic");//获取到canvas的对象,演员
|
|
|
|
|
- var context = canvas.getContext("2d");//获取到canvas画图的环境,演员表演的舞台
|
|
|
|
|
- canvas.width = canvas_width;
|
|
|
|
|
- canvas.height = canvas_height;
|
|
|
|
|
- var sCode = "A,B,C,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0";
|
|
|
|
|
- var aCode = sCode.split(",");
|
|
|
|
|
- var aLength = aCode.length;//获取到数组的长度
|
|
|
|
|
-
|
|
|
|
|
- for (var i = 0; i <= 3; i++) {
|
|
|
|
|
- var j = Math.floor(Math.random() * aLength);//获取到随机的索引值
|
|
|
|
|
- var deg = Math.random() * 30 * Math.PI / 180;//产生0~30之间的随机弧度
|
|
|
|
|
- var txt = aCode[j];//得到随机的一个内容
|
|
|
|
|
- show_num[i] = txt;
|
|
|
|
|
- var x = 10 + i * 20;//文字在canvas上的x坐标
|
|
|
|
|
- var y = 20 + Math.random() * 8;//文字在canvas上的y坐标
|
|
|
|
|
- context.font = "bold 23px 微软雅黑";
|
|
|
|
|
-
|
|
|
|
|
- context.translate(x, y);
|
|
|
|
|
- context.rotate(deg);
|
|
|
|
|
-
|
|
|
|
|
- context.fillStyle = randomColor();
|
|
|
|
|
- context.fillText(txt, 0, 0);
|
|
|
|
|
-
|
|
|
|
|
- context.rotate(-deg);
|
|
|
|
|
- context.translate(-x, -y);
|
|
|
|
|
|
|
+ let rememberMe = {
|
|
|
|
|
+ account: data.account,
|
|
|
|
|
+ password: data.password,
|
|
|
|
|
+ rememberMe: $("#rememberMe").prop('checked')
|
|
|
}
|
|
}
|
|
|
- for (var i = 0; i <= 5; i++) { //验证码上显示线条
|
|
|
|
|
- context.strokeStyle = randomColor();
|
|
|
|
|
- context.beginPath();
|
|
|
|
|
- context.moveTo(Math.random() * canvas_width, Math.random() * canvas_height);
|
|
|
|
|
- context.lineTo(Math.random() * canvas_width, Math.random() * canvas_height);
|
|
|
|
|
- context.stroke();
|
|
|
|
|
|
|
+ if (rememberMe.rememberMe) {
|
|
|
|
|
+ // 勾选记住密码
|
|
|
|
|
+ layui.data('rememberMe', {
|
|
|
|
|
+ key: 'data',
|
|
|
|
|
+ value: rememberMe
|
|
|
|
|
+ })
|
|
|
|
|
+ }else {
|
|
|
|
|
+ layui.data('rememberMe', null)
|
|
|
}
|
|
}
|
|
|
- for (var i = 0; i <= 30; i++) { //验证码上显示小点
|
|
|
|
|
- context.strokeStyle = randomColor();
|
|
|
|
|
- context.beginPath();
|
|
|
|
|
- var x = Math.random() * canvas_width;
|
|
|
|
|
- var y = Math.random() * canvas_height;
|
|
|
|
|
- context.moveTo(x, y);
|
|
|
|
|
- context.lineTo(x + 1, y + 1);
|
|
|
|
|
- context.stroke();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ http.login(data)
|
|
|
|
|
+ return false;
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 随机颜色
|
|
|
|
|
- */
|
|
|
|
|
- function randomColor() {//得到随机的颜色值
|
|
|
|
|
- var r = Math.floor(Math.random() * 256);
|
|
|
|
|
- var g = Math.floor(Math.random() * 256);
|
|
|
|
|
- var b = Math.floor(Math.random() * 256);
|
|
|
|
|
- return "rgb(" + r + "," + g + "," + b + ")";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 点击验证码刷新
|
|
|
|
|
+ $("#captchaPic").click(function () {
|
|
|
|
|
+ generatePictureCaptcha()
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
|
|
+ readCachePassword()
|
|
|
|
|
+ generatePictureCaptcha()
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
</body>
|
|
</body>
|