1 |
- import{ar as c,i as y,l as S,m as I,t as w,d as C,as as _,D as F,x as T,a8 as v,g as s,w as q,a as m,f as D,a3 as P,h as r,at as x}from"./index-bc617d61.js";import{R as g,C as h}from"./index-9ae54693.js";import{F as k}from"./index-2226937d.js";import{I as E}from"./index-e80a7d08.js";function L(e,o){const{days:n}=o;let{hours:t,minutes:a,seconds:d,milliseconds:l}=o;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,H]=y("count-down"),N={time:S(0),format:I("HH:mm:ss"),autoStart:w,millisecond:Boolean};var V=C({name:B,props:N,emits:["change","finish"],setup(e,{emit:o,slots:n}){const{start:t,pause:a,reset:d,current:l}=_({time:+e.time,millisecond:e.millisecond,onChange:f=>o("change",f),onFinish:()=>o("finish")}),u=F(()=>L(e.format,l.value)),p=()=>{d(+e.time),e.autoStart&&t()};return T(()=>e.time,p,{immediate:!0}),v({start:t,pause:a,reset:p}),()=>s("div",{role:"timer",class:H()},[n.default?n.default(l.value):u.value])}});const J=q(V),b="_imgCode_mq980_1",R="_codeTitle_mq980_4",A="_img_mq980_1",O="_imgChange_mq980_16",$="_field_mq980_23",G="_imgCodePopup_mq980_27",i={imgCode:b,codeTitle:R,img:A,imgChange:O,field:$,imgCodePopup:G},K=C({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"}},emits:["close","sendCode"],data(){return{isSuffix:"/edu-oauth",showStatus:!1,identifyingCode:null,code:""}},mounted(){this.showStatus=this.value,this.sendImgCode()},watch:{value(e){this.showStatus=e},code(e){e.length>=4&&this.checkVerifyLoginImage()}},methods:{async sendImgCode(){const{data:e}=await m.get(this.isSuffix+"/open/sendImgCode",{requestType:"form",hideLoading:!0,params:{phone:this.phone}});this.identifyingCode=e},async updateIdentifyingCode(){this.sendImgCode()},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await m.post("/edu-oauth/open/verifyImgCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await m.post("/edu-oauth/open/sendSms",{requestType:"form",hideLoading:!0,data:{clientId:"cooleshow-student",type:"REGISTER",mobile:this.phone}}),setTimeout(()=>{D("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(e){this.code="",this.updateIdentifyingCode()}}},render(){return s(P,{show:this.showStatus,class:i.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[s("div",{class:i.imgCode},[s("p",{class:i.codeTitle},[r("输入图形验证码")]),s(g,null,{default:()=>[s(h,{span:"14"},{default:()=>[s(k,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,class:i.field,autocomplete:"off"},null)]}),s(h,{span:"10",class:i.img},{default:()=>[s(E,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>s(x,{type:"spinner",size:"20"},null)})]})]}),s(g,{style:{display:"flex",justifyContent:"end"}},{default:()=>[s(h,{span:"10"},{default:()=>[s("span",{class:i.imgChange,onClick:()=>this.updateIdentifyingCode()},[r("看不清?换一换")])]})]})])]})}});export{J as C,K as I};
|