var $url="/verifyMobile",$urlSendSms="/verifyMobile/actions/sendSms",data=utils.init({countdown:0,form:{mobile:null,code:null},returnUrl:utils.getQueryString("returnUrl")}),methods={apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url).then(function(i){var n=i.data;t.form.mobile=n.mobile}).catch(function(t){utils.notifyError(t)}).then(function(){utils.loading(t,!1)})},apiSendSms:function(){var t=this;utils.loading(this,!0),$api.post($urlSendSms,{mobile:this.form.mobile}).then(function(i){i.data;utils.notifySuccess("验证码发送成功，10分钟内有效"),t.countdown=60;var n=setInterval(function(){t.countdown-=1,t.countdown<=0&&clearInterval(n)},1e3)}).catch(function(t){utils.notifyError(t)}).then(function(){utils.loading(t,!1)})},apiSubmit:function(){var t=this;utils.loading(this,!0),$api.post($url,{mobile:this.form.mobile,code:this.form.code}).then(function(i){i.data;utils.alertSuccess({title:"手机号码验证成功",button:"确 定",callback:function(){t.returnUrl?location.href=t.returnUrl:t.redirectIndex()}})}).catch(function(t){utils.notifyError(t)}).then(function(){utils.loading(t,!1)})},redirectIndex:function(){location.href=utils.getIndexUrl()},isMobile:function(t){return/^1[3|4|5|7|8][0-9]\d{8}$/.test(t)},btnSendSmsClick:function(){this.countdown>0||(this.form.mobile?this.isMobile(this.form.mobile)?this.apiSendSms():utils.notifyError("请输入有效的手机号码"):utils.notifyError("手机号码不能为空"))},btnSubmitClick:function(){var t=this;this.$refs.form.validate(function(i){i&&t.apiSubmit()})}},$vue=new Vue({el:"#main",data:data,directives:{focus:{inserted:function(t){t.focus()}}},methods:methods,created:function(){this.apiGet()}});