passport.bind.js 8.83 KB
webpackJsonp([9],{0:function(e,t,n){n(32)},2:function(e,t,n){function o(e,t){var n,o;"undefined"!=typeof e&&(n=e.toString(),o=t&&t>0?t:2e3,i.text(n).show(),a=setTimeout(function(){"block"===i.css("display")&&i.hide()},o))}var i,a,s=n(1);!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),i=s("#yoho-tip"),i.on("touchend",function(){i.hide(),clearTimeout(a)})}(),t.show=o},3:function(e,t,n){function o(e){var t,n,o=document.cookie;return document.cookie&&""!==document.cookie&&(n=o.indexOf(e+"="),n>-1&&(n+=e.length+1,t=decodeURIComponent(p.trim(o.substring(n,o.indexOf(";",n)))))),t}function i(e,t,n){var o,i,a,s,r="";"undefined"!=typeof t&&(n=n||{},null===t&&(t="",n.expires=-1),n.expires&&("number"==typeof n.expires||n.expires.toUTCString)&&("number"==typeof n.expires?(s=new Date,s.setTime(s.getTime()+24*n.expires*60*60*1e3)):s=n.expires,r="; expires="+s.toUTCString()),o=n.path?"; path="+n.path:"",i=n.domain?"; domain="+n.domain:"",a=n.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,o,i,a].join(""))}function a(){var e=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||e||(document.cookie="testcookie",e=-1!==document.cookie.indexOf("testcookie")),e}function s(){var e,t=o("_UID");return"undefined"==typeof t?0:(e=t.split("::"),"undefined"==typeof e||e.length<4?0:e)}function r(){var e=s();return 0===e?0:e[1]}function d(){var e=o("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function c(){var e;0!==f.length&&(e=Math.min(p(window).height(),window.screen.availHeight),p("body").height()<=e-parseInt(f.css("height"),0)?f.addClass("bottom"):f.removeClass("bottom"))}function l(e){var t=p(e).outerHeight();e&&f.css("margin-bottom",t+"px")}function u(){var e,t,n=[],o=window.location.search.slice(1).split("&");for(t=0;t<o.length;t++)e=o[t].split("="),n.push(e[0]),n[e[0]]=e[1];return n}function h(e){return e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}var p=n(1),g=n(4),f=p("#yoho-footer"),m=p(".yoho-page"),w=p(".yoho-header");!function(){var e,t=f.children(".op-row"),n=p(".back-to-top"),o=s();c(),0===o?t.prepend('<a href="http://m.yohobuy.com/signin.html?refer='+location.href+'">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):t.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+o[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index">退出</a>'),n.length>0&&(e=new g(n[0]),e.on("tap",function(e){return p(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),f.removeClass("hide")}(),function(e,t,n,o,i){var a=t.createElement(n),s=t.getElementsByTagName(n)[0];e.YohoAcquisitionObject=i,e[i]=function(){e[i].p=arguments},a.async=1,a.src=o,s.parentNode.insertBefore(a,s)}(window,document,"script",("https:"===document.location.protocol?"https":"http")+"://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js","_yas"),function(){var e=r();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.17","yohobuy_m",e,"","")}(),w.on("touchstart","a",function(){w.find("a").removeClass("highlight"),p(this).addClass("highlight")}).on("touchend touchcancel","a",function(){p(this).removeClass("highlight")}),m.on("touchstart",".tap-hightlight",function(){p(this).siblings(".tap-hightlight").removeClass("highlight"),p(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){p(this).removeClass("highlight")}),p(".nav-home").on("touchstart",function(){p(".homebuttom").toggleClass("hide")}),function(){var e,t,n=0,o="webkit moz ms o".split(" "),i=window.requestAnimationFrame,a=window.cancelAnimationFrame;for(t=0;t<o.length&&(!i||!a);t++)e=o[t],i=i||window[e+"RequestAnimationFrame"],a=a||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];i&&a||(i=function(e){var t=(new Date).getTime(),o=Math.max(0,16-(t-n)),i=window.setTimeout(function(){e(t+o)},o);return n=t+o,i},a=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=i,window.cancelAnimationFrame=a}(),p.extend({queryString:u}),11===f.find(".user-name").text().length&&f.find(".user-name").html(h(f.find(".user-name").text())),window.cookie=o,window.setCookie=i,window.isCookiesEnabled=a,window.getUser=s,window.getUid=r,window.getShoppingKey=d,window.rePosFooter=c,window.reMarginFooter=l,window.queryString=u()},5:function(e,t,n){function o(e){var t,n=r(".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=r(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=r(".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=r(this),t=e.siblings(".clear-input"),n=d(e.val());""===n?t.hide():t.show()})}function a(e){return e.length>=6&&e.length<=20}function s(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 r=n(1),d=r.trim,c=/^([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:c,phoneRegx:l,bindEyesEvt:o,bindClearEvt:i,pwdValidate:a,selectCssHack:s}},21:function(e,t,n){var o=n(1),i=n(19),a=n(4);t.showDialog=function(e,t,n,s){function r(){var e,t=null;return null===t&&(t='<div id="dialog-wrapper" class="dialog-wrapper"><div class="dialog-box">{{# hasHeader}}{{/ hasHeader}}<div class="dialog-content">{{dialogText}}</div>{{# hasFooter}}<div class="dialog-footer">{{# leftBtnText}}<span class="dialog-left-btn tap-hightlight">{{.}}</span>{{/ leftBtnText}}{{# rightBtnText}}<span class="dialog-right-btn tap-hightlight">{{.}}</span>{{/ rightBtnText}}</div>{{/ hasFooter}}</div></div>',e=i.compile(t)),e}var d,c,l,u,h;d=r()(e),o(".dialog-wrapper").remove(),o("body").append(o(d)),c=o(".dialog-box"),u=o(".dialog-wrapper"),h=new a(document.getElementById("dialog-wrapper")),e.fast?u.css({display:"block"}):u.fadeIn(),s&&(o(".dialog-wrapper .dialog-footer > span").css("width","100%"),o(".dialog-wrapper .dialog-content").css({"padding-left":"1.85rem","padding-right":"1.85rem"}),u.css("z-index","10")),c.css({top:"50%",marginTop:-(c.height()/2)}),e.autoHide&&(l=1e3,e.autoHide>1&&(l=e.autoHide),setTimeout(function(){u.fadeOut()},l)),u.on("touchmove",function(){return!1}),h.on("tap",function(e){if(o(e.target).hasClass("dialog-left-btn"))"function"==typeof n&&n(),u.fadeOut();else if(o(e.target).hasClass("dialog-right-btn"))return t();e.preventDefault(),e.srcEvent.stopPropagation()})},t.hideDialog=function(){o(".dialog-wrapper").remove()}},32:function(e,t,n){function o(e,t,n){return w?!1:(w=!0,u.addClass("disable").html("绑定中..."),void i.ajax({type:"POST",url:"/passport/bind/sendBindMsg",data:{phoneNum:t,areaCode:n.replace("+","")},success:function(t){200===t.code?(window._yas&&window._yas.sendCustomInfo&&window._yas.sendCustomInfo({loginRefer:l.val()},!1),location.href=e):p.show(t.message)},error:function(){p.show("出错了,请重试!"),u.removeClass("disable").html("下一步"),w=!1}}))}var i=n(1),a=i("#phone-num"),s=i("#country-select"),r=i("#area-code"),d=i("#openId"),c=i("#nickname"),l=i("#sourceType"),u=i("#btn-next"),h=n(5),p=n(2),g=n(21),f=i.trim,m=p.show,w=!1;n(3),h.selectCssHack(i("#country-select")),h.bindClearEvt(),a.bind("input",function(){""===f(a.val())?u.addClass("disable"):u.removeClass("disable")}),s.change(function(){r.text(s.val())}),u.on("touchstart",function(){var e=f(a.val()),t=f(d.val()),n=f(c.val()),r=f(l.val()),p=s.val();u.hasClass("disable")||(h.phoneRegx[p].test(e)?i.ajax({url:"/passport/bind/bindCheck",type:"POST",data:{areaCode:p.replace("+",""),phoneNum:e,openId:t,sourceType:r,nickname:n},success:function(t){200===t.code?1===t.data.isReg?g.showDialog({dialogText:"该手机号已注册过有货\n"+e+",确定绑定吗?",hasFooter:{leftBtnText:"更换号码",rightBtnText:"继续绑定"}},function(){o(t.data.next,e,p)}):3===t.data.isReg?g.showDialog({dialogText:"该手机号已注册过有货\n"+e+",是否进行关联?",hasFooter:{leftBtnText:"更换号码",rightBtnText:"确定"}},function(){o(t.data.next,e,p)}):o(t.data.next,e,p):m(t.message)}}):m("手机号格式不正确,请重新输入"))}),/MicroMessenger/i.test(navigator.userAgent)&&i.queryString().refer&&i(".go-back").attr("href",decodeURIComponent(i.queryString().refer))}});