AppLogin.83c9d8f8.js 6.1 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["AppLogin"],{"657b":function(e,t,o){"use strict";var n=o("dd8c"),s=o.n(n);s.a},bb23:function(e,t,o){"use strict";o.r(t);var n=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"login"},[e._m(0),o("div",{directives:[{name:"show",rawName:"v-show",value:e.isTrue,expression:"isTrue"}],staticClass:"container"},[o("div",{staticClass:"input-group"},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.phoneNumber,expression:"phoneNumber"}],staticClass:"input",attrs:{type:"number",placeholder:"请输入手机号",maxlength:"11",minlength:"11",pattern:"[0-9]"},domProps:{value:e.phoneNumber},on:{keyup:function(t){return e.onKeyUp()},input:function(t){t.target.composing||(e.phoneNumber=t.target.value)}}})]),o("div",{staticClass:"input-group"},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.password,expression:"password"}],staticClass:"input",attrs:{type:"password",placeholder:"请输入密码"},domProps:{value:e.password},on:{keyup:function(t){return e.onKeyUp()},input:function(t){t.target.composing||(e.password=t.target.value)}}})]),o("van-button",{attrs:{round:"",size:"large",disabled:e.pwdDisable},on:{click:e.onLogin}},[e._v("登录")]),o("span",{staticClass:"login-change",on:{click:function(t){e.isTrue=!1}}},[e._v("验证码登录")]),o("span",{staticClass:"login-change",staticStyle:{float:"left"},on:{click:e.onRegister}},[e._v("立即注册")])],1),o("div",{directives:[{name:"show",rawName:"v-show",value:!e.isTrue,expression:"!isTrue"}],staticClass:"container"},[o("div",{staticClass:"input-group"},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.phoneNumber,expression:"phoneNumber"}],staticClass:"input",attrs:{type:"number",placeholder:"请输入手机号",maxlength:"11",minlength:"11",pattern:"[0-9]"},domProps:{value:e.phoneNumber},on:{keyup:function(t){return e.onKeyUp()},input:function(t){t.target.composing||(e.phoneNumber=t.target.value)}}})]),o("div",{staticClass:"input-group"},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.code,expression:"code"}],staticClass:"input",attrs:{type:"text",placeholder:"请输入验证码",minlength:"6",maxlength:"6"},domProps:{value:e.code},on:{keyup:function(t){return e.onKeyUp()},input:function(t){t.target.composing||(e.code=t.target.value)}}}),o("span",{directives:[{name:"show",rawName:"v-show",value:e.countDownStatus,expression:"countDownStatus"}],staticClass:"code-text",on:{click:e.onSendCode}},[e._v(e._s(e.codeText))]),o("span",{directives:[{name:"show",rawName:"v-show",value:!e.countDownStatus,expression:"!countDownStatus"}],staticClass:"code-text"},[o("van-count-down",{ref:"countdown",attrs:{"auto-start":!1,time:e.countDownTime,format:"ss秒"},on:{finish:e.onFinished}})],1)]),o("van-button",{attrs:{round:"",size:"large",disabled:e.codeDisable},on:{click:e.onCodeLogin}},[e._v("登录")]),o("span",{staticClass:"login-change",on:{click:function(t){e.isTrue=!0}}},[e._v("密码登录")]),o("span",{staticClass:"login-change",staticStyle:{float:"left"},on:{click:e.onRegister}},[e._v("立即注册")]),e.showImgCode?o("m-img-code",{attrs:{phone:e.phoneNumber},on:{onCodeSend:e.onCodeSend},model:{value:e.showImgCode,callback:function(t){e.showImgCode=t},expression:"showImgCode"}}):e._e()],1)])},s=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"logo"},[n("img",{attrs:{src:o("9d64"),alt:""}})])}],i=o("b562"),a=o("6354"),r={name:"login",components:{MImgCode:a["a"]},data:function(){return{groupId:this.$route.query.groupId,pwdDisable:!0,codeDisable:!0,isTrue:!0,countDownStatus:!0,phoneNumber:null,password:null,code:null,codeText:"获取验证码",countDownTime:12e4,isClick:!1,showImgCode:!1}},mounted:function(){localStorage.removeItem("userInfo"),localStorage.removeItem("Authorization")},methods:{onKeyUp:function(){this.isTrue?this.phoneNumber&&this.password?this.pwdDisable=!1:this.pwdDisable=!0:this.phoneNumber&&this.code?this.codeDisable=!1:this.codeDisable=!0},onRegister:function(){this.$router.push({path:"/appRegister",query:{groupId:this.groupId}})},onSendCode:function(){var e=this;this.checkPhone(this.phoneNumber)&&Object(i["k"])({mobile:this.phoneNumber}).then(function(t){var o=t.data;200==o.code?1==o.data?e.showImgCode=!0:e.$dialog.confirm({message:"此手机号尚未注册<br/>是否注册?",confirmButtonText:"注册"}).then(function(){e.$router.push({path:"/appRegister",query:{groupId:e.groupId}})}).catch(function(){}):e.$toast(o.msg)})},onCodeSend:function(){this.countDownStatus=!1,this.$refs.countdown.start()},onCodeLogin:function(){var e=this;if(!this.isClick){this.isClick=!0;var t={clientId:"student",clientSecret:"student",phone:this.phoneNumber,smsCode:this.code,channel:"H5"};Object(i["n"])(t).then(function(t){var o=t.data;if(e.isClick=!1,200==o.code){var n=o.data.authentication;localStorage.setItem("userInfo",n.token_type+" "+n.access_token),o.data.password?e.$router.push({path:"/classDetail",query:{groupId:e.groupId}}):e.$router.push({path:"/appSetInfo",query:{groupId:e.groupId}})}else 99==o.code?e.$dialog.confirm({message:"此手机号尚未注册<br/>是否注册?",confirmButtonText:"注册"}).then(function(){e.$router.push({path:"/appRegister",query:{groupId:e.groupId}})}).catch(function(){}):e.$toast(o.msg)})}},onLogin:function(){var e=this;this.isClick||(this.isClick=!0,Object(i["s"])({clientId:"student",clientSecret:"student",username:this.phoneNumber,password:this.password}).then(function(t){var o=t.data;if(e.isClick=!1,200==o.code){var n=o.data.authentication;localStorage.setItem("userInfo",n.token_type+" "+n.access_token),e.$router.push({path:"/classDetail",query:{groupId:e.groupId}})}else 99==o.code?e.$dialog.confirm({message:"此手机号尚未注册<br/>是否注册?",confirmButtonText:"注册"}).then(function(){e.$router.push({path:"/appRegister",query:{groupId:e.groupId}})}).catch(function(){}):e.$toast(o.msg)}))},onFinished:function(){this.countDownStatus=!0,this.$refs.countdown.reset()},checkPhone:function(e){var t=!0;return/^1(3|4|5|6|7|8|9)\d{9}$/.test(e)||(this.$toast("手机号输入有误"),t=!1),t}}},u=r,c=(o("657b"),o("2877")),p=Object(c["a"])(u,n,s,!1,null,"42f55cc5",null);t["default"]=p.exports},dd8c:function(e,t,o){}}]);