(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["AppRegister"],{"53bc":function(t,e,o){},"89b7":function(t,e,o){"use strict";var n=o("53bc"),s=o.n(n);s.a},f7df:function(t,e,o){"use strict";o.r(e);var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"login"},[t._m(0),o("div",{staticClass:"container"},[o("div",{staticClass:"input-group"},[o("input",{directives:[{name:"model",rawName:"v-model",value:t.phoneNumber,expression:"phoneNumber"}],staticClass:"input",attrs:{type:"number",placeholder:"请输入手机号",maxlength:"11",minlength:"11",pattern:"[0-9]"},domProps:{value:t.phoneNumber},on:{input:function(e){e.target.composing||(t.phoneNumber=e.target.value)}}})]),o("div",{staticClass:"input-group",staticStyle:{"margin-bottom":"0.05rem"}},[o("input",{directives:[{name:"model",rawName:"v-model",value:t.code,expression:"code"}],staticClass:"input",attrs:{type:"text",placeholder:"请输入验证码",minlength:"6",maxlength:"6"},domProps:{value:t.code},on:{input:function(e){e.target.composing||(t.code=e.target.value)}}}),o("span",{directives:[{name:"show",rawName:"v-show",value:t.countDownStatus,expression:"countDownStatus"}],staticClass:"code-text",on:{click:t.onSendCode}},[t._v(t._s(t.codeText))]),o("span",{directives:[{name:"show",rawName:"v-show",value:!t.countDownStatus,expression:"!countDownStatus"}],staticClass:"code-text"},[o("van-count-down",{ref:"countdown",attrs:{"auto-start":!1,time:t.countDownTime,format:"ss秒"},on:{finish:t.onFinished}})],1)]),o("div",{staticClass:"agreeProtocol"},[o("van-checkbox",{model:{value:t.agreeStatus,callback:function(e){t.agreeStatus=e},expression:"agreeStatus"}}),o("i",{staticStyle:{"font-style":"normal"},on:{click:function(e){t.agreeStatus=!t.agreeStatus}}},[t._v("阅读并同意")]),o("span",{on:{click:t.onToProtocol}},[t._v("《用户协议》")])],1),o("van-button",{attrs:{round:"",size:"large"},on:{click:t.onCodeLogin}},[t._v("注册并登录")]),o("span",{staticClass:"login-change",on:{click:t.onUrlLogin}},[t._v("登录")]),t.showImgCode?o("m-img-code",{attrs:{phone:t.phoneNumber},on:{onCodeSend:t.onCodeSend},model:{value:t.showImgCode,callback:function(e){t.showImgCode=e},expression:"showImgCode"}}):t._e()],1)])},s=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"logo"},[n("img",{attrs:{src:o("9d64"),alt:""}})])}],a=o("b562"),i=o("6354"),r={name:"login",components:{MImgCode:i["a"]},data:function(){var t=localStorage.getItem("getRegister");return t=t?JSON.parse(t):{},localStorage.removeItem("getRegister"),{groupId:this.$route.query.groupId,countDownStatus:!0,phoneNumber:t.phoneNumber?t.phoneNumber:null,isRegister:0,code:t.code?t.code:null,codeText:"获取验证码",countDownTime:12e4,isClick:!1,agreeStatus:!!t.agreeStatus&&t.agreeStatus,showImgCode:!1}},mounted:function(){localStorage.removeItem("userInfo"),localStorage.removeItem("Authorization")},methods:{codeBlur:function(){setTimeout(function(){var t=document.documentElement.scrollTop||document.body.scrollTop||0;window.scrollTo(0,Math.max(t-1,0))},100)},onToProtocol:function(){localStorage.setItem("getRegister",JSON.stringify({phoneNumber:this.phoneNumber,code:this.code,agreeStatus:this.agreeStatus})),this.$router.push({path:"/userProtocol",query:{groupId:this.groupId}})},onUrlLogin:function(){this.$router.push({path:"/appLogin",query:{groupId:this.groupId}})},onSendCode:function(){var t=this;this.checkPhone(this.phoneNumber)&&Object(a["k"])({mobile:this.phoneNumber}).then(function(e){var o=e.data;if(200==o.code){if(t.isRegister=o.data,1==o.data)return void t.$toast("用户已存在");t.showImgCode=!0}})},onCodeSend:function(){this.countDownStatus=!1,this.$refs.countdown.start()},onCodeLogin:function(){var t=this;this.phoneNumber?this.checkPhone(this.phoneNumber)&&(this.code?this.agreeStatus?this.isClick||(this.isClick=!0,Object(a["k"])({mobile:this.phoneNumber}).then(function(e){var o=e.data;if(200==o.code){if(t.isRegister=o.data,1==o.data)return t.$toast("用户已存在"),void(t.isClick=!1);t.onLogin()}})):this.$toast("请先阅读并同意用户协议"):this.$toast("请输入验证码")):this.$toast("请输入手机号")},onLogin:function(){var t=this,e={clientId:"student",clientSecret:"student",phone:this.phoneNumber,smsCode:this.code,channel:"H5",isLessee:"true"};Object(a["n"])(e).then(function(e){var o=e.data;if(t.isClick=!1,200==o.code){var n=o.data.authentication;localStorage.setItem("userInfo",n.token_type+" "+n.access_token),o.password?t.$router.push({path:"/classDetail",query:{groupId:t.groupId}}):t.$router.push({path:"/appSetInfo",query:{groupId:t.groupId}})}else t.$toast(o.msg)})},onFinished:function(){this.countDownStatus=!0,this.$refs.countdown.reset()},checkPhone:function(t){var e=!0;return/^1(3|4|5|6|7|8|9)\d{9}$/.test(t)||(this.$toast("手机号输入有误"),e=!1),e}}},c=r,u=(o("89b7"),o("2877")),d=Object(u["a"])(c,n,s,!1,null,"2c59d00c",null);e["default"]=d.exports}}]);