1 |
- import{aS as u,j as f,am as S,n as w,v as y,d as r,b4 as _,E as I,w as v,g as s,an as F,D as P,a as D,f as T,P as b,h as g,a9 as k}from"./index-dbd58bee.js";import{R as p,C as m}from"./index-1c7ef11d.js";import{F as q}from"./index-e510518a.js";import{I as x}from"./index-56f13818.js";function L(e,o){const{days:n}=o;let{hours:i,minutes:a,seconds:d,milliseconds:l}=o;if(e.includes("DD")?e=e.replace("DD",u(n)):i+=n*24,e.includes("HH")?e=e.replace("HH",u(i)):a+=i*60,e.includes("mm")?e=e.replace("mm",u(a)):d+=a*60,e.includes("ss")?e=e.replace("ss",u(d)):l+=d*1e3,e.includes("S")){const c=u(l,3);e.includes("SSS")?e=e.replace("SSS",c):e.includes("SS")?e=e.replace("SS",c.slice(0,2)):e=e.replace("S",c.charAt(0))}return e}const[$,E]=f("count-down"),H={time:S(0),format:w("HH:mm:ss"),autoStart:y,millisecond:Boolean};var N=r({name:$,props:H,emits:["change","finish"],setup(e,{emit:o,slots:n}){const{start:i,pause:a,reset:d,current:l}=_({time:+e.time,millisecond:e.millisecond,onChange:C=>o("change",C),onFinish:()=>o("finish")}),c=I(()=>L(e.format,l.value)),h=()=>{d(+e.time),e.autoStart&&i()};return v(()=>e.time,h,{immediate:!0}),F({start:i,pause:a,reset:h}),()=>s("div",{role:"timer",class:E()},[n.default?n.default(l.value):c.value])}});const Z=P(N),V="_imgCode_mq980_1",B="_codeTitle_mq980_4",O="_img_mq980_1",j="_imgChange_mq980_16",A="_field_mq980_23",R="_imgCodePopup_mq980_27",t={imgCode:V,codeTitle:B,img:O,imgChange:j,field:A,imgCodePopup:R},J=r({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"}},emits:["close","sendCode"],data(){return{isSuffix:"/api-web",showStatus:!1,identifyingCode:window.location.origin+"/api-web/code/getLoginImage?phone="+this.phone,code:""}},mounted(){this.showStatus=this.value},watch:{value(e){this.showStatus=e},code(e){e.length>=4&&this.checkVerifyLoginImage()}},methods:{async updateIdentifyingCode(){const e=window.location.origin;this.identifyingCode=`${e}/api-web/code/getLoginImage?phone=${this.phone}&token=${Math.random()}`},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await D.post(`${this.isSuffix}/code/sendSmsCode`,{requestType:"form",hideLoading:!0,data:{mobile:this.phone,code:this.code}}),setTimeout(()=>{T("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(e){this.code="",this.updateIdentifyingCode()}}},render(){return s(b,{show:this.showStatus,class:t.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[s("div",{class:t.imgCode},[s("p",{class:t.codeTitle},[g("输入图形验证码")]),s(p,null,{default:()=>[s(m,{span:"14"},{default:()=>[s(q,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,class:t.field,autocomplete:"off",maxlength:4},null)]}),s(m,{span:"10",class:t.img},{default:()=>[s(x,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>s(k,{type:"spinner",size:"20"},null)})]})]}),s(p,{style:{display:"flex",justifyContent:"end"}},{default:()=>[s(m,{span:"10"},{default:()=>[s("span",{class:t.imgChange,onClick:()=>this.updateIdentifyingCode()},[g("看不清?换一换")])]})]})])]})}});export{Z as C,J as I};
|