passport.back-verify-mobile-code.js 2.72 KB
webpackJsonp([14],{0:function(a,e,t){t(24)},3:function(a,e,t){function s(a){var e,t,s,o=0,l=0;for(s=0;s<a.length;s++)t=a.substr(s,1),l+=/.*[\u4e00-\u9fa5]+.*$/.test(t)?2:1;if(10>=l)e=a;else{for(o=0,e="",s=0;s<a.length;s++)10>o&&(t=a.substr(s,1),"*"!==t&&(o+=/.*[\u4e00-\u9fa5]+.*$/.test(t)?2:1),e+=t);e.length<a.length&&(e+="...")}return e}function o(a){var e,t,o=a.data;-1!==a.result?(t=s(o.profile_name),e='<span>Hi~</span><a href="//www.yohobuy.com/home?t='+o.random+'">'+t+'</a>&nbsp;<a href="//www.yohobuy.com/logout.html">[退出]</a>'):e='<span>Hi~</span>&nbsp;<a href="//www.yohobuy.com/signin.html">[请登录]</a>&nbsp;<a href="//www.yohobuy.com/reg.html">[免费注册]</a>',r(".header-tool li").eq(0).html(e)}function l(){var a={return_type:"jsonp"};r.getJSON("//www.yohobuy.com/common/passport/?callback=?",a,function(a){a&&a.data&&o(a.data)})}var r=t(1),i=r("#api-domain");i.remove(),r(".simple-header").size()>0&&r(".tool-options").on("mouseenter",function(){r(this).find(".tool-select").fadeIn()}).on("mouseleave",function(){r(this).find(".tool-select").fadeOut()}),l()},24:function(a,e,t){var s,o,l=t(1),r=l("#send-captcha"),i=l("#captcha-tip"),n=l("#err-tip"),d=l("#next-step");t(3),r.click(function(){l.post("/passport/back/sendbackmobile",{mobile:l("#mobile").val(),area:l("#area").val(),verifyCode:l("#captchaPic").val()},function(a){if(200===a.code){if(n.hide(),l(this).hasClass("disable"))return;s=60,r.addClass("disable").attr("disabled",!0),i.removeClass("hide"),r.val(s--+"秒后可重新操作"),o=setInterval(function(){0===s?(clearInterval(o),r.val("发送验证码").removeClass("disable").removeAttr("disabled")):r.val(s--+"秒后可重新操作")},1e3)}else l(this).addClass("error"),n.removeClass("hide").text("发送失败")})}),s=60,r.addClass("disable").attr("disabled",!0),i.removeClass("hide"),r.val(s--+"秒后可重新操作"),o=setInterval(function(){0===s?(clearInterval(o),r.val("发送验证码").removeClass("disable").removeAttr("disabled")):r.val(s--+"秒后可重新操作")},1e3),l("#captcha").keyup(function(){var a=l.trim(l(this).val()),e=this;4===a.length?l.ajax({type:"POST",url:"/passport/back/backmobile",dataType:"json",data:{code:l("#captcha").val(),verifyCode:l("#captchaPic").val(),area:l("#area").val(),mobile:l("#mobile").val()},success:function(a){200===a.code?(console.log(a.data),d.removeClass("disable").attr("href",a.data),n.addClass("hide"),l(e).removeClass("error")):(d.addClass("disable"),n.removeClass("hide").find("em").text("验证码输入错误"),l(e).addClass("error"))}}):d.addClass("disable").attr("href","javascript:;")}).blur(function(){var a=l.trim(l(this).val());""===a&&(l(this).addClass("error"),n.removeClass("hide").text("请输入验证码"))}).focus(function(){l(this).removeClass("error")})}});