import{d as l,g as i,m as s,o as u,c as e,P as p,q as a,L as m}from"./index.28bb778f.js";import{R as d,C as n}from"./index.d86b6c64.js";import{F as c}from"./index.5332ff88.js";import{I as h}from"./index.7e0a75cb.js";const f="_imgCode_mq980_1",g="_codeTitle_mq980_4",r="_img_mq980_1",C="_imgChange_mq980_16",y="_field_mq980_23",I="_imgCodePopup_mq980_27";var o={imgCode:f,codeTitle:g,img:r,imgChange:C,field:y,imgCodePopup:I},w=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:i.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 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(`${this.isSuffix}/open/verifyImgCode`,{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),console.log(i.clientId,i.platformType),await s.post(`${this.isSuffix}/open/sendSms`,{requestType:"form",hideLoading:!0,data:{mobile:this.phone,type:this.type,clientId:i.clientId[i.platformType]}}),setTimeout(()=>{u("\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001")},100),this.onClose(),this.onSendCode()}catch{this.updateIdentifyingCode()}}},render(){return e(p,{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},[a("\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801")]),e(d,null,{default:()=>[e(n,{span:"14"},{default:()=>[e(c,{placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:o.field},null)]}),e(n,{span:"10",class:o.img},{default:()=>[e(h,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(m,{type:"spinner",size:"20"},null)})]})]}),e(d,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(n,{span:"10"},{default:()=>[e("span",{class:o.imgChange,onClick:()=>this.updateIdentifyingCode()},[a("\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u6362")])]})]})])]})}});export{w as I};
