index-9a28eb74.js 2.3 KB

1
  1. import{d as n,D as s,E as u,a as e,Q as l,A as d,L as m}from"./index-521a9826.js";import{R as a,C as i}from"./index-163db0a7.js";import{F as p}from"./index-e6f760ef.js";import{I as c}from"./index-25b5c9d0.js";const h="_imgCode_mq980_1",g="_codeTitle_mq980_4",r="_img_mq980_1",f="_imgChange_mq980_16",C="_field_mq980_23",y="_imgCodePopup_mq980_27",o={imgCode:h,codeTitle:g,img:r,imgChange:f,field:C,imgCodePopup:y},q=n({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"},clientId:{type:String,default:"cooleshow-student"}},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},code(t){t.length>=4&&this.checkVerifyLoginImage()}},methods:{async sendImgCode(){const{data:t}=await s.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 s.post("/edu-app/open/verifyImgCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await s.post("/edu-app/open/sendSms",{requestType:"form",hideLoading:!0,data:{clientId:this.clientId,type:this.type,mobile:this.phone}}),setTimeout(()=>{u("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(t){this.code="",setTimeout(()=>{this.updateIdentifyingCode()},500)}}},render(){return e(l,{show:this.showStatus,class:o.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:o.imgCode},[e("p",{class:o.codeTitle},[d("输入图形验证码")]),e(a,null,{default:()=>[e(i,{span:"14"},{default:()=>[e(p,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:o.field,autocomplete:"off"},null)]}),e(i,{span:"10",class:o.img},{default:()=>[e(c,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(m,{type:"spinner",size:"20"},null)})]})]}),e(a,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(i,{span:"10"},{default:()=>[e("span",{class:o.imgChange,onClick:()=>this.updateIdentifyingCode()},[d("看不清?换一换")])]})]})])]})}});export{q as M};