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('
'),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='加载速度太慢?试试重新加载',e.appendChild(t))},window.waitingTime))},r=!0;return e.name="user",e.routes={index:function(){return r=!1,n(),e.runController("index")},register:function(){return r=!1,n(),e.runController("register")},login:function(){return r=!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 r=Dom7,e=(Template7,new e),o="/user/login/get-code",i="/user/login/login",c=!0,s=!0,a=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;r("#login .get-code-cls").click(function(){var i=n.trim(r("#login .mobile").val());if(""==i)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(i))return n.toast({content:"手机号码不合格"}),!1;if(0==c)return!1;clearInterval(a),c=!1;var s=e.csrf({action:"login",mobile:i});n.httpGet(t.to(o),s,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;n.toast({content:t.message}),t.testCode&&r("#login .code").val(t.testCode);var o=t.codeDuration;e.codeDuration=o,a=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(r("#login .get-code-cls").html("获取验证码"),clearInterval(a),e.codeDuration=o,c=!0):r("#login .get-code-cls").html(''+e.codeDuration+"s后重新获取")},1e3)})})},e.loginEvent=function(){var e=this;r("#login .login-btn").click(function(o){var c=n.trim(r("#login .mobile").val()),a=n.trim(r("#login .code").val());if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(0==s)return!1;s=!1;var l=e.csrf({mobile:c,code:a});n.httpPost(t.to(i),l,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(){r("#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,r){var o=Dom7,i=Template7,e=new e,c="/user/login/register",s="/user/default/upload-file",a="/user/login/get-code",l=!0,u=!0,d=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.checkAgreement()},e.uploadEvent=function(){o("#register .upload-input-cls").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var e=o(this).attr("id"),i=o(this).parent();r.uploadFile({selector:"#"+e,url:t.to(s),processAppendTo:"#register",success:function(e,t){try{if(e.success){var r=e.tmpUrl;i.css("background-image","url("+e.tmpMinUrl+")"),i.attr("data",e.tmpFile),i.attr("data-url",r)}else n.toast({content:e.message,closeDelay:5e3})}catch(o){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;o("#register .get-code-cls").click(function(){var r=n.trim(o("#register .mobile").val());if(""==r)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(r))return n.toast({content:"手机号码不合格"}),!1;if(0==l)return!1;clearInterval(d),l=!1;var i=e.csrf({action:"register",mobile:r});n.httpGet(t.to(a),i,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;n.toast({content:t.message}),t.testCode&&o("#register .code").val(t.testCode);var r=t.codeDuration;e.codeDuration=r,d=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#register .get-code-cls").html("获取验证码"),clearInterval(d),e.codeDuration=r,l=!0):o("#register .get-code-cls").html(''+e.codeDuration+"s后重新获取")},1e3)})})},e.registerEvent=function(){var e=this;o("#register .register-btn").click(function(r){var i=n.trim(o("#register .name").val()),s=n.trim(o("#register .mobile").val()),a=n.trim(o("#register .code").val()),l=n.trim(o("#register .emergency_contact").val()),d=n.trim(o("#register .emergency_person").val());if(""==i)return n.toast({content:"车厂名称必填"}),!1;if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(""==d)return n.toast({content:"紧急联系人必填"}),!1;if(""==l)return n.toast({content:"紧急联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"紧急联系电话不合格"}),!1;if(l==s)return n.toast({content:"紧急联系电话不能和注册手机一样"}),!1;var g=o("#register .licensePic").attr("data");if(void 0===g||null==g)return n.toast({content:"请上传营业执照"}),!1;var v=o("#register .headPic").attr("data");if(void 0===v||null==v)return n.toast({content:"请上传维修厂门头照"}),!1;var f=o("#register .techChargePic").attr("data");if(void 0===f||null==f)return n.toast({content:"请上传维修技术负责人证书"}),!1;var m=o("#register .QAChargePic").attr("data");if(void 0===m||null==m)return n.toast({content:"请上传质检负责人证书"}),!1;if(!o("#register .check-agreement").hasClass("checked-active"))return n.toast({content:"请阅读同意《平台车管家服务条款》"}),!1;if(0==u)return!1;u=!1;var h=e.csrf({name:i,mobile:s,code:a,emergencyContact:l,emergencyPerson:d,licensePic:g,headPic:v,techChargePic:f,QAChargePic:m});n.httpPost(t.to(c),h,function(e){if(!e.success)return n.toast({content:e.message,closeDelay:3e3}),u=!0,!1;var r=3e3;n.toast({content:e.message,closeDelay:r}),setTimeout(function(){window.location.href=t.to("order/#index")},r)})})},e.gotoLoginEvent=function(){o("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e.checkAgreement=function(){o("#register .check-agreement").click(function(e){o(this).hasClass("checked-active")?o(this).removeClass("checked-active"):o(this).addClass("checked-active")}),o("#register .agreement-cls").click(function(e){o("#agreement-wrapper").remove();var t=o("#register"),n=o("script#agreement-template"),r=i.compile(n.html()),c=r({});t.append(c)}),o("#register").on("click",".agree-btn",function(e){o("#agreement-wrapper").remove();var t=o("#register .check-agreement");t.hasClass("checked-active")||t.addClass("checked-active")})},e});