var checkAll = { /** * str 字符串常量 */ str: { UserAuthentication:/^[0-9A-Za-z\u4e00-\u9fa5_]+$/, phoneA:/^((13[0-9])|(14[0-9])|(16[0-9])|(17[0-9])|(15[0-9])|(18[0-9]|(19[0-9])))\d{8}$/, passwordA:/^[a-zA-Z0-9 &!#$%()*+,-=.\/:;?@\[\]^_`<>{|}~]+$/, emailA:/^\w+([-.]\w+)*@\w+([-]\w+)*\.(\w+([-]\w+)*\.)*[a-z]{2,10}$/, vericodes:/^\d+$/, NonMainlandPhonNumber:/^[0-9]+$/ }, passwordStr: { UPPER : "ABCDEFGHIJKLMNOPQRSTUVWXYZ", LOWER : "abcdefghijklmnopqrstuvwxyz", NUMBER : "0123456789", CHARACTER : "~`!@#$%^&*()_-+={}[]|;:,<>.?/" }, msg: { msg0 : jsMsg.msg0, msg1 : jsMsg.msg1, msg2 : jsMsg.msg2, msg3 : $(""), msg4 : jsMsg.msg4, msg5 : jsMsg.msg5, msg6 : jsMsg.msg6, msg7 : jsMsg.msg7, msg8 : jsMsg.msg8, msg9 : jsMsg.msg9, msg10 : jsMsg.msg10, msg11 : jsMsg.msg11, oldPhoneEmpty : jsMsg.oldPhoneEmpty, enterpass : jsMsg.enterpass, passportCannotSame: jsMsg.passportCannotSame }, onoff:null, /** * 对应校验条目 * @type {Object} */ checkItem1: function(value){ if(value == " " || value == ""){ return 0; }else{ return 1; } }, checkItem2: function(value){ if(value == " " || value == ""){ }else{ var reg = /^[\u4e00-\u9fa5a-z\d_]{2,}$/gi; if (reg.test(value)) { var len = value.replace(/[^\x00-\xff]/g,"aa").length; if (len < 4 || len > 16) { return 0; } return 1; } return 0; } }, checkCountryPhone:function(value){ if(value == " " || value == ""){ return 0; }else{ if (this.str.NonMainlandPhonNumber.test(value)) { return 1; }else{ return 0; } } }, checkItem3: function(value){ if(value == " " || value == ""){ return 0; }else{ if(zPassport.countryCodeIsn()){ if (this.str.phoneA.test(value)) { return 1; }else{ return 0; } }else{ // !="+86" 非大陆手机号的验证 if (this.str.NonMainlandPhonNumber.test(value)) { return 1; }else{ return 0; } } } }, checkItem4:function(value){ if(value == " " || value == ""){ return 0; }else if(value.length < 8 || value.length >20){ return 0; }else{ if (this.str.passwordA.test(value)) { return 1; }else{ return 0; } } }, checkItem5: function(value){ if(value == ""){ return 0; }else{ var item3Result = {UPPER:0,LOWER:0,NUMBER:0,CHARACTER:0}; for (j in this.passwordStr) { var strKey = j; var strValue = this.passwordStr[strKey]; for (k = 0; k < value.length; k++) { if (strValue.indexOf(value.charAt(k)) > -1) { item3Result[strKey] = 1; } } } if(item3Result.UPPER + item3Result.LOWER + item3Result.NUMBER +item3Result.CHARACTER > 1){ return 1; }else{ return 0; } } }, checkemail:function(value){ if(value == " " || value == ""){ return 0; }else{ if(this.str.emailA.test(value)){ return 1; }else{ return 0; } } }, checkveri:function(value){ if(value == " " || value == ""){ return 0; }else{ return 1; } }, checkvericode:function(value){ if(value == " " || value == ""){ return 0; }else{ if(this.str.vericodes.test(value)){ return 1; }else{ return 0; } } }, checkboxed:function(value){ if(value){ return 1; }else{ return 0; } }, radios:function(){ $('#Useragreement,#loginstatus').click(function(){ if($(this).attr("checked")){ $(this).removeAttr("checked") }else{ $(this).attr("checked",true) } }) }, checkTxzForm:function(){ var formEmail = $('#email,#emails').attr('pass'); if(formEmail == "n" || formEmail == undefined){ // alert(jsMsg.alertCheckEmail) createSimpleToastEle(jsMsg.alertCheckEmail) return false; } if($('.nc-lang-cnt').attr('data-nc-lang') != '_yesTEXT'){ // alert(jsMsg.alertCheckPass) createSimpleToastEle(jsMsg.alertCheckPass) return false; } }, checkVerNc:function(){ if($('.nc-lang-cnt').attr('data-nc-lang') != '_yesTEXT'){ // alert(jsMsg.alertCheckPass) return false; } } } function controlHasAccButtonIsHighlight(){ if(checkAll.checkItem1($('#Existinguser').val()) != 0 && checkAll.checkItem1($('#passwords').val()) != 0){ $('#loginbind').addClass('btn-default-main').removeClass('btn-disabled').removeAttr('disabled'); }else{ $('#loginbind').removeClass('btn-default-main').addClass('btn-disabled').attr('disabled'); } } $('.checkbox-wrap label').on('click', function() { $("input[name=autolog]").parent().removeClass().addClass('check-c') $("input[name=autolog]:checked").parent().removeClass().addClass('check-cd') }) //弹窗,自行绑定确定方法 function binds(obj){ this.PopupBlock = $(obj.PopupBlock); this.closebtn = $(obj.closebtn); this.Deter = $(obj.Deter); this.Unbundling = $(obj.Unbundling); this.cancel = obj.cancel; this.cancelF($(this.cancel)).cancelF($(this.closebtn)); } binds.prototype = { cancelF:function(close){ var that = this; close.on('click',function(){ that.PopupBlock.hide(); }) return this; } } function popupBlock(){ return new binds({ PopupBlock:'.pop-up-confirm', closebtn:'.pop-close', Deter:'.pop-confirm', Unbundling:'.unbunding', cancel:'.pop-cancel' }) } popupBlock(); // msg function Msg(obj){ this.Unbundling = $(obj.Unbundling); this.url = obj.url; this.tips = obj.tips; this.shows(); } Msg.prototype = { shows:function(){ var that = this; this.Unbundling.show(); this.Unbundling.find('p').html(this.tips) setTimeout(function(){ that.Unbundling.hide(); if(that.url){ location.href = that.url; } },1500) } } function msg(tiptxt,url){ new Msg({ Unbundling:'.unbunding', url:url, tips:tiptxt }); } function regType(type){ if(type == 1){ $('form').attr('action','/regEmail.do?' + window.location.href.split('?')[1]); }else{ $('form').attr('action','/reg.do?' + window.location.href.split('?')[1]); } $('form').removeAttr('onsubmit'); $('form').submit(); } function thirdAccountTab(){ if($('#type').val() == 1){ $('.account-number-tab span').removeClass('current-status'); $('.account-number-tab span').eq(1).addClass('current-status'); $('.account-num-box .account-binding-box').show(); $('.account-num-box .account-num-tabcon').hide(); } } // 捎带已有账号值,到 var locationSearchPhoneIsNum = location.search.lastIndexOf('jumpPhone'); var jumpPhoneParam = location.search.substr(location.search.lastIndexOf('jumpPhone')); $(function() { if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) { $(window).load(function(){ $('input[type=text]').val(''); if(locationSearchPhoneIsNum != -1){ $('#Existinguser').val(jumpPhoneParam.split('=')[1]) } }); }else{ if(locationSearchPhoneIsNum != -1){ $('#Existinguser').val(jumpPhoneParam.split('=')[1]) } } }); function showGlobalMaskLayer() { if(!$('.shade').length){ $('body').append('
') }else{ $('.shade').removeClass('hide'); } $('html').addClass('body-fixed') } function hideGlobalMaskLayer() { $('.shade').addClass('hide'); $('html').removeClass('body-fixed'); } var passDomain = location.host.indexOf('test') !== -1 ? 'http://static.test.zcool.cn' : 'https://static.zcool.cn' function showLoading(obj) { var loaddingUrl = passDomain + '/passport4.0/images/common/page_loading.gif' obj.show().append('
'); } function countryPhoneCodeSuccessCb(data){ var areaList = '
'; if(!$('.code-list-ul').length){ $('.area-code-covers').html(areaList) } $(".js-scroll-covers").mCustomScrollbar({ theme: "dark", //主题颜色 scrollButtons: { scrollSpeed: 100, enable: true //是否使用上下滚动按钮 }, autoHideScrollbar: true, //是否自动隐藏滚动条 scrollInertia: 100, //滚动延迟 horizontalScroll: false, //水平滚动条 autoDraggerLength: true, callbacks: { onScrollStart: function () { $('.mCS-autoHide .mCustomScrollBox .mCSB_scrollTools').css({ "opacity": '1', '-webkit-animation': 'none' }) }, whileScrolling: function () { $('.mCS-autoHide .mCustomScrollBox .mCSB_scrollTools').css({ "opacity": '1', '-webkit-animation': 'none' }) }, onScroll: function () { //滚动完成后触发事件 $('.mCS-autoHide .mCustomScrollBox .mCSB_scrollTools').removeAttr('style') } } }); bindEventArea() } function getPassAreaAsync(){ $('.area-code-covers').html(""); showLoading($('.area-code-covers')) $.ajax({ url:"./getCountryPhoneCodes.do?v=1", type:"get", dataType :'json', success:function(data){ if(data.result && data.data.length){ countryPhoneCodeSuccessCb(data.data) }else{ msg(data.msg, null); } }, error:function(){ msg('操作失败,请稍后重试', null); } }); } function bindEventArea(){ $('body .area-wrap .code-list-ul').on('click','li',function(){ hideGlobalMaskLayer() $('.area-wrap').hide(); var areaId = $(this).attr('data-id'); var areaCode = $(this).attr('data-code'); $('#country-area-code').text(areaCode); $('#country-code-ipt').val(areaCode) }) } function areaPopUpShow(){ var html = '
' + ''+ '
' + '
' + '
' + '
' !$('.area-wrap').length?$('body').append(html):$('.area-wrap').show(); // 如果国家区号请求成功后不用再请求一遍了 if(!$('.code-list-ul').length){ getPassAreaAsync() } $('body .pop-up').on('click','.pop-cancel,.pop-close',function(){ hideGlobalMaskLayer() $('.area-wrap').hide(); }) } $('#country-area-code').on('click',function(){ showGlobalMaskLayer() areaPopUpShow() }) jQuery('.form-eye-icon').bind('click',function(){ if($('#password').attr("type") == "password"){ $('#password').attr("type","text"); $(this).addClass('disabled-glance') }else{ $('#password').attr("type","password"); $(this).removeClass('disabled-glance') } });