| 1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0d5c2a"],{7050:function(t,e,s){"use strict";s.r(e);var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"cl-sms-btn"},[t._t("reference",(function(){return[e("el-button",{attrs:{size:"small"},on:{click:t.openForm}},[t._v(t._s(t.count==t.count2?"获取验证码":t.count2+"s后重试"))])]})),e("x-form",{ref:"x-form"})],2)},n=[],c={props:{count:{type:Number,default:60}},data(){const t=this.count;return{timer:null,svg:"",captchaId:"",loading:!1,count2:t}},methods:{async getCaptcha(){this.loading=!0;const{data:t,captchaId:e}=await this.$service.common.captcha({height:40,width:120});this.svg=t,this.captchaId=e,this.loading=!1},async openForm(){this.$createElement;if(this.count2!=this.count)return!1;let t=this;this.$refs["x-form"].open({props:{title:"图片验证码",width:"400px"},items:[{prop:"code",component:{name:"image-code",data(){return{code:""}},mounted(){t.getCaptcha()},watch:{code(t){this.$emit("input",t)}},render(){const e=arguments[0];return e("el-row",{attrs:{type:"flex"},directives:[{name:"loading",value:t.loading}]},[e("el-input",{attrs:{maxlength:"4"},style:{width:"240px"},model:{value:this.code,callback:t=>{this.code=t}}}),e("div",{class:"svg",on:{click:t.getCaptcha},style:{height:"30px",width:"120px",position:"relative",top:"-10px"},domProps:{innerHTML:t.svg}})])}},rules:[{required:!0,message:"图片验证码不能为空"},{min:4,max:4,message:"图片验证码为4个字符",trigger:"blur"}]}],on:{submit:(t,e)=>{this.$message.success("发送短信验证码成功"),e(),this.send(),this.$emit("success",this.captchaId)}}})},send(){this.count2=this.count-1,this.timer=setInterval(()=>{this.count2-=1,this.count2<=0&&(this.count2=this.count,clearInterval(this.timer))},1e3)}}},a=c,o=s("1805"),r=Object(o["a"])(a,i,n,!1,null,null,null);e["default"]=r.exports}}]);
|