index-0ead74db.js 2.3 KB

1
  1. import{d as n,D as s,N as l,a as e,R as u,A as d,L as c}from"./index-0f430fcc.js";import{R as a,C as o}from"./index-cc542b8c.js";import{F as m}from"./index-42a305c0.js";import{I as p}from"./index-15acf057.js";const h="_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:h,codeTitle:g,img:f,imgChange:r,field:C,imgCodePopup:y},S=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}},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 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/sendSmsVerify",{requestType:"form",hideLoading:!0,data:{code:this.code,clientId:this.clientId,type:this.type,mobile:this.phone}}),setTimeout(()=>{l("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(t){this.code="",setTimeout(()=>{this.updateIdentifyingCode()},500)}}},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(o,{span:"14"},{default:()=>[e(m,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:i.field,autocomplete:"off",maxlength:4},null)]}),e(o,{span:"10",class:i.img},{default:()=>[e(p,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(c,{type:"spinner",size:"20"},null)})]})]}),e(a,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(o,{span:"10"},{default:()=>[e("span",{class:i.imgChange,onClick:()=>this.updateIdentifyingCode()},[d("看不清?换一换")])]})]})])]})}});export{S as M};