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