webpackJsonp([32],{sOJs:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=s("FevL"),o=s("AAHV"),a=s("2vqF"),n=s("P5P/");i.default.component(o.Button.name,o.Button),i.default.component(a.Popup.name,a.Popup);var r={data:()=>({user:{},showDialog:!1,imgCode:"",captchaImg:"",tips:"获取验证码",btnDisable:!1,userInfo:{}}),created(){this.changeCaptcha(),this.getView()},methods:{getView(){this.userInfo=JSON.parse(localStorage.getItem("userInfo")),this.$axios.post(this.api.userInfo,{attr:{token:this.$store.getters.getToken}}).then(t=>{t&&(this.user=t.data)}),error(t=>{})},getVerify(){if(this.user.phone)if(this.imgCode){var t={phone:this.user.phone,verify:this.imgCode,type:"SMS_1"};this.$axios.post(this.api.verifyCode,t,{withCredentials:!0}).then(t=>{if(1==t.data.code){this.$dialog.toast({mes:"验证码已发送",timeout:1e3}),this.showDialog=!1;var e=60,s=this;this.btnDisable=!0;var i=setInterval(function(){s.tips=e+"秒后重新获取",--e<=0&&(clearInterval(i),s.tips="重新获取验证码",s.btnDisable=!1)},1e3)}else this.$dialog.toast({mes:"出了点小问题，请重试",timeout:1e3})})}else this.$dialog.toast({mes:"请输入验证码",timeout:1e3});else this.$dialog.toast({mes:"请输入手机号",timeout:1e3})},changeCaptcha(){this.captchaImg=this.api.captcha+"?v="+Math.random()},submit(){this.user.phone?this.user.code?(this.user.token=Object(n.a)("token"),this.$axios.post(this.api.bindPhone,{attr:this.user}).then(t=>{if(1==t.data.code){this.$dialog.toast({mes:"绑定成功",timeout:1e3}),this.userInfo.phone=this.user.phone;var e=this.userInfo;localStorage.setItem("userInfo",JSON.stringify(e)),this.$router.push("/user/safe")}else this.$dialog.toast({mes:"绑定失败，请重试",timeout:1e3})})):this.$dialog.toast({mes:"请输入验证码",timeout:1e3}):this.$dialog.toast({mes:"请输入手机号",timeout:1e3})},unbind(){this.user.phone?this.$axios.post(this.api.unbindPhone,{attr:{phone:this.user.phone}}).then(t=>{if(1==t.data.code){this.$dialog.toast({mes:"解绑成功",timeout:1e3}),this.userInfo.phone="";var e=this.userInfo;localStorage.setItem("userInfo",JSON.stringify(e)),this.$router.push("/user/safe")}else this.$dialog.toast({mes:t.data.msg,timeout:1e3})}):this.$dialog.toast({mes:"请输入手机号",timeout:1e3})}}},u={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("v-title",{attrs:{title:t.userInfo.phone?"解绑":"绑定"}}),t._v(" "),t.userInfo.phone?s("div",{staticClass:"login-form"},[s("div",{staticClass:"group"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.user.phone,expression:"user.phone"}],staticClass:"form-text",attrs:{type:"text",placeholder:"请输入手机号"},domProps:{value:t.user.phone},on:{input:function(e){e.target.composing||t.$set(t.user,"phone",e.target.value)}}})]),t._v(" "),s("div",{staticClass:"btn"},[s("yd-button",{attrs:{type:"danger",size:"large"},nativeOn:{click:function(e){t.unbind()}}},[t._v("解绑")])],1)]):s("div",{staticClass:"login-form"},[s("div",{staticClass:"group"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.user.phone,expression:"user.phone"}],staticClass:"form-text",attrs:{type:"text",placeholder:"请输入手机号"},domProps:{value:t.user.phone},on:{input:function(e){e.target.composing||t.$set(t.user,"phone",e.target.value)}}})]),t._v(" "),s("div",{staticClass:"group"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.user.code,expression:"user.code"}],staticClass:"form-text",attrs:{type:"password",placeholder:"请输入验证码"},domProps:{value:t.user.code},on:{input:function(e){e.target.composing||t.$set(t.user,"code",e.target.value)}}}),t._v(" "),s("button",{attrs:{type:"button",disabled:t.btnDisable},on:{click:function(e){t.showDialog=!0}}},[t._v(t._s(t.tips))])]),t._v(" "),s("div",{staticClass:"btn"},[s("yd-button",{attrs:{type:"danger",size:"large"},nativeOn:{click:function(e){t.submit()}}},[t._v("确定")])],1)]),t._v(" "),s("yd-popup",{attrs:{position:"center",width:"90%"},model:{value:t.showDialog,callback:function(e){t.showDialog=e},expression:"showDialog"}},[s("div",{staticClass:"imgCodePop"},[s("p",[s("input",{directives:[{name:"model",rawName:"v-model",value:t.imgCode,expression:"imgCode"}],attrs:{type:"text",placeholder:"请输入图片验证码"},domProps:{value:t.imgCode},on:{input:function(e){e.target.composing||(t.imgCode=e.target.value)}}}),t._v(" "),s("img",{attrs:{src:t.captchaImg},on:{click:t.changeCaptcha}})]),t._v(" "),s("p",[s("yd-button",{attrs:{type:"danger"},nativeOn:{click:function(e){t.getVerify()}}},[t._v("确定")])],1)])])],1)},staticRenderFns:[]};var l=s("D8HT")(r,u,!1,function(t){s("usi+")},"data-v-609919f1",null);e.default=l.exports},"usi+":function(t,e){}});