SignUpAccount.ee09b502.js 5.0 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["SignUpAccount"],{"1b58":function(t,e,n){"use strict";var o=n("cf92"),a=n.n(o);a.a},"4d65":function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"signUpAccount"},[n("m-step"),n("div",{staticClass:"title"},[t._v("基本信息")]),n("van-field",{attrs:{type:"tel",maxlength:11,required:"",name:"phone",label:"手机号",placeholder:"请输入手机号"},model:{value:t.form.phone,callback:function(e){t.$set(t.form,"phone",e)},expression:"form.phone"}}),n("van-field",{attrs:{type:"number",maxlength:6,required:"",clearable:"",name:"code",label:"验证码",placeholder:"请输入验证码"},scopedSlots:t._u([{key:"button",fn:function(){return[n("span",{directives:[{name:"show",rawName:"v-show",value:t.countDownStatus,expression:"countDownStatus"}],staticClass:"codeText",on:{click:t.onGetCode}},[t._v("获取验证码")]),n("span",{directives:[{name:"show",rawName:"v-show",value:!t.countDownStatus,expression:"!countDownStatus"}],staticClass:"code-text"},[n("van-count-down",{ref:"countdown",staticStyle:{color:"#c4c4c4"},attrs:{"auto-start":!1,time:t.countDownTime,format:"ss秒"},on:{finish:t.onCountDownFinished}})],1)]},proxy:!0}]),model:{value:t.form.code,callback:function(e){t.$set(t.form,"code",e)},expression:"form.code"}}),n("div",{staticClass:"agreeProtocol"},[n("van-checkbox",{model:{value:t.agreeStatus,callback:function(e){t.agreeStatus=e},expression:"agreeStatus"}}),n("i",{staticStyle:{"font-style":"normal",color:"#999"},on:{click:function(e){t.agreeStatus=!t.agreeStatus}}},[t._v("已阅读并同意")]),n("span",{on:{click:t.onToProtocol}},[t._v("《酷乐秀用户注册服务协议》")])],1),n("van-button",{attrs:{type:"primary",disabled:!t.agreeStatus,round:"",block:""},on:{click:t.onSubmit}},[t._v("下一步")])],1)},a=[],r=n("a34a"),s=n.n(r),c=n("ab6b"),i=n("b48b"),u=n("3908"),h=n("8900");function l(t,e,n,o,a,r,s){try{var c=t[r](s),i=c.value}catch(u){return void n(u)}c.done?e(i):Promise.resolve(i).then(o,a)}function d(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var r=t.apply(e,n);function s(t){l(r,o,a,s,c,"next",t)}function c(t){l(r,o,a,s,c,"throw",t)}s(void 0)}))}}var p={name:"signUpAccount",components:{MStep:c["a"]},data:function(){localStorage.removeItem("Authorization");var t=localStorage.getItem("accountInfo");localStorage.removeItem("accountInfo");var e=this.$route.query;return{examId:e.examId,organId:e.organId,patternPhone:i["a"],agreeStatus:!1,form:t?JSON.parse(t):{phone:null,code:null},countDownStatus:!0,countDownTime:12e4}},mounted:function(){},methods:{onGetCode:function(){var t=d(s.a.mark((function t(){var e,n;return s.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(Object(u["a"])(!0),this.checkPhone(this.form.phone)){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,t.next=6,Object(h["o"])({mobile:this.form.phone});case 6:e=t.sent,n=e.data,200===n.code?(this.countDownStatus=!1,this.$refs.countdown.start(),Object(u["a"])(!1)):this.$toast(n.msg),t.next=14;break;case 11:t.prev=11,t.t0=t["catch"](3),Object(u["a"])(!1);case 14:case"end":return t.stop()}}),t,this,[[3,11]])})));function e(){return t.apply(this,arguments)}return e}(),onCountDownFinished:function(){this.countDownStatus=!0,this.$refs.countdown.reset()},onCheckPhone:function(){var t=d(s.a.mark((function t(){var e,n,o,a;return s.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return Object(u["a"])(!0),t.prev=1,e=this.form,n={mobile:e.phone,clientId:"student"},t.next=6,Object(h["m"])(n);case 6:o=t.sent,a=o.data,200===a.code?this.onLogin(a.data):this.$toast(a.msg),t.next=14;break;case 11:t.prev=11,t.t0=t["catch"](1),Object(u["a"])(!1);case 14:case"end":return t.stop()}}),t,this,[[1,11]])})));function e(){return t.apply(this,arguments)}return e}(),onLogin:function(){var t=d(s.a.mark((function t(e){var n,o,a,r,c;return s.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return n=this.form,o={clientId:"student",clientSecret:"student",phone:n.phone,smsCode:n.code,organId:this.organId},0===e&&(o.registerFlag="true"),t.next=5,Object(h["p"])(o);case 5:a=t.sent,r=a.data,200===r.code?(c=r.data.authentication,localStorage.setItem("Authorization",c.token_type+" "+c.access_token),this.$router.push({path:"/signUpBaseInfo",query:{organId:this.organId}})):this.$toast(r.msg);case 8:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}(),onSubmit:function(){var t=this.form;this.checkPhone(t.phone)&&(t.code?this.agreeStatus?this.onCheckPhone():this.$toast("请先阅读并同意《酷乐秀用户注册服务协议》"):this.$toast("请输入验证码"))},onToProtocol:function(){localStorage.setItem("accountInfo",JSON.stringify(this.form)),this.$router.push({path:"/smallProtocol"})},checkPhone:function(t){var e=!0;return this.patternPhone.test(t)||(this.$toast("手机号输入有误"),e=!1),e}},destroyed:function(){this.$toast.clear()}},f=p,m=(n("1b58"),n("2877")),v=Object(m["a"])(f,o,a,!1,null,"fe3a68e8",null);e["default"]=v.exports},cf92:function(t,e,n){}}]);