be5105bd
xu
app-wx(v0.1.0 bui...
|
1
|
define("user-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},o=!0;return e.name="user",e.routes={index:function(){return o=!1,n(),e.runController("index")},register:function(){return o=!1,n(),e.runController("register")},login:function(){return o=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var o=Dom7,e=(Template7,new e),i="/user/login/get-code",r="/user/login/login",l=!0,s=!0,c=null;return e.run=function(){var e=this;return e.setPageTitle("登录"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;o("#login .get-code-cls").click(function(){var r=n.trim(o("#login .mobile").val());if(""==r)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(r))return n.toast({content:"手机号码不合格"}),!1;if(0==l)return!1;clearInterval(c),l=!1;var s=e.csrf({action:"login",mobile:r});n.httpGet(t.to(i),s,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;t.testCode&&o("#login .code").val(t.testCode);var i=t.codeDuration;e.codeDuration=i,c=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#login .get-code-cls").html("获取验证码"),clearInterval(c),e.codeDuration=i,l=!0):o("#login .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.loginEvent=function(){var e=this;o("#login .login-btn").click(function(i){var l=n.trim(o("#login .mobile").val()),c=n.trim(o("#login .code").val());if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==c)return n.toast({content:"验证码必填"}),!1;if(0==s)return!1;s=!1;var a=e.csrf({mobile:l,code:c});n.httpPost(t.to(r),a,function(e){return s=!0,e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),!1)})})},e.gotoRegisterEvent=function(){o("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,o){var i=Dom7,e=(Template7,new e),r="/user/login/register",l="/user/default/upload-file",s="/user/login/get-code",c=!0,a=!0,u=null;return e.run=function(){var e=this;return e.setPageTitle("注册"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent()},e.uploadEvent=function(){i("#register .upload-input-cls").change(function(){if(""!=i(this).val()&&null!=i(this).val()){var e=i(this).attr("id"),r=i(this).parent();o.uploadFile({selector:"#"+e,url:t.to(l),processAppendTo:"#register",success:function(e,t){try{if(e.success){var o=e.tmpUrl;r.css("background-image","url("+e.tmpMinUrl+")"),r.attr("data",e.tmpFile),r.attr("data-url",o)}else n.toast({content:e.message,closeDelay:5e3})}catch(i){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;i("#register .get-code-cls").click(function(){var o=n.trim(i("#register .mobile").val());if(""==o)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(o))return n.toast({content:"手机号码不合格"}),!1;if(0==c)return!1;clearInterval(u),c=!1;var r=e.csrf({action:"register",mobile:o});n.httpGet(t.to(s),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;t.testCode&&i("#register .code").val(t.testCode);var o=t.codeDuration;e.codeDuration=o,u=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(i("#register .get-code-cls").html("获取验证码"),clearInterval(u),e.codeDuration=o,c=!0):i("#register .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.registerEvent=function(){var e=this;i("#register .register-btn").click(function(o){var l=n.trim(i("#register .name").val()),s=n.trim(i("#register .mobile").val()),c=n.trim(i("#register .code").val());if(""==l)return n.toast({content:"车厂名称必填"}),!1;if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))return n.toast({content:"手机号码不合格"}),!1;if(""==c)return n.toast({content:"验证码必填"}),!1;var u=i("#register .licensePic").attr("data");if(void 0===u||null==u)return n.toast({content:"请上传营业执照"}),!1;if(0==a)return!1;a=!1;var d=e.csrf({name:l,mobile:s,code:c,licensePic:u});n.httpPost(t.to(r),d,function(e){return e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),a=!0,!1)})})},e.gotoLoginEvent=function(){i("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e});
|