passport.login.js
3.07 KB
webpackJsonp([21],{0:function(t,e,n){n(34)},2:function(t,e,n){function i(t,e){var n,i;"undefined"!=typeof t&&(n=t.toString(),i=e&&e>0?e:2e3,a.text(n).show(),o=setTimeout(function(){"block"===a.css("display")&&a.hide()},i))}var a,o,s=n(1);!function(){var t='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(t),a=s("#yoho-tip"),a.on("touchend",function(){a.hide(),clearTimeout(o)})}(),e.show=i},7:function(t,e,n){function i(t){var e,n=c(".has-eye");t&&"open"===t.status?n.append('<div class="eye"></div>'):n.append('<div class="eye close"></div>'),e=n.children(".eye"),e.on("touchstart",function(t){var e=c(this),n=e.siblings(".pwd");t.preventDefault(),e.toggleClass("close"),e.hasClass("close")?n.attr("type","password"):n.attr("type","text"),n.focus()})}function a(){var t,e=c(".has-clear");e.append('<div class="clear-input"></div>'),t=e.children(".clear-input"),t.on("touchstart",function(e){var n=t.siblings(".input");n.val("").trigger("input").focus(),e.preventDefault()}),e.children(".input").bind("input",function(){var t=c(this),e=t.siblings(".clear-input"),n=r(t.val());""===n?e.hide():e.show()})}function o(t){return t.length>=6&&t.length<=20}function s(t){function e(){var e=t.find("option:selected").text().length;switch(e){case 2:t.outerWidth(90);break;case 3:t.outerWidth(110);break;default:t.outerWidth(130)}}var n=navigator.userAgent;n.match(/uc/i)&&n.match(/android/i)?t.change(function(){e()}):t.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}$/,d={"+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}$/};t.exports={emailRegx:u,phoneRegx:d,bindEyesEvt:i,bindClearEvt:a,pwdValidate:o,selectCssHack:s}},34:function(t,e,n){function i(){p&&h?u.removeClass("disable"):u.addClass("disable")}function a(){d.show(),l.show()}function o(){d.hide(),l.hide()}var s=n(1),c=s("#account"),r=s("#pwd"),u=s("#btn-login"),d=s("#retrive-pwd-mask"),l=s("#retrive-pwd-ways"),p=!1,h=!1,v=n(7),f=n(2),g=s.trim,b=f.show;v.bindEyesEvt(),v.bindClearEvt(),c.bind("input",function(){p=""!==g(c.val()),i()}),r.bind("input",function(){h=""!==g(r.val()),i()}),u.on("touchstart",function(){var t=g(c.val()),e=g(r.val());u.hasClass("disable")||(u.text("正在登录...").addClass("disable"),(/^[0-9]+$/.test(t)||v.emailRegx.test(t))&&v.pwdValidate(e)?s.ajax({type:"POST",url:"/passport/login/auth",data:{account:t,password:e},success:function(t){var e;200===t.code?(e=t.data,b("登录成功"),location.href=e.href):b(t.message)},error:function(){b("网络断开连接啦~")},complete:function(){u.text("登录").removeClass("disable")}}):(b("账号或密码有错误,请重新输入"),u.text("登录").removeClass("disable")))}),s("#forget-pwd").on("touchstart",function(){a()}),d.on("touchstart",function(){o()}),s("#cancel-retrive").on("touchstart",function(t){t.preventDefault(),o()}),c.trigger("input"),r.trigger("input")}});