passport.international.js 3.1 KB
webpackJsonp([23],{0:function(e,t,n){n(36)},2:function(e,t,n){function a(e,t){var n,a;"undefined"!=typeof e&&(n=e.toString(),a=t&&t>0?t:2e3,i.text(n).show(),s=setTimeout(function(){"block"===i.css("display")&&i.hide()},a))}var i,s,o=n(1);!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';o(".yoho-page").append(e),i=o("#yoho-tip"),i.on("touchend",function(){i.hide(),clearTimeout(s)})}(),t.show=a},5:function(e,t,n){function a(e){var t,n=c(".has-eye");e&&"open"===e.status?n.append('<div class="eye"></div>'):n.append('<div class="eye close"></div>'),t=n.children(".eye"),t.on("touchstart",function(e){var t=c(this),n=t.siblings(".pwd");e.preventDefault(),t.toggleClass("close"),t.hasClass("close")?n.attr("type","password"):n.attr("type","text"),n.focus()})}function i(){var e,t=c(".has-clear");t.append('<div class="clear-input"></div>'),e=t.children(".clear-input"),e.on("touchstart",function(t){var n=e.siblings(".input");n.val("").trigger("input").focus(),t.preventDefault()}),t.children(".input").bind("input",function(){var e=c(this),t=e.siblings(".clear-input"),n=r(e.val());""===n?t.hide():t.show()})}function s(e){return e.length>=6&&e.length<=20}function o(e){function t(){var t=e.find("option:selected").text().length;switch(t){case 2:e.outerWidth(90);break;case 3:e.outerWidth(110);break;default:e.outerWidth(130)}}var n=navigator.userAgent;n.match(/uc/i)&&n.match(/android/i)?e.change(function(){t()}):e.removeClass("in-android-uc")}var c=n(1),r=c.trim,u=/^([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,l={"+86":/^1[35847]{1}[0-9]{9}$/,"+852":/^[965]{1}[0-9]{7}$/,"+853":/^[0-9]{8}$/,"+886":/^[0-9]{10}$/,"+65":/^[98]{1}[0-9]{7}$/,"+60":/^1[1234679]{1}[0-9]{8}$/,"+1":/^[0-9]{10}$/,"+82":/^01[0-9]{9}$/,"+44":/^7[789][0-9]{8}$/,"+81":/^0[9|8|7][0-9]{9}$/,"+61":/^[0-9]{11}$/};e.exports={emailRegx:u,phoneRegx:l,bindEyesEvt:a,bindClearEvt:i,pwdValidate:s,selectCssHack:o}},36:function(e,t,n){function a(){l&&d?u.removeClass("disable"):u.addClass("disable")}var i=n(1),s=i("#phone-num"),o=i("#country-select"),c=i("#area-code"),r=i("#pwd"),u=i("#btn-login"),l=!1,d=!1,p=n(5),h=n(2),v=i.trim,f=h.show;p.selectCssHack(o),p.bindEyesEvt(),p.bindClearEvt(),s.bind("input",function(){l=""!==v(s.val()),a()}),r.bind("input",function(){var e=v(r.val());d=""!==e,a()}),o.change(function(){c.text(o.val())}),u.on("touchstart",function(){var e=v(s.val()),t=o.val(),n=v(r.val());u.hasClass("disable")||(u.text("正在登录...").addClass("disable"),p.phoneRegx[t].test(e)&&p.pwdValidate(n)?i.ajax({type:"POST",url:"/passport/login/auth",data:{areaCode:t.replace("+",""),account:e,password:n},success:function(e){var t,n;200===e.code?(t=e.data,f("登录成功"),i.ajax({url:t.session,dataType:"jsonp",success:function(){clearTimeout(n),setTimeout(function(){location.href=t.href},1e3)}}),n=setTimeout(function(){location.href=t.href},3e3),f("登录成功")):f(e.message)},error:function(){f("网络断开连接啦~")},complete:function(){u.text("登录").removeClass("disable")}}):(f("账号或密码有错误,请重新输入"),u.text("登录").removeClass("disable")))}),s.trigger("input"),r.trigger("input")}});