/** * Created by fengjuan.zhu on 2017/2/21. */ function exsitEmail(){ var email = $('#email').val(); if(email == ''){ $('#email_error').html('* 邮箱必须填写!'); return false; }else if(!isEmail(email)){ $('#email_error').html('* 邮箱格式错误 例如:aa@qq.com '); return false; }else{ $('#email_error').html(' '); $.ajax({ url:'/member/ajaxExsitEmail', data:({'login_name':email}), type:'post', dataType:'json', success:function(msg){ if(msg.st != 'y'){ $('#email_error').html(msg.note); } }, error:function(){ // alert('网络繁忙,请稍后重试'); $('#emailcode_error').html('网络繁忙,请稍后重试'); } }); } } function exsitPhone(){ var cellphone = $('#cellphone').val(); if(cellphone == ''){ $('#cellphone_error').html('* 手机号必须填写!'); return false; }else if(!isMobile(cellphone)){ $('#cellphone_error').html('* 手机格式错误'); return false; }else{ $('#cellphone_error').html(' '); $.ajax({ url:'/member/ajaxExsitPhone', data:({'login_name':cellphone}), type:'post', dataType:'json', success:function(msg){ if(msg.st != 'y'){ $('#cellphone_error').html(msg.note); } }, error:function(){ // alert('网络繁忙,请稍后重试'); $('#emailcode_error').html('网络繁忙,请稍后重试'); } }); } } function getCode(){ var email = $('#email').val(); if(email == ''){ $('#email_error').html('* 邮箱必须填写!'); return false; }else if(!isEmail(email)){ $('#email_error').html('* 邮箱格式错误 例如:aa@qq.com '); return false; }else{ $('#email_error').html(' '); $("#email_getcode").attr('disabled','disabled'); $("#email_getcode").attr('style','background: #959595;'); $.ajax({ url:'/member/ajaxSetEmail', data:({'email':email}), type:'post', dataType:'json', success:function(msg){ if(msg.st != 'y'){ // alert(msg.note); setTimeout(changecss(),1000); $('#emailcode_error').html(msg.note); }else{ // alert('邮件发送成功!'); $('#emailcode_succes').html('邮件发送成功!'); } }, error:function(){ // alert('网络繁忙,请稍后重试'); $('#emailcode_error').html('网络繁忙,请稍后重试'); } }); } } function changecss(){ $('#email_getcode').removeAttr('disabled'); $("#email_getcode").removeAttr("style"); } $('#login_password').keyup(function(e) { var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"); var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); var enoughRegex = new RegExp("(?=.{6,}).*", "g"); if (false == enoughRegex.test($(this).val())) { $('#email_password').html('密码长度要6-16个字符!'); return false; } else if (strongRegex.test($(this).val())) { $('#email_password').css("color","#18a560"); $('#email_password').html('密码强度:强!'); } else if (mediumRegex.test($(this).val())) { $('#email_password').css("color","#18a560"); $('#email_password').html('密码强度:中!'); } else { //$('#email_password').className = 'error'; $('#email_password').html('密码强度:弱!'); } return true; }); $('#password_ph').keyup(function(e) { var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"); var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); var enoughRegex = new RegExp("(?=.{6,}).*", "g"); if (false == enoughRegex.test($(this).val())) { $('#password_ph_error').html('密码长度要6-16个字符!'); return false; } else if (strongRegex.test($(this).val())) { $('#password_ph_error').css("color","#18a560"); $('#password_ph_error').html('密码强度:强!'); } else if (mediumRegex.test($(this).val())) { $('#password_ph_error').css("color","#18a560"); $('#password_ph_error').html('密码强度:中!'); } else { //$('#password_ph_error').className = 'error'; $('#password_ph_error').html('密码强度:弱!'); } return true; }); function getCodePhone(self){ var cellphone = $('#cellphone').val(); var verify = $('#verify').val(); if(cellphone == ''){ $('#cellphone_error').html('* 手机号必须填写!'); return false; }else if(!isMobile(cellphone)){ $('#cellphone_error').html('* 手机格式错误'); return false; }else if(verify == ''){ $('#verify_error').html('* 验证码必须填写'); return false; }else{ //验证码倒计时 // $("#getCode").click(function(){ var timer = 60; var thisText = $(self).text(); $(self).attr('disabled','disabled'); var showTime = setInterval(function() { if (timer == 1) { $(self).text(thisText).removeAttr("disabled").removeClass("disabled"); clearInterval(showTime); timer = 1; } else { console.log('不等于1') $(self).text("重新发送("+(timer - 1)+")").addClass("disabled").attr("disabled", true); timer--; } },1000); // }); $('#cellphone_error').html(' '); $('#verify_error').html(' '); $.ajax({ url:'/member/ajaxSetPhones', data:({'cellphone':cellphone,'verify':verify}), type:'post', dataType:'json', success:function(msg){ if(msg.st != 'y'){ // alert(msg.note); $('#code_ph_error').html(msg.note); fleshVerify(); }else{ // alert('短信发送成功!'); $('#code_ph_succes').html('短信发送成功!'); } }, error:function(){ // alert('网络繁忙,请稍后重试'); $('#code_ph_error').html('网络繁忙,请稍后重试'); } }); } } // 注册方式切换 $(".register-tab a").click(function(){ var _index = $(this).index(); $(this).addClass("current").siblings().removeClass("current"); if(_index==0){ $(".reg-email").show(); $(".reg-phone").hide(); }else if(_index==1){ $(".reg-email").hide(); $(".reg-phone").show(); } }); function memberStatus(id,st){ if( ! confirm('确认?')){ return; } $.ajax({ url:'/member/ajax_st', data:({'id':id, 'st':st}), type:'post', success:function(msg){ if(msg.st != 'y'){ alert(msg.note); } rl(); }, error:function(){ alert('网络繁忙,请稍后重试'); } }); }