3 lines
4.2 KiB
JavaScript
3 lines
4.2 KiB
JavaScript
|
$("body").on("keypress",function(o){o.keyCode==13&&zesol()}),$(".logsbtn").on("click",function(){zesol()});function zesol(){var o=$(".accounts .istetxt").val(),i=$(".passwords .istetxt").val();o==""||i==""||o==" "||i==" "?layer.alert("\u8D26\u53F7\u6216\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01"):$.ajax({type:"POST",headers:{token:getCookie("token")},url:"/api/jwt/getUserSchoolForLogin",contentType:"application/json",dataType:"json",data:JSON.stringify({username:o,password:encrypt(i,"njsdearr8h239ay3"),encrypted:!0}),async:!0,success:function(l){if(l.code==200){var e=l.data;if(e.length==1){var r=JSON.stringify({a:o,p:i}),n=new Base64,a=n.encode(r),g=e[0].isHttps==0?"http":"https",c=e[0].topLevelDomain==""?e[0].secondLevelDomain:e[0].topLevelDomain;window.location.href=g+"://"+c+"/pages/loginChilds.html?"+a}else{$(".gintan").show(),$("#gin").hide(),$(document).attr("title","\u9009\u62E9\u7F51\u6821");for(var t="",r=JSON.stringify({a:o,p:i}),n=new Base64,a=n.encode(r),f=0,h=e.length;f<h;f++){var s=e[f],d=s.topLevelDomain,v=s.secondLevelDomain,p=getMyDate(s.createTimeStamp);/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)?t+='<li class="mobile">':t+="<li>",s.isHttps==1?d==""?t+='<a class="home" href="https://'+v+"/pages/loginChilds.html?"+a+'" >':t+='<a class="home" href="https://'+d+"/pages/loginChilds.html?"+a+'" >':d==""?t+='<a class="home" href="http://'+v+"/pages/loginChilds.html?"+a+'" >':t+='<a class="home" href="http://'+d+"/pages/loginChilds.html?"+a+'" >',t+='<span class="logimg"><img src="'+s.logo+'"></span>',s.cover?t+='<img src="'+s.cover+'">':t+='<img src="/static/front/images/node.png">',t+='<span class="title">'+s.schoolName+"</span>",t+='<span class="introduce">'+s.introduce+"</span>",t+='<span class="tise">'+p+"",s.headPortrait?t+='<img class="spimg" src="'+s.headPortrait+'">':t+='<img class="spimg" src="/static/common/image/logo/1.jpg">',t+="</span>",t+="</a>",t+="</li>"}e.length==0?$(".xtwlb").html("<span style='text-align:center;width:100%;text-indent:0;font-size:16px;'>\u8BE5\u8D26\u53F7\u6682\u65E0\u7F51\u6821\uFF0C\u8BF7\u5237\u65B0\u7F51\u9875\u91CD\u65B0\u767B\u5F55\uFF01</span>"):$(".xtwlb").html(t)}}else alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458")}})}function Base64(){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";this.encode=function(e){var r="",n,a,g,c,t,f,h,s=0;for(e=i(e);s<e.length;)n=e.charCodeAt(s++),a=e.charCodeAt(s++),g=e.charCodeAt(s++),c=n>>2,t=(n&3)<<4|a>>4,f=(a&15)<<2|g>>6,h=g&63,isNaN(a)?f=h=64:isNaN(g)&&(h=64),r=r+o.charAt(c)+o.charAt(t)+o.charAt(f)+o.charAt(h);return r},this.decode=function(e){var r="",n,a,g,c,t,f,h,s=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");s<e.length;)c=o.indexOf(e.charAt(s++)),t=o.indexOf(e.charAt(s++)),f=o.indexOf(e.charAt(s++)),h=o.indexOf(e.charAt(s++)),n=c<<2|t>>4,a=(t&15)<<4|f>>2,g=(f&3)<<6|h,r=r+String.fromCharCode(n),f!=64&&(r=r+String.fromCharCode(a)),h!=64&&(r=r+String.fromCharCode(g));return r=l(r),r};var i=function(e){e=e.replace(/\r\n/g,`
|
||
|
`);for(var r="",n=0;n<e.length;n++){var a=e.charCodeAt(n);a<128?r+=String.fromCharCode(a):a>127&&a<2048?(r+=String.fromCharCode(a>>6|192),r+=String.fromCharCode(a&63|128)):(r+=String.fromCharCode(a>>12|224),r+=String.fromCharCode(a>>6&63|128),r+=String.fromCharCode(a&63|128))}return r},l=function(e){for(var r="",n=0,a=0,g=0,c=0,t=0;n<e.length;)a=e.charCodeAt(n),a<128?(r+=String.fromCharCode(a),n++):a>191&&a<224?(c=e.charCodeAt(n+1),r+=String.fromCharCode((a&31)<<6|c&63),n+=2):(c=e.charCodeAt(n+1),t=e.charCodeAt(n+2),r+=String.fromCharCode((a&15)<<12|(c&63)<<6|t&63),n+=3);return r}}function A(){$(document).attr("title","\u7528\u6237\u767B\u5F55")}$(function(){setTimeout("A()",500)}),$(".forgetPossword").on("click",function(){user.getPasswordLayer(function(o){})});function getMyDate(o){var i=new Date(o),l=i.getFullYear(),e=i.getMonth()+1,r=i.getDate(),n=i.getHours(),a=i.getMinutes(),g=i.getSeconds(),c=l+"-"+getzf(e)+"-"+getzf(r);return c}function getzf(o){return parseInt(o)<10&&(o="0"+o),o}function getCookie(o){for(var i=document.cookie,l=i.split("; "),e=0;e<l.length;e++){var r=l[e].split("=");if(r[0]==o)return r[1]}return""}function getPar(o){var i=document.location.href,l=i.indexOf(o+"=");if(l==-1)return!1;var e=i.slice(o.length+l+1),r=e.indexOf("&");return r!=-1&&(e=e.slice(0,r)),e}
|