index.8f3e80f5.js 2.3 KB

1
  1. import{d as l,g as u,y as c,T as p,j as e,aT as g,A as a,B as n,aU as h}from"./ResizeObserver.es.62ab429c.js";import{R as d,C as i}from"./index.5a30932c.js";import{I as r}from"./index.021584f9.js";import"./index.d7a13e47.js";import{F as m}from"./index.82be4917.js";const f="_imgCode_w5vq4_1",C="_codeTitle_w5vq4_4",y="_img_w5vq4_1",_="_imgChange_w5vq4_16",w="_field_w5vq4_23",I="_imgCodePopup_w5vq4_27";var o={imgCode:f,codeTitle:C,img:y,imgChange:_,field:w,imgCodePopup:I},x=l({name:"imgCode",props:{value:Boolean,phone:[String,Number],onClose:{type:Function,default:()=>{}},registerType:{type:String,default:"LOGIN"},onSendCode:{type:Function,default:()=>{}}},data(){const t=a(),s=u.platformType==="STUDENT"?"/api-student":"/api-teacher";return{isSuffix:s,showStatus:!1,identifyingCode:t+s+"/code/getImageCode?phone="+this.phone,code:null}},mounted(){this.showStatus=this.value},watch:{value(t){this.showStatus=t},code(t){t.length>=4&&this.checkVerifyLoginImage()}},methods:{async updateIdentifyingCode(){const t=a();this.identifyingCode=`${t}${this.isSuffix}/code/getImageCode?phone=${this.phone}&token=${Math.random()}`},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await c.post(`${this.isSuffix}/code/sendSmsCode`,{requestType:"form",data:{mobile:this.phone,type:this.registerType,code:this.code}}),p("\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001"),this.onClose(),this.onSendCode()}catch{this.updateIdentifyingCode()}}},render(){return e(g,{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},[n("\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801")]),e(d,null,{default:()=>[e(i,{span:"14"},{default:()=>[e(m,{placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:o.field,maxlength:"4",autocomplete:"off"},null)]}),e(i,{span:"10",class:o.img},{default:()=>[e(r,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(h,{type:"spinner",size:"20"},null)})]})]}),e(d,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(i,{span:"10"},{default:()=>[e("span",{class:o.imgChange,onClick:()=>this.updateIdentifyingCode()},[n("\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u6362")])]})]})])]})}});export{x as I};