1 |
- import{aP as c,A as y,aa as S,$ as w,G as _,d as C,aQ as I,V as v,a2 as T,aj as F,j as s,N as x,g as P,w as p,T as D,aR as k,z as r,aS as N}from"./index.e6d6174e.js";import{R as g,C as m}from"./index.83d3716a.js";import{I as V}from"./index.67c54471.js";import"./index.af99cf22.js";import{F as $}from"./index.17d70acf.js";function E(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[H,b]=y("count-down"),B={time:S(0),format:w("HH:mm:ss"),autoStart:_,millisecond:Boolean};var L=C({name:H,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(()=>E(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 J=x(L);const j="_imgCode_mywmt_1",q="_codeTitle_mywmt_4",A="_img_mywmt_1",O="_imgChange_mywmt_16",R="_field_mywmt_23",z="_imgCodePopup_mywmt_27";var o={imgCode:j,codeTitle:q,img:A,imgChange:O,field:R,imgCodePopup:z},K=C({name:"imgCode",props:{value:Boolean,phone:[String,Number],onClose:{type:Function,default:()=>{}},onSendCode:{type:Function,default:()=>{}}},data(){let e=window.location.origin,i=P.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(k,{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($,{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(V,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>s(N,{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{J as C,K as I};
|