123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- var _height = document.documentElement.clientHeight;
- var boxHeight = $(".registerbox").height();
- $(".registerbox").css({ top:"40px"});
- $('.agreeNotice').click(function(){
- var formbox = $(this).closest("form");
- if(formbox.find('.gree').prop('checked')){
- formbox.find('.agreeNotice em').css('background-position','0px 0px');
- formbox.find('.gree').prop('checked',false);
- formbox.find('.agreeNotice').next('span').show();
- }else{
- formbox.find('.gree').prop('checked',true);
- formbox.find('.agreeNotice').next('span').hide();
- formbox.find('.agreeNotice em').css('background-position','0px -12px');
-
- }
- });
-
- $(".phone").click(function(){
- $(this).find("img").attr("src","images/phoneIcon2.png");
- $(".mail").find("img").attr("src","images/mailIcon.png");
- $(".mail").removeClass("active");
- $(this).addClass("active");
- $(".styleline").animate({left:"0px"});
- $("#mail_form").hide();
- $('#phone_form').show();
- });
- $(".mail").click(function(){
- $(this).find("img").attr("src","images/mailIcon2.png");
- $(".phone").find("img").attr("src","images/phoneIcon.png");
- $(".phone").removeClass("active");
- $(this).addClass("active");
- $(".styleline").animate({left:"151px"});
- $("#phone_form").hide();
- $("#mail_form").show();
- });
- var phonePass = false;
- function phoneVal(){
- var phone= $("#lp_phone").val();
- $.ajax("/ajax/isReg?key="+phone,{
- type:"GET",
- async: true,
- success:function($data){
- if(phone.length==0){
- $(".msgphone1").text("请输入您的手机号码");
- }else{
- var hunPhone=/^1[3|4|5|7|8]\d{9}$/;
- if(hunPhone.test(phone.trim())){
- if($data.data==false){
- $(".msgphone1").text("您的手机已被注册");
-
- }else{
- $(".msgphone1").text("");
- phonePass = true;
- addEvent(btn,"click",handler);
- }
- }else{
- phonePass = false;
- $(".msgphone1").text("手机格式正确,请输入正确的手机号码");
- }
- }
- },
- error:function(){
- $.MsgBox.Alert('消息','服务器请求失败')},
- });
- }
- $("#lp_phone").blur(function(){
- phoneVal();
- });
- var phoneCode=false;
- $("#lp_yzm").blur(function(){
- var authCode=$("#lp_yzm").val();
- if(authCode.length==0){
- $(".msgphone2").text("请输入您的验证码");
- phoneCode=false;
- }else{
- var d=/^[0-9a-zA-Z]{4}$/;
- if(d.test(authCode.trim())){
- $(".msgphone2").text("");
- phoneCode=true;
- }
- else{
- $(".msgphone2").text("请输入您的验证码不正确");
- phoneCode=false;
- }
- }
- });
- var btn = document.getElementById("getcode");
- var handler = function(){
- doClick();
- phoneVerificationCode();
- removeEvent(btn,'click',handler);
- }
- function addEvent(obj,type,handler){
- if(obj.addEventListener){
- obj.addEventListener(type,handler,false);
- }else if(obj.attachEvent){
- obj.attachEvent('on'+type,handler);
- }
- }
- function removeEvent(obj,type,handler){
- if(obj.removeEventListener){
- obj.removeEventListener(type,handler,false);
- }else if(obj.detachEvent){
- obj.detachEvent("on"+type,handler);
- }
- }
- function doClick(){
- removeClass(btn,'getcodeon');
- addClass(btn,'getcodeoff');
- btn.innerHTML="120s后重新获取";
- var clickTime = new Date().getTime();
- var Timer = setInterval(function(){
- var nowTime = new Date().getTime();
- var second = Math.ceil(120-(nowTime-clickTime)/1000);
- if(second>0){
- btn.innerHTML = second+"s后重新获取";
- }else{
- clearInterval(Timer);
- removeClass(btn,'getcodeoff');
- addClass(btn,'getcodeon');
- btn.innerHTML = "免费获取验证码";
- addEvent(btn,"click",handler);
- }
- },1000);
- }
- function hasClass(obj, cls) {
- return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
- }
- function addClass(obj, cls) {
- if (!hasClass(obj, cls)) obj.className += " " + cls;
- }
- function removeClass(obj, cls) {
- if (hasClass(obj, cls)) {
- var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
- obj.className = obj.className.replace(reg, ' ');
- }
- }
- var state;
- function phoneVerificationCode(){
- if(phonePass){
- $.ajax("/ajax/regmobilephone",
- {
- type: "get",
- async: true,
- success: function(data) {
- if(data.success) {
- state=data.data;
- }
- },
- error: function() {
- $.MsgBox.Alert('message', 'fail')
- },
- data: {
- "mobilePhone": $("#lp_phone").val()
- },
- dataType: 'json'
- });
- }
- };
- var setpass1= false;
- function setPhoneCode(){
- var pass= $("#lp_coder").val();
- if(pass.length==0){
- $(".msgphone3").text("请输入您的验证码");
- }else{
- var hunPhone=/^[0-9]{4}$/;
- if(hunPhone.test(pass.trim())){
- $(".msgphone3").text("");
- setpass1 = true;
- }else{
- $(".msgphone3").text("验证码4位");
- }
- }
- }
- $("#lp_coder").blur(function(){
- setPhoneCode();
- });
- var password;
- var setpass = false;
- function setPassword(){
- password= $("#phone_password").val();
- if(password.length==0){
- $(".msgphone4").text("请输入您的密码");
- }else{
- var hunPhone=/^[0-9a-zA-Z]{6,}$/;
- if(hunPhone.test(password.trim())){
- $(".msgphone4").text("");
- setpass = true;
- }else{
- $(".msgphone4").text("密码6到16位");
- }
- }
- }
- $("#phone_password").blur(function(){
- setPassword();
- });
- var setpassagain = false;
- function setPasswordAgain(){
- var passwordAgain= $("#phone_password2").val();
- if(passwordAgain.length==0){
- $(".msgphone5").text("请再次输入您的密码");
- }else{
- var hunPhone=/^[0-9a-zA-Z]{6,}$/;
- if(hunPhone.test(password.trim())&&passwordAgain==password){
- $(".msgphone5").text("");
- setpassagain= true;
- }else{
- $(".msgphone5").text("密码错误");
- }
- }
-
- }
- $("#phone_password2").blur(function(){
- setPasswordAgain();
- });
- $("#btnn").click(function(){
- if(phonePass&&setpass1&&setpassagain)
- {
- $.ajax("/ajax/regmobile",{
- type:"POST",
- async: false,
- success:function(data){
- if(data.success){
- loginagain();
- location.href="information-add.html?id="+data.data;
- }
- },
- error:function(){$.MsgBox.Alert('message','fail')},
- data:{"state":state,"mobilePhone":$("#lp_phone").val(),
- "validateCode":$("#lp_coder").val(),"password":$("#phone_password").val(),
- dataType: 'json'}
- });
- }
- });
- function loginagain(){
- $.ajax("/ajax/login",{
- type:"POST",
- async: false,
- success:function(data){
- },
- error:function(){$.MsgBox.Alert('message','fail')},
- data:{"pw":$("#phone_password").val(),"lk":$("#lp_phone").val()},
- dataType: 'json'
- });
- }
- var emailPass = false;
- function valEmail()
- {
- var email = $("#lp_email").val();
- var gunf=/^\w+@\w+\.((cn)|(com)|(com\.cn))$/;
-
- $.ajax("/ajax/isReg?key="+email,{
- type:"GET",
- async: true,
- success:function($data){
- if($data.data==false){
- $(".msgema1 span").text("您的邮箱已被注册");
- }else{
- if(gunf.test(email.trim())){
- $(".msgema1 span").text("");
- emailPass = true;
- }else{
-
- $(".msgema1 span").text("请输入正确是邮箱地址");
- emailPass = false;
- }
- }
- },
- error:function(){
- $.MsgBox.Alert('消息','服务器请求失败')},
- }
- );
-
-
- }
- $("#lp_email").blur(function(){
- valEmail();
- });
- var oldPass = false;
- var isPass = false;
- function valOld()
- {
- var oldPassword = $("#mail_password").val();
- if(oldPassword.length==0)
- {
- $(".msgema2 span").text("请输入密码");
- oldPass = false;
- }else if(oldPassword.length < 6)
- {
- $(".msgema2 span").text("密码不少于6位,请输入正确的密码");
- }else
- {
- $(".msgema2 span").text("");
- oldPass = true;
- }
- }
- $("#mail_password").blur(function(){
- valOld();
- })
- function valNew()
- {
- var newPassword = $("#mail_password").val();
- var oldPassword = $("#mail_password1").val();
- if(oldPassword.length==0)
- {
- $(".msgema3 span").text("密码不能为空");
- }
- else if(oldPassword.length<6)
- {
- $(".msgema3 span").text("密码长度过短,至少六位");
- }else if(oldPassword != newPassword)
- {
- $(".msgema3 span").text("两次密码不一致");
- } else
- {
- isPass = true;
- $(".msgema3 span").text("");
- }
- }
- $("#mail_password1").blur(function(){
- valNew();
- })
- function mailRegistration()
- {
- var mailVal = $("#lp_email").val();
- var passwordVal = $("#mail_password1").val();
- if(isPass&& emailPass)
- {
- $.ajax("/ajax/regmail",{
- type:"GET",
- async: false,
- success:function(data){
-
- $.cookie('mailVal',mailVal);
- $.cookie('userId',data.data);
- location.href="bind-mail.html";
- },
- error:function(){
- $.MsgBox.Alert('消息','邮箱发送失败')
- },
- data:{"mail":mailVal,"password":passwordVal},
- dataType: 'json'}
- );
- }
- }
- $("#btnn1").click(function(){
- mailRegistration();
- });
|