import{aQ as c,E as y,ab as S,a0 as w,H as _,d as C,aR as I,W as v,a3 as T,ak as F,i as s,O as x,s as k,e as p,T as D,A as r,aS as P,aT as E}from"./index.6b776f4b.js";import{R as g,C as m}from"./index.6bbd549f.js";import{I as H}from"./index.7cc0b0e7.js";import"./index.7486196c.js";import{F as N}from"./index.ef17e812.js";function V(e,i){const{days:n}=i;let{hours:t,minutes:a,seconds:d,milliseconds:l}=i;if(e.includes("DD")?e=e.replace("DD",c(n)):t+=n*24,e.includes("HH")?e=e.replace("HH",c(t)):a+=t*60,e.includes("mm")?e=e.replace("mm",c(a)):d+=a*60,e.includes("ss")?e=e.replace("ss",c(d)):l+=d*1e3,e.includes("S")){const u=c(l,3);e.includes("SSS")?e=e.replace("SSS",u):e.includes("SS")?e=e.replace("SS",u.slice(0,2)):e=e.replace("S",u.charAt(0))}return e}const[$,b]=y("count-down"),B={time:S(0),format:w("HH:mm:ss"),autoStart:_,millisecond:Boolean};var L=C({name:$,props:B,emits:["change","finish"],setup(e,{emit:i,slots:n}){const{start:t,pause:a,reset:d,current:l}=I({time:+e.time,millisecond:e.millisecond,onChange:f=>i("change",f),onFinish:()=>i("finish")}),u=v(()=>V(e.format,l.value)),h=()=>{d(+e.time),e.autoStart&&t()};return T(()=>e.time,h,{immediate:!0}),F({start:t,pause:a,reset:h}),()=>s("div",{role:"timer",class:b()},[n.default?n.default(l.value):u.value])}});const Z=x(L);const O="_imgCode_mywmt_1",q="_codeTitle_mywmt_4",A="_img_mywmt_1",R="_imgChange_mywmt_16",U="_field_mywmt_23",j="_imgCodePopup_mywmt_27";var o={imgCode:O,codeTitle:q,img:A,imgChange:R,field:U,imgCodePopup:j},J=C({name:"imgCode",props:{value:Boolean,phone:[String,Number],onClose:{type:Function,default:()=>{}},onSendCode:{type:Function,default:()=>{}}},data(){let e=window.location.origin,i=k.platformType==="STUDENT"?"/api-student":"/api-teacher";return{isSuffix:i,showStatus:!1,identifyingCode:e+i+"/code/getImageCode?phone="+this.phone,code:null}},mounted(){this.showStatus=this.value},watch:{value(e){this.showStatus=e},code(e){e.length>=4&&this.checkVerifyLoginImage()}},methods:{async updateIdentifyingCode(){let e=window.location.origin;this.identifyingCode=`${e}${this.isSuffix}/code/getImageCode?phone=${this.phone}&token=${Math.random()}`},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await p.post(`${this.isSuffix}/code/verifyImageCode`,{requestType:"form",data:{phone:this.phone,code:this.code}}),await p.post(`${this.isSuffix}/code/sendSmsCode`,{requestType:"form",data:{mobile:this.phone,type:"LOGIN"}}),D("\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001"),this.onClose(),this.onSendCode()}catch{this.updateIdentifyingCode()}}},render(){return s(E,{show:this.showStatus,class:o.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.onClose()},closeable:!0,closeIcon:"close"},{default:()=>[s("div",{class:o.imgCode},[s("p",{class:o.codeTitle},[r("\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801")]),s(g,null,{default:()=>[s(m,{span:"14"},{default:()=>[s(N,{placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,class:o.field},null)]}),s(m,{span:"10",class:o.img},{default:()=>[s(H,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>s(P,{type:"spinner",size:"20"},null)})]})]}),s(g,{style:{display:"flex",justifyContent:"end"}},{default:()=>[s(m,{span:"10"},{default:()=>[s("span",{class:o.imgChange,onClick:()=>this.updateIdentifyingCode()},[r("\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u6362")])]})]})])]})}});export{Z as C,J as I};