fixed:完善login.html

master
bobi 2019-08-22 22:32:03 +08:00
parent a2b1923ec5
commit e18b311001
6 changed files with 365 additions and 321 deletions

View File

@ -3,13 +3,14 @@
@import "../lib/fonts/myfont.css";
@import "../lib/nprogress/nprogress.css";
#navBar .layui-nav-child{
#navBar .layui-nav-child {
/*transition: height .5s;*/
overflow: hidden;
padding: 5px 0!important;
padding: 5px 0 !important;
}
#navBar .layui-nav-itemed .layui-nav-child,
#navBar .layui-nav-child dd{
#navBar .layui-nav-child dd {
overflow: hidden;
}
@ -17,16 +18,19 @@
line-height: inherit;
font-size: 16px;
}
/**不显示滚动条样式*/
.not-scroll::-webkit-scrollbar{
.not-scroll::-webkit-scrollbar {
height: 0;
width: 0;
background: transparent;
display: none;
}
.scrollBody::-webkit-scrollbar{
.scrollBody::-webkit-scrollbar {
display: none;
}
/**去掉after**/
.no-line.layui-this:after {
background: transparent !important;
@ -476,20 +480,23 @@
}
/*中国天气样式*/
.weather-ok{
.weather-ok {
height: 49px;
line-height: 49px;
}
.weather-ok .iframe-style{
.weather-ok .iframe-style {
/*height: 415px;*/
/*height: 375px;*/
height: 50px;
padding-top: 5px;
box-sizing: border-box;
}
.weather-ok .iframe-style:hover{
.weather-ok .iframe-style:hover {
height: 380px;
}
/*主体内容样式*/
.okadmin .content-body {
position: absolute;
@ -500,6 +507,7 @@
z-index: 1;
overflow: hidden
}
.okadmin .content-body:after {
content: "";
max-height: 1px;
@ -528,10 +536,11 @@
}
/*主体内容选项卡内容样式*/
.content-body .layui-tab{
.content-body .layui-tab {
margin: 0;
/*position: relative;*/
}
.okadmin .content-body .layui-tab-content {
position: absolute;
top: 40px;
@ -621,27 +630,50 @@
}
/**********登录页的样式**********/
.page-fill{
.page-fill {
width: 100%;
height: 100%;
display: block;
box-sizing: border-box;
}
#login .layui-icon{ font-size:16px !important;}
#login .mag0{ margin:0 !important; }
#login ::selection { background: #ff5722; color: #fff; }
#login .layui-red{ color:#f00 !important; font-weight:bold;}
#login .layui-blue{ color:#01AAED !important;}
#login .layui-form-item.layui-input-focus input{ border-color:#ff6700 !important;}
#login .layui-icon {
font-size: 16px !important;
}
#login .mag0 {
margin: 0 !important;
}
#login ::selection {
background: #ff5722;
color: #fff;
}
#login .layui-red {
color: #f00 !important;
font-weight: bold;
}
#login .layui-blue {
color: #01AAED !important;
}
#login .layui-form-item.layui-input-focus input {
border-color: #ff6700 !important;
}
#login .layui-block {
width: 100% !important;
}
#login {
width: 100%;
height: 100%;
background-image: url('../images/login-bg.jpg');
position: relative;
}
#login form.layui-form {
padding: 0 20px 20px 20px;
width: 300px;
@ -692,9 +724,11 @@
font-size: 14px;
cursor: text;
}
#login #code{
#login #code {
padding-right: 110px;
}
#login #imgCode .img {
position: absolute;
top: 1px;
@ -704,29 +738,35 @@
width: 100px;
background: #C4E1CE;
}
#login .layui-form-item input{
background: #FFF!important;
#login .layui-form-item input {
background: #FFF !important;
}
#login .layui-form-item input,
#login .layui-form-item label{
#login .layui-form-item label {
transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
#login .layui-form-item input::placeholder{
color: transparent!important;
#login .layui-form-item input::placeholder {
color: transparent !important;
}
#login .layui-form-item.layui-input-focus input::placeholder{
color: #757575!important;
#login .layui-form-item.layui-input-focus input::placeholder {
color: #757575 !important;
}
#login .layui-form-item.layui-input-focus label,
#login .layui-form-item.layui-input-active label{
#login .layui-form-item.layui-input-active label {
top: -10px;
font-size: 12px;
color: #ff6700;
background: #fff!important;
background: #fff !important;
}
#login #codeImg canvas{
cursor:pointer;
#login #codeImg canvas {
cursor: pointer;
}
/*
@ -755,9 +795,11 @@
background: rgba(0, 0, 0, .5);
display: none;
}
@media screen and (max-width: 970px) {/*当屏幕宽度小于970时执行*/
.ok-hide-md{
display: none!important;
@media screen and (max-width: 970px) {
/*当屏幕宽度小于970时执行*/
.ok-hide-md {
display: none !important;
}
}

View File

@ -1,18 +1,18 @@
layui.define(["jquery"], function (exprots) {
var $ = layui.jquery;
function GVerify(options) { //创建一个图形验证码对象接收options对象为参数
this.options = { //默认options参数值
id: "", //容器Id
canvasId: "verifyCanvas", //canvas的ID
width: "100", //默认canvas宽度
height: "30", //默认canvas高度
type: "blend", //图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母
function GVerify(options) {
this.options = {
id: "",
canvasId: "verifyCanvas",
width: "100",
height: "30",
type: "blend",
code: ""
};
if (Object.prototype.toString.call(options) == "[object Object]") {//判断传入参数类型
for (var i in options) { //根据传入的参数,修改默认参数值
if (Object.prototype.toString.call(options) == "[object Object]") {
for (var i in options) {
this.options[i] = options[i];
}
} else {
@ -27,13 +27,10 @@ layui.define(["jquery"], function (exprots) {
}
GVerify.prototype = {
/**版本号**/
version: '1.0.0',
/**初始化方法**/
_init: function () {
var con = $(this.options.id);
// console.log(con);
var canvas = document.createElement("canvas");
this.options.width = con.outerWidth() > 0 ? con.outerWidth() : "100";
this.options.height = con.outerHeight() > 0 ? con.outerHeight() : "30";
@ -50,7 +47,6 @@ layui.define(["jquery"], function (exprots) {
}
},
/**生成验证码**/
refresh: function () {
this.options.code = "";
var canvas = document.getElementById(this.options.canvasId);
@ -65,7 +61,7 @@ layui.define(["jquery"], function (exprots) {
ctx.fillStyle = randomColor(180, 240);
ctx.fillRect(0, 0, this.options.width, this.options.height);
if (this.options.type == "blend") { //判断验证码类型
if (this.options.type == "blend") {
var txtArr = this.options.numArr.concat(this.options.letterArr);
} else if (this.options.type == "number") {
var txtArr = this.options.numArr;
@ -76,8 +72,8 @@ layui.define(["jquery"], function (exprots) {
for (var i = 1; i <= 4; i++) {
var txt = txtArr[randomNum(0, txtArr.length)];
this.options.code += txt;
ctx.font = randomNum(this.options.height / 2, this.options.height) + 'px SimHei'; //随机生成字体大小
ctx.fillStyle = randomColor(50, 160); //随机生成字体颜色
ctx.font = randomNum(this.options.height / 2, this.options.height) + 'px SimHei';
ctx.fillStyle = randomColor(50, 160);
ctx.shadowOffsetX = randomNum(-3, 3);
ctx.shadowOffsetY = randomNum(-3, 3);
ctx.shadowBlur = randomNum(-3, 3);
@ -85,15 +81,12 @@ layui.define(["jquery"], function (exprots) {
var x = this.options.width / 5 * i;
var y = this.options.height / 2;
var deg = randomNum(-30, 30);
/**设置旋转角度和坐标原点**/
ctx.translate(x, y);
ctx.rotate(deg * Math.PI / 180);
ctx.fillText(txt, 0, 0);
/**恢复旋转角度和坐标原点**/
ctx.rotate(-deg * Math.PI / 180);
ctx.translate(-x, -y);
}
/**绘制干扰线**/
for (var i = 0; i < 4; i++) {
ctx.strokeStyle = randomColor(40, 180);
ctx.beginPath();
@ -101,7 +94,6 @@ layui.define(["jquery"], function (exprots) {
ctx.lineTo(randomNum(0, this.options.width), randomNum(0, this.options.height));
ctx.stroke();
}
/**绘制干扰点**/
for (var i = 0; i < this.options.width / 4; i++) {
ctx.fillStyle = randomColor(0, 255);
ctx.beginPath();
@ -110,31 +102,26 @@ layui.define(["jquery"], function (exprots) {
}
},
/**验证验证码**/
validate: function (code) {
var code = code.toLowerCase();
var v_code = this.options.code.toLowerCase();
if (code == v_code) {
return "true";
} else {
// this.refresh();
return "验证码不正确,请重新输入";
}
}
}
/**生成字母数组**/
function getAllLetter() {
var letterStr = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
return letterStr.split(",");
}
/**生成一个随机数**/
function randomNum(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
/**生成一个随机色**/
function randomColor(min, max) {
var r = randomNum(min, max);
var g = randomNum(min, max);
@ -143,6 +130,5 @@ layui.define(["jquery"], function (exprots) {
}
exprots("okGVerify", GVerify);
});

View File

@ -0,0 +1,35 @@
"use strict";
layui.define([], function(exprots) {
var okMock = {
api: {
login: "https://www.easy-mock.com/mock/5d5d0dd46cfcbd1b8627bf1d/ok-admin-v2.0/login",
menu: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/menu/list"
},
user: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/list",
batchNormal: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/batchNormal",
batchStop: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/batchStop",
batchDel: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/batchDel",
add: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/add",
edit: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/edit"
},
role: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/role/list"
},
permission: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/permission/list"
},
article: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/article/list"
},
log: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/log/list"
},
message: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/message/list"
}
}
};
exprots("okMock", okMock);
});

View File

@ -2,9 +2,13 @@
layui.define(["layer"], function(exprots) {
var $ = layui.jquery;
var okUtils = {
// 是否前后端分离
/**
* 是否前后端分离
*/
isFrontendBackendSeparate: false,
// 服务器地址
/**
* 服务器地址
*/
baseUrl: "http://localhost:8080",
/**
* 获取body的总宽度
@ -47,7 +51,7 @@ layui.define(["layer"], function(exprots) {
success: function (data) {
if (data.status == 1000) {
// 业务正常
deferred.resolve(data.data)
deferred.resolve(data)
} else {
// 业务异常
layer.msg(data.msg, {icon: 7, time: 2000});
@ -94,35 +98,6 @@ layui.define(["layer"], function(exprots) {
$(".layui-laypage-btn")[0].click();
});
}
},
mockApi: {
login: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/login",
menu: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/menu/list"
},
user: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/list",
batchNormal: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/batchNormal",
batchStop: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/batchStop",
batchDel: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/batchDel",
add: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/add",
edit: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/user/edit"
},
role: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/role/list"
},
permission: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/permission/list"
},
article: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/article/list"
},
log: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/log/list"
},
message: {
list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/message/list"
}
}
};
exprots("okUtils", okUtils);

View File

@ -1,224 +1,225 @@
/** layui-v2.5.4 MIT License By https://www.layui.com */
if (!Object.assign) {
Object.defineProperty(Object, "assign", {
enumerable: false,
configurable: true,
writable: true,
value: function(target, firstSource) {
"use strict";
if (target === undefined || target === null)
throw new TypeError("Cannot convert first argument to object");
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments[i];
if (nextSource === undefined || nextSource === null) continue;
var keysArray = Object.keys(Object(nextSource));
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey];
Object.defineProperty(Object, "assign", {
enumerable: false,
configurable: true,
writable: true,
value: function (target, firstSource) {
"use strict";
if (target === undefined || target === null)
throw new TypeError("Cannot convert first argument to object");
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments[i];
if (nextSource === undefined || nextSource === null) continue;
var keysArray = Object.keys(Object(nextSource));
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey];
}
}
return to;
}
}
return to;
}
});
});
}
!function (e) {
"use strict";
var okmodules = {
"okTab": "okmodules/okTab",
"countUp": "okmodules/countUp",
"okUtils": "okmodules/okUtils",
"okGVerify": "okmodules/okGVerify",
"qrcode": "okmodules/qrcode",
"jQqrcode": "okmodules/jQqrcode",
"okAddlink": "okmodules/okAddlink",
"okLayer": "okmodules/okLayer",
};
var modulePath=Object.assign({
layer: "modules/layer",
laydate: "modules/laydate",
laypage: "modules/laypage",
laytpl: "modules/laytpl",
layim: "modules/layim",
layedit: "modules/layedit",
form: "modules/form",
upload: "modules/upload",
transfer: "modules/transfer",
tree: "modules/tree",
table: "modules/table",
element: "modules/element",
rate: "modules/rate",
colorpicker: "modules/colorpicker",
slider: "modules/slider",
carousel: "modules/carousel",
flow: "modules/flow",
util: "modules/util",
code: "modules/code",
jquery: "modules/jquery",
mobile: "modules/mobile",
"layui.all": "../layui.all"
},okmodules);
var t = document, o = {modules: {}, status: {}, timeout: 10, event: {}}, n = function () {
this.v = "2.5.4"
}, r = function () {
var e = t.currentScript ? t.currentScript.src : function () {
for (var e, o = t.scripts, n = o.length - 1, r = n; r > 0; r--) if ("interactive" === o[r].readyState) {
e = o[r].src;
break
}
return e || o[n].src
}();
return e.substring(0, e.lastIndexOf("/") + 1)
}(), i = function (t) {
e.console && console.error && console.error("Layui hint: " + t)
}, a = "undefined" != typeof opera && "[object Opera]" === opera.toString(), u = modulePath;
n.prototype.cache = o, n.prototype.define = function (e, t) {
var n = this, r = "function" == typeof e, i = function () {
var e = function (e, t) {
layui[e] = t, o.status[e] = !0
};
return "function" == typeof t && t(function (n, r) {
e(n, r), o.callback[n] = function () {
t(e)
"use strict";
var okmodules = {
"okTab": "okmodules/okTab",
"countUp": "okmodules/countUp",
"okUtils": "okmodules/okUtils",
"okGVerify": "okmodules/okGVerify",
"qrcode": "okmodules/qrcode",
"jQqrcode": "okmodules/jQqrcode",
"okAddlink": "okmodules/okAddlink",
"okLayer": "okmodules/okLayer",
"okMock": "okmodules/okMock",
};
var modulePath = Object.assign({
layer: "modules/layer",
laydate: "modules/laydate",
laypage: "modules/laypage",
laytpl: "modules/laytpl",
layim: "modules/layim",
layedit: "modules/layedit",
form: "modules/form",
upload: "modules/upload",
transfer: "modules/transfer",
tree: "modules/tree",
table: "modules/table",
element: "modules/element",
rate: "modules/rate",
colorpicker: "modules/colorpicker",
slider: "modules/slider",
carousel: "modules/carousel",
flow: "modules/flow",
util: "modules/util",
code: "modules/code",
jquery: "modules/jquery",
mobile: "modules/mobile",
"layui.all": "../layui.all"
}, okmodules);
var t = document, o = {modules: {}, status: {}, timeout: 10, event: {}}, n = function () {
this.v = "2.5.4"
}, r = function () {
var e = t.currentScript ? t.currentScript.src : function () {
for (var e, o = t.scripts, n = o.length - 1, r = n; r > 0; r--) if ("interactive" === o[r].readyState) {
e = o[r].src;
break
}
return e || o[n].src
}();
return e.substring(0, e.lastIndexOf("/") + 1)
}(), i = function (t) {
e.console && console.error && console.error("Layui hint: " + t)
}, a = "undefined" != typeof opera && "[object Opera]" === opera.toString(), u = modulePath;
n.prototype.cache = o, n.prototype.define = function (e, t) {
var n = this, r = "function" == typeof e, i = function () {
var e = function (e, t) {
layui[e] = t, o.status[e] = !0
};
return "function" == typeof t && t(function (n, r) {
e(n, r), o.callback[n] = function () {
t(e)
}
}), this
};
return r && (t = e, e = []), !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n)
}, n.prototype.use = function (e, n, l) {
function s(e, t) {
var n = "PLaySTATION 3" === navigator.platform ? /^complete$/ : /^(complete|loaded)$/;
("load" === e.type || n.test((e.currentTarget || e.srcElement).readyState)) && (o.modules[f] = t, d.removeChild(v), function r() {
return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void (o.status[f] ? c() : setTimeout(r, 4))
}())
}
}), this
};
return r && (t = e, e = []), !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n)
}, n.prototype.use = function (e, n, l) {
function s(e, t) {
var n = "PLaySTATION 3" === navigator.platform ? /^complete$/ : /^(complete|loaded)$/;
("load" === e.type || n.test((e.currentTarget || e.srcElement).readyState)) && (o.modules[f] = t, d.removeChild(v), function r() {
return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void (o.status[f] ? c() : setTimeout(r, 4))
}())
}
function c() {
l.push(layui[f]), e.length > 1 ? y.use(e.slice(1), n, l) : "function" == typeof n && n.apply(layui, l)
}
var y = this, p = o.dir = o.dir ? o.dir : r, d = t.getElementsByTagName("head")[0];
e = "string" == typeof e ? [e] : e, window.jQuery && jQuery.fn.on && (y.each(e, function (t, o) {
"jquery" === o && e.splice(t, 1)
}), layui.jquery = layui.$ = jQuery);
var f = e[0], m = 0;
if (l = l || [], o.host = o.host || (p.match(/\/\/([\s\S]+?)\//) || ["//" + location.host + "/"])[0], 0 === e.length || layui["layui.all"] && u[f] || !layui["layui.all"] && layui["layui.mobile"] && u[f]) return c(), y;
if (o.modules[f]) !function g() {
return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void ("string" == typeof o.modules[f] && o.status[f] ? c() : setTimeout(g, 4))
}(); else {
var v = t.createElement("script"),
h = (u[f] ? p + "lay/" : /^\{\/\}/.test(y.modules[f]) ? "" : o.base || "") + (y.modules[f] || f) + ".js";
h = h.replace(/^\{\/\}/, ""), v.async = !0, v.charset = "utf-8", v.src = h + function () {
var e = o.version === !0 ? o.v || (new Date).getTime() : o.version || "";
return e ? "?v=" + e : ""
}(), d.appendChild(v), !v.attachEvent || v.attachEvent.toString && v.attachEvent.toString().indexOf("[native code") < 0 || a ? v.addEventListener("load", function (e) {
s(e, h)
}, !1) : v.attachEvent("onreadystatechange", function (e) {
s(e, h)
}), o.modules[f] = h
}
return y
}, n.prototype.getStyle = function (t, o) {
var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](o)
}, n.prototype.link = function (e, n, r) {
var a = this, u = t.createElement("link"), l = t.getElementsByTagName("head")[0];
"string" == typeof n && (r = n);
var s = (r || e).replace(/\.|\//g, ""), c = u.id = "layuicss-" + s, y = 0;
return u.rel = "stylesheet", u.href = e + (o.debug ? "?v=" + (new Date).getTime() : ""), u.media = "all", t.getElementById(c) || l.appendChild(u), "function" != typeof n ? a : (function p() {
return ++y > 1e3 * o.timeout / 100 ? i(e + " timeout") : void (1989 === parseInt(a.getStyle(t.getElementById(c), "width")) ? function () {
n()
}() : setTimeout(p, 100))
}(), a)
}, o.callback = {}, n.prototype.factory = function (e) {
if (layui[e]) return "function" == typeof o.callback[e] ? o.callback[e] : null
}, n.prototype.addcss = function (e, t, n) {
return layui.link(o.dir + "css/" + e, t, n)
}, n.prototype.img = function (e, t, o) {
var n = new Image;
return n.src = e, n.complete ? t(n) : (n.onload = function () {
n.onload = null, "function" == typeof t && t(n)
}, void (n.onerror = function (e) {
n.onerror = null, "function" == typeof o && o(e)
}))
}, n.prototype.config = function (e) {
e = e || {};
for (var t in e) o[t] = e[t];
return this
}, n.prototype.modules = function () {
var e = {};
for (var t in u) e[t] = u[t];
return e
}(), n.prototype.extend = function (e) {
var t = this;
e = e || {};
for (var o in e) t[o] || t.modules[o] ? i("模块名 " + o + " 已被占用") : t.modules[o] = e[o];
return t
}, n.prototype.router = function (e) {
var t = this, e = e || location.hash, o = {path: [], search: {}, hash: (e.match(/[^#](#.*$)/) || [])[1] || ""};
return /^#\//.test(e) ? (e = e.replace(/^#\//, ""), o.href = "/" + e, e = e.replace(/([^#])(#.*$)/, "$1").split("/") || [], t.each(e, function (e, t) {
/^\w+=/.test(t) ? function () {
t = t.split("="), o.search[t[0]] = t[1]
}() : o.path.push(t)
}), o) : o
}, n.prototype.data = function (t, o, n) {
if (t = t || "layui", n = n || localStorage, e.JSON && e.JSON.parse) {
if (null === o) return delete n[t];
o = "object" == typeof o ? o : {key: o};
try {
var r = JSON.parse(n[t])
} catch (i) {
var r = {}
}
return "value" in o && (r[o.key] = o.value), o.remove && delete r[o.key], n[t] = JSON.stringify(r), o.key ? r[o.key] : r
}
}, n.prototype.sessionData = function (e, t) {
return this.data(e, t, sessionStorage)
}, n.prototype.device = function (t) {
var o = navigator.userAgent.toLowerCase(), n = function (e) {
var t = new RegExp(e + "/([^\\s\\_\\-]+)");
return e = (o.match(t) || [])[1], e || !1
}, r = {
os: function () {
return /windows/.test(o) ? "windows" : /linux/.test(o) ? "linux" : /iphone|ipod|ipad|ios/.test(o) ? "ios" : /mac/.test(o) ? "mac" : void 0
}(), ie: function () {
return !!(e.ActiveXObject || "ActiveXObject" in e) && ((o.match(/msie\s(\d+)/) || [])[1] || "11")
}(), weixin: n("micromessenger")
};
return t && !r[t] && (r[t] = n(t)), r.android = /android/.test(o), r.ios = "ios" === r.os, r
}, n.prototype.hint = function () {
return {error: i}
}, n.prototype.each = function (e, t) {
var o, n = this;
if ("function" != typeof t) return n;
if (e = e || [], e.constructor === Object) {
for (o in e) if (t.call(e[o], o, e[o])) break
} else for (o = 0; o < e.length && !t.call(e[o], o, e[o]); o++) ;
return n
}, n.prototype.sort = function (e, t, o) {
var n = JSON.parse(JSON.stringify(e || []));
return t ? (n.sort(function (e, o) {
var n = /^-?\d+$/, r = e[t], i = o[t];
return n.test(r) && (r = parseFloat(r)), n.test(i) && (i = parseFloat(i)), r && !i ? 1 : !r && i ? -1 : r > i ? 1 : r < i ? -1 : 0
}), o && n.reverse(), n) : n
}, n.prototype.stope = function (t) {
t = t || e.event;
try {
t.stopPropagation()
} catch (o) {
t.cancelBubble = !0
}
}, n.prototype.onevent = function (e, t, o) {
return "string" != typeof e || "function" != typeof o ? this : n.event(e, t, null, o)
}, n.prototype.event = n.event = function (e, t, n, r) {
var i = this, a = null, u = t.match(/\((.*)\)$/) || [], l = (e + "." + t).replace(u[0], ""), s = u[1] || "",
c = function (e, t) {
var o = t && t.call(i, n);
o === !1 && null === a && (a = !1)
};
return r ? (o.event[l] = o.event[l] || {}, o.event[l][s] = [r], this) : (layui.each(o.event[l], function (e, t) {
return "{*}" === s ? void layui.each(t, c) : ("" === e && layui.each(t, c), void (s && e === s && layui.each(t, c)))
}), a)
}, e.layui = new n
function c() {
l.push(layui[f]), e.length > 1 ? y.use(e.slice(1), n, l) : "function" == typeof n && n.apply(layui, l)
}
var y = this, p = o.dir = o.dir ? o.dir : r, d = t.getElementsByTagName("head")[0];
e = "string" == typeof e ? [e] : e, window.jQuery && jQuery.fn.on && (y.each(e, function (t, o) {
"jquery" === o && e.splice(t, 1)
}), layui.jquery = layui.$ = jQuery);
var f = e[0], m = 0;
if (l = l || [], o.host = o.host || (p.match(/\/\/([\s\S]+?)\//) || ["//" + location.host + "/"])[0], 0 === e.length || layui["layui.all"] && u[f] || !layui["layui.all"] && layui["layui.mobile"] && u[f]) return c(), y;
if (o.modules[f]) !function g() {
return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void ("string" == typeof o.modules[f] && o.status[f] ? c() : setTimeout(g, 4))
}(); else {
var v = t.createElement("script"),
h = (u[f] ? p + "lay/" : /^\{\/\}/.test(y.modules[f]) ? "" : o.base || "") + (y.modules[f] || f) + ".js";
h = h.replace(/^\{\/\}/, ""), v.async = !0, v.charset = "utf-8", v.src = h + function () {
var e = o.version === !0 ? o.v || (new Date).getTime() : o.version || "";
return e ? "?v=" + e : ""
}(), d.appendChild(v), !v.attachEvent || v.attachEvent.toString && v.attachEvent.toString().indexOf("[native code") < 0 || a ? v.addEventListener("load", function (e) {
s(e, h)
}, !1) : v.attachEvent("onreadystatechange", function (e) {
s(e, h)
}), o.modules[f] = h
}
return y
}, n.prototype.getStyle = function (t, o) {
var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](o)
}, n.prototype.link = function (e, n, r) {
var a = this, u = t.createElement("link"), l = t.getElementsByTagName("head")[0];
"string" == typeof n && (r = n);
var s = (r || e).replace(/\.|\//g, ""), c = u.id = "layuicss-" + s, y = 0;
return u.rel = "stylesheet", u.href = e + (o.debug ? "?v=" + (new Date).getTime() : ""), u.media = "all", t.getElementById(c) || l.appendChild(u), "function" != typeof n ? a : (function p() {
return ++y > 1e3 * o.timeout / 100 ? i(e + " timeout") : void (1989 === parseInt(a.getStyle(t.getElementById(c), "width")) ? function () {
n()
}() : setTimeout(p, 100))
}(), a)
}, o.callback = {}, n.prototype.factory = function (e) {
if (layui[e]) return "function" == typeof o.callback[e] ? o.callback[e] : null
}, n.prototype.addcss = function (e, t, n) {
return layui.link(o.dir + "css/" + e, t, n)
}, n.prototype.img = function (e, t, o) {
var n = new Image;
return n.src = e, n.complete ? t(n) : (n.onload = function () {
n.onload = null, "function" == typeof t && t(n)
}, void (n.onerror = function (e) {
n.onerror = null, "function" == typeof o && o(e)
}))
}, n.prototype.config = function (e) {
e = e || {};
for (var t in e) o[t] = e[t];
return this
}, n.prototype.modules = function () {
var e = {};
for (var t in u) e[t] = u[t];
return e
}(), n.prototype.extend = function (e) {
var t = this;
e = e || {};
for (var o in e) t[o] || t.modules[o] ? i("模块名 " + o + " 已被占用") : t.modules[o] = e[o];
return t
}, n.prototype.router = function (e) {
var t = this, e = e || location.hash, o = {path: [], search: {}, hash: (e.match(/[^#](#.*$)/) || [])[1] || ""};
return /^#\//.test(e) ? (e = e.replace(/^#\//, ""), o.href = "/" + e, e = e.replace(/([^#])(#.*$)/, "$1").split("/") || [], t.each(e, function (e, t) {
/^\w+=/.test(t) ? function () {
t = t.split("="), o.search[t[0]] = t[1]
}() : o.path.push(t)
}), o) : o
}, n.prototype.data = function (t, o, n) {
if (t = t || "layui", n = n || localStorage, e.JSON && e.JSON.parse) {
if (null === o) return delete n[t];
o = "object" == typeof o ? o : {key: o};
try {
var r = JSON.parse(n[t])
} catch (i) {
var r = {}
}
return "value" in o && (r[o.key] = o.value), o.remove && delete r[o.key], n[t] = JSON.stringify(r), o.key ? r[o.key] : r
}
}, n.prototype.sessionData = function (e, t) {
return this.data(e, t, sessionStorage)
}, n.prototype.device = function (t) {
var o = navigator.userAgent.toLowerCase(), n = function (e) {
var t = new RegExp(e + "/([^\\s\\_\\-]+)");
return e = (o.match(t) || [])[1], e || !1
}, r = {
os: function () {
return /windows/.test(o) ? "windows" : /linux/.test(o) ? "linux" : /iphone|ipod|ipad|ios/.test(o) ? "ios" : /mac/.test(o) ? "mac" : void 0
}(), ie: function () {
return !!(e.ActiveXObject || "ActiveXObject" in e) && ((o.match(/msie\s(\d+)/) || [])[1] || "11")
}(), weixin: n("micromessenger")
};
return t && !r[t] && (r[t] = n(t)), r.android = /android/.test(o), r.ios = "ios" === r.os, r
}, n.prototype.hint = function () {
return {error: i}
}, n.prototype.each = function (e, t) {
var o, n = this;
if ("function" != typeof t) return n;
if (e = e || [], e.constructor === Object) {
for (o in e) if (t.call(e[o], o, e[o])) break
} else for (o = 0; o < e.length && !t.call(e[o], o, e[o]); o++) ;
return n
}, n.prototype.sort = function (e, t, o) {
var n = JSON.parse(JSON.stringify(e || []));
return t ? (n.sort(function (e, o) {
var n = /^-?\d+$/, r = e[t], i = o[t];
return n.test(r) && (r = parseFloat(r)), n.test(i) && (i = parseFloat(i)), r && !i ? 1 : !r && i ? -1 : r > i ? 1 : r < i ? -1 : 0
}), o && n.reverse(), n) : n
}, n.prototype.stope = function (t) {
t = t || e.event;
try {
t.stopPropagation()
} catch (o) {
t.cancelBubble = !0
}
}, n.prototype.onevent = function (e, t, o) {
return "string" != typeof e || "function" != typeof o ? this : n.event(e, t, null, o)
}, n.prototype.event = n.event = function (e, t, n, r) {
var i = this, a = null, u = t.match(/\((.*)\)$/) || [], l = (e + "." + t).replace(u[0], ""), s = u[1] || "",
c = function (e, t) {
var o = t && t.call(i, n);
o === !1 && null === a && (a = !1)
};
return r ? (o.event[l] = o.event[l] || {}, o.event[l][s] = [r], this) : (layui.each(o.event[l], function (e, t) {
return "{*}" === s ? void layui.each(t, c) : ("" === e && layui.each(t, c), void (s && e === s && layui.each(t, c)))
}), a)
}, e.layui = new n
}(window);

View File

@ -14,16 +14,16 @@
<form class="layui-form">
<div class="login_face"><img src="../images/logo.png" class="userAvatar"></div>
<div class="layui-form-item input-item">
<label for="userName">用户名</label>
<input type="text" lay-verify="required" name="userName" placeholder="请输入用户名" autocomplete="off" id="userName" class="layui-input">
<label for="username">用户名</label>
<input type="text" lay-verify="required" name="username" placeholder="请输入账号" autocomplete="off" id="username" class="layui-input">
</div>
<div class="layui-form-item input-item">
<label for="password">密码</label>
<input type="password" lay-verify="required|pass" name="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input">
<input type="password" lay-verify="required|password" name="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input">
</div>
<div class="layui-form-item input-item" id="imgCode">
<label for="code">验证码</label>
<input type="text" lay-verify="required|yzmCode" name="code" placeholder="请输入验证码" autocomplete="off" id="code" class="layui-input">
<label for="captcha">验证码</label>
<input type="text" lay-verify="required|captcha" name="captcha" placeholder="请输入验证码" autocomplete="off" id="captcha" class="layui-input">
<div class="img ok-none-select" id="codeImg"></div>
</div>
<div class="layui-form-item">
@ -35,18 +35,19 @@
<!--js逻辑-->
<script src="../lib/layui/layui.js"></script>
<script>
layui.use(["form", "jquery", "okGVerify"], function () {
layui.use(["form", "okGVerify", "okUtils", "okMock", "okLayer"], function () {
var form = layui.form;
var $ = layui.jquery;
var okGVerify = layui.okGVerify;
var okUtils = layui.okUtils;
var okMock = layui.okMock;
var okLayer = layui.okLayer;
var verifyCode = new okGVerify("#codeImg");
// var res = verifyCode.validate(document.getElementById("code").value);
form.verify({
pass: [
/^[\S]{6,12}$/,
'密码必须6到12位且不能出现空格'
],
yzmCode: function (val) {
password: [/^[\S]{6,12}$/, '密码必须6到12位且不能出现空格'],
captcha: function (val) {
if (verifyCode.validate(val) != "true") {
return verifyCode.validate(val)
}
@ -54,13 +55,17 @@
});
form.on('submit(login)', function (data) {
layer.msg("登陆中...", {icon: 6, time: 1000, anim: 0}, function () {
window.location = "../index.html";
okUtils.ajax(okMock.api.login, "post", data.field).done(function (response) {
console.log(response)
okLayer.msg.greenTick(response.msg, function () {
window.location = "../index.html";
})
}).fail(function (error) {
console.log(error)
});
return false;
});
//表单输入效果
$("#login .input-item .layui-input").click(function (e) {
e.stopPropagation();
$(this).addClass("layui-input-focus").find(".layui-input").focus();