import{d as n,D as o,N as l,a as e,U as u,A as d,L as c}from"./index-7945cc5d.js";import{R as a,C as s}from"./index-093c0b98.js";import{F as p}from"./index-2aaf853c.js";import{I as h}from"./index-610eeac6.js";const m="_imgCode_14iw3_1",g="_codeTitle_14iw3_4",f="_img_14iw3_1",r="_imgChange_14iw3_16",C="_field_14iw3_23",y="_imgCodePopup_14iw3_27",i={imgCode:m,codeTitle:g,img:f,imgChange:r,field:C,imgCodePopup:y},F=n({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"},clientId:{type:String,default:"cooleshow-student"},zIndex:{type:Number,default:2001},showTips:{type:Boolean,default:!0}},emits:["close","sendCode"],data(){return{isSuffix:"/edu-app",showStatus:!1,identifyingCode:null,code:""}},mounted(){this.showStatus=this.value,this.sendImgCode()},watch:{value(t){this.showStatus=t},async code(t){t.length>=4&&await this.checkVerifyLoginImage()}},methods:{async sendImgCode(){const{data:t}=await o.get(this.isSuffix+"/open/sendImgCode",{requestType:"form",hideLoading:!0,params:{phone:this.phone}});this.identifyingCode=t},async updateIdentifyingCode(){this.sendImgCode()},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await o.post("/edu-app/open/sendSmsVerify",{requestType:"form",hideLoading:!0,data:{code:this.code,clientId:this.clientId,type:this.type,mobile:this.phone}}),setTimeout(()=>{this.showTips&&l("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(t){this.code="",setTimeout(()=>{this.updateIdentifyingCode()},2e3)}}},render(){return e(u,{show:this.showStatus,zIndex:this.zIndex,class:i.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:i.imgCode},[e("p",{class:i.codeTitle},[d("输入图形验证码")]),e(a,null,{default:()=>[e(s,{span:"14"},{default:()=>[e(p,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:i.field,autocomplete:"off",maxlength:4},null)]}),e(s,{span:"10",class:i.img},{default:()=>[e(h,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(c,{type:"spinner",size:"20"},null)})]})]}),e(a,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(s,{span:"10"},{default:()=>[e("span",{class:i.imgChange,onClick:()=>this.updateIdentifyingCode()},[d("看不清？换一换")])]})]})])]})}});export{F as M};
