import{d as l,g as s,m as n,o as u,c as e,P as m,q as d,L as c}from"./index.8f93de0e.js";import{R as a,C as i}from"./index.823dc806.js";import{F as p}from"./index.9b99667f.js";import{I as f}from"./index.a2e558d4.js";const g="_imgCode_mq980_1",h="_codeTitle_mq980_4",r="_img_mq980_1",C="_imgChange_mq980_16",y="_field_mq980_23",I="_imgCodePopup_mq980_27";var o={imgCode:g,codeTitle:h,img:r,imgChange:C,field:y,imgCodePopup:I},F=l({name:"o-img-code",props:{value:Boolean,phone:[String,Number],onClose:{type:Function,default:()=>{}},onSendCode:{type:Function,default:()=>{}},type:{type:String,default:"LOGIN"}},data(){return{isSuffix:s.platformApi,showStatus:!1,identifyingCode:null,code:null}},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 n.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 n.post(`${this.isSuffix}/open/sendSmsVerify`,{requestType:"form",hideLoading:!0,data:{mobile:this.phone,type:this.type,code:this.code,clientId:s.clientId[s.platformType]}}),setTimeout(()=>{u("\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001")},100),this.onClose(),this.onSendCode()}catch{this.updateIdentifyingCode()}}},render(){return e(m,{show:this.showStatus,class:o.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.onClose()},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:o.imgCode},[e("p",{class:o.codeTitle},[d("\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801")]),e(a,null,{default:()=>[e(i,{span:"14"},{default:()=>[e(p,{placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:o.field},null)]}),e(i,{span:"10",class:o.img},{default:()=>[e(f,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(c,{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("\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u6362")])]})]})])]})}});export{F as I};
