24.9e997ffb79b26dbc6327.js 3.1 KB

1
  1. webpackJsonp([24],{"g+s1":function(e,i){},uavL:function(e,i,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=n("SQ4B"),t=n("vGYV"),r=n("qI5z"),a={name:"BindingMobile",data:function(){return{phoneBindingForm:{phone:"",verifyCode:""},loading:!1,hasVerifyCode:!1,codeTime:60,user:{},rules:{verifyCode:[{required:!0,message:"请输入验证码",trigger:"blur"},{min:6,max:6,message:"验证码长度为6个字符",trigger:"blur"}],phone:[{required:!0,message:"请输入手机号",trigger:"blur"},{min:11,max:11,message:"手机号不合法",trigger:"blur"}]}}},methods:{setUserInfo:function(){var e=this,i=Object(t.I)("user")&&Object(t.I)("user").userVO.id;o.a.get("/api/user/"+i).then(function(i){e.user=i.userVO})},getVerifyCode:function(){var e=this,i={id:this.user.id,mobile:this.phoneBindingForm.phone};o.a.put("/api/verify/mobile",i).then(function(i){if("ERROR"==i.msg)Object(r.a)("error",i.data);else{Object(r.a)("success",i.data),e.hasVerifyCode=!0;var n=e,o=setInterval(function(){n.codeTime>0?n.codeTime--:(clearInterval(o),n.hasVerifyCode=!1,this.codeTime=10)},1e3)}}).catch(function(e){Object(r.a)("error","绑定手机失败:"+e.data)})},bindingMobile:function(){var e=this,i={id:this.user.id,mobile:this.phoneBindingForm.phone,verifyCode:this.phoneBindingForm.verifyCode};o.a.put("/api/user/mobile",i).then(function(i){"ERROR"==i.msg?(Object(r.a)("error","绑定失败:"+i.data),e.active=1,e.phoneBindingForm.phone="",e.phoneBindingForm.verifyCode="",e.codeTime=60,e.hasVerifyCode=!1):(Object(r.a)("success","绑定成功"),e.$router.push({path:"/personal/phoneBinding"}))}).catch(function(e){Object(r.a)("error",e.data)})},showLoading:function(){this.loading=!0},hideLoading:function(){this.loading=!1}},mounted:function(){this.setUserInfo()}},s={render:function(){var e=this,i=e.$createElement,n=e._self._c||i;return n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{"margin-top":"20px"}},[n("el-form",{staticStyle:{width:"400px"},attrs:{"label-width":"80px",rules:e.rules,model:e.phoneBindingForm}},[n("el-form-item",{attrs:{label:"手机号码",prop:"phone"}},[n("el-input",{model:{value:e.phoneBindingForm.phone,callback:function(i){e.$set(e.phoneBindingForm,"phone",i)},expression:"phoneBindingForm.phone"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"验证码",prop:"verifyCode"}},[n("el-input",{staticClass:"input-with-select",attrs:{placeholder:"验证码内容"},model:{value:e.phoneBindingForm.verifyCode,callback:function(i){e.$set(e.phoneBindingForm,"verifyCode",i)},expression:"phoneBindingForm.verifyCode"}},[n("el-button",{attrs:{slot:"append",disabled:e.hasVerifyCode},on:{click:e.getVerifyCode},slot:"append"},[e._v(e._s(e.hasVerifyCode?e.codeTime:"获取验证码")+"\n ")])],1),e._v(" "),e.hasVerifyCode?n("span",[e._v("验证码已发送到您手机上")]):e._e()],1),e._v(" "),n("el-form-item",[n("el-button",{attrs:{type:"primary",plain:""},on:{click:e.bindingMobile}},[e._v("完成绑定")])],1)],1)],1)},staticRenderFns:[]};var d=n("VU/8")(a,s,!1,function(e){n("g+s1")},"data-v-82f16388",null);i.default=d.exports}});