loginStatus();//判断个人是否登录 var _height = document.documentElement.clientHeight; //屏幕高 var boxHeight = $(".loginbox-invite").height(); $(".loginbox-invite").css({ top: (_height - boxHeight) / 2 +"px" }); //验证手机号 var phonePass = false; function phoneVal(){ var phone= $("#phone").val(); if(phone.length==0){ $(".msg1").text("请输入您的手机号码或邮箱地址"); }else{ var hun=/\s+/; if(hun.test(phone.trim())) { $(".msg1").text("请输入"); phonePass = false; }else{ //var gunf=/^\w+@\w+\.((cn)|(com)|(com\.cn))$/; var gunf= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; if(gunf.test(phone.trim())) { $(".msg1").text(""); phonePass = true; }else{ var hunPhone=/^1[3|4|5|7|8]\d{9}$/; if(hunPhone.test(phone.trim())){ $(".msg1").text(""); phonePass = true; }else{ phonePass = false; $(".msg1").text("格式不对,请输入正确的格式"); } } } } } //验证验证邀请码 var codePass = false; function codeVal(){ var code = $("#code").val(); if(code.length==0){ $(".msg2").text("请输入正确的邀请码"); codePass = false; }else{ $(".msg2").text(""); codePass = true; } } function loginSub(){ phoneVal(); codeVal(); if(phonePass && codePass){ $.ajax("/ajax/invitelogin",{ type:"POST", async: false, success:function(data){ //console.log(data) if(data.success){ if(data.data != "null" && data.data != null){ if(data.data.auth == true){ location.href="index.html"; }else{ location.href="login-first.html"; } }else{ $(".msg3").text("手机或邮箱和邀请码不匹配,请确认后登录!"); } }else{ $(".msg3").text("系统异常!"); // alert("系统异常!"); } }, error:function(){$.MsgBox.Alert('message','fail')}, data:{"code":$("#code").val(),"key":$("#phone").val()}, dataType: 'json' }); } } function restSub(data) { $(".msg3").text(""); }