index.09138c22.js 2.3 KB

1
  1. import{d as l,g as i,n,q as u,c as e,P as c,t as d,L as m}from"./ResizeObserver.es.7b3c8c20.js";import{R as a,C as s}from"./index.a04f71cb.js";import{F as p}from"./index.a2714dbb.js";import{I as g}from"./index.725d7287.js";const h="_imgCode_mq980_1",f="_codeTitle_mq980_4",r="_img_mq980_1",C="_imgChange_mq980_16",y="_field_mq980_23",I="_imgCodePopup_mq980_27";var o={imgCode:h,codeTitle:f,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"},clientId:{type:String,default:""}},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 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:this.clientId||i.clientId[i.platformType]}}),setTimeout(()=>{u("\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001")},100),this.onClose(),this.onSendCode()}catch{this.updateIdentifyingCode()}}},render(){return e(c,{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(s,{span:"14"},{default:()=>[e(p,{placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:o.field,maxlength:4},null)]}),e(s,{span:"10",class:o.img},{default:()=>[e(g,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(m,{type:"spinner",size:"20"},null)})]})]}),e(a,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(s,{span:"10"},{default:()=>[e("span",{class:o.imgChange,onClick:()=>this.updateIdentifyingCode()},[d("\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u6362")])]})]})])]})}});export{F as I};