| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- var uncompileStr = function (str) {
- str = unescape(str);
- var c = String.fromCharCode(str.charCodeAt(0) - str.length);
- for (var i = 1; i < str.length; i++) {
- c += String.fromCharCode(str.charCodeAt(i) - c.charCodeAt(i - 1));
- }
- return c;
- }
- var x;
- $(document).ready(function () {
- var d = layui.data("586537");
- x = d.x;
- if (x != undefined) {
- $("#b").hide();
- $("#content .login-account").addClass("has-img");
- $("#b").attr("src", uncompileStr(d.z));
- $("#c").html("欢迎您," + uncompileStr(d.y));
- $("#b").show();
- }
- })
- $(".user-img-cover").click(function () {
- layui.data('586537', null);
- location.reload();
- })
- var len = $(".login-write input").length;
- $(".login-write input").focus(function () {
- $(this).siblings(".iconfont").removeClass("iconfont-error");
- $(this).siblings(".iconfont").addClass("iconfont-focus");
- $(".login-warn").html("");
- })
- $(".login-write input").blur(function () {
- $(this).siblings(".iconfont").removeClass("iconfont-focus");
- })
- $(".submit").click(function () {
- $(this).attr("disabled", "disabled");
- if (x) {
- $("#uname").val(uncompileStr(x));
- }
- var loginText = [];
- for (var i = 0; i < len; i++) {
- if ($(".login-write input").eq(i).val() == "" || $(".login-write input").eq(i).val() == undefined) {
- $(".login-write input").eq(i).siblings(".iconfont").addClass("iconfont-error");
- loginText.push($(".login-write input").eq(i).attr("placeholder"));
- }
- }
- if ($("#uname").val().trim().length == 0) {
- $("#uname").focus();
- $(".login-warn").html("请输入账号");
- $(".submit").removeAttr("disabled");
- } else if ($("#upwd").val().trim().length == 0) {
- $("#upwd").focus();
- $(".login-warn").html("请输入密码");
- $(".submit").removeAttr("disabled");
- } else {
- var svc = layui.data('SVC');
- // if (svc.SliderVerificationCode && svc.SliderVerificationCode == "success") {
- // $(this).val("正 在 跳 转");
- // $("#appForm").submit();
- // return;
- // }
- if (true) {
- $(this).val("正 在 跳 转");
- // $("#appForm").submit();
- space.utils.ajax({
- type: "post",
- url: loginUrl,
- data: {
- uname: $("#uname").val().trim(),
- upwd: $("#upwd").val().trim()
- },
- dataType: 'json',
- loadLayer: false,
- callback: function (data) {
- if (data.code == 'success') {
- if (data.data.resultCode == 1000) {
- $(".login-warn").html(data.data.msg);
- $(".submit").removeAttr("disabled");
- $(".submit").val("登 录");
- }
- else if (data.data.resultCode == 1010) {
- top.location.href = "/apps/workbench/";
- }
- } else {
- $(".submit").removeAttr("disabled");
- $(".submit").val("登 录");
- }
- }
- });
- return;
- }
- var o = $(".submit").offset();
- var w = $(".submit").width();
- var l = o.left;
- if (w > 260) {
- l += (w - 260) / 2;
- }
- $("#verify").css({
- "left": l + "px",
- "top": (o.top - (160 + 20)) + "px"
- });
- var imgPath = function () {
- return "/apps/space/images/login/imgs/" + (Math.floor(Math.random() * 7) + 1) + ".jpg";
- }
- layui.link("/apps/space/plug-in/sprite/css/Sprite.css");
- sprite.init({
- el: $("#verify"),
- width: '260',
- height: '160',
- img: imgPath,
- success: function () {
- $(this).val("正 在 跳 转");
- layui.data('SVC', {
- key: 'SliderVerificationCode',
- value: 'success'
- });
- // setTimeout(function() {
- // $("#appForm").submit();
- // }, 500)
- },
- close: function () {
- $(".submit").removeAttr("disabled");
- }
- });
- $("#verify").show();
- $("#verify").addClass("animated flipInY");
- setTimeout(function () {
- $("#verify").removeClass("animated flipInY")
- }, 600)
- }
- })
|