2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
import{r as e,s as a,b1 as l,o as t,c as u,w as n,aG as s,b as o,e as r,aH as v,y as c,h as p,k as _,x as d,i}from"./index-CH9-aFWw.js";/* empty css */import{_ as g}from"./_plugin-vue_export-helper.BCo6x5W8.js";const f=g({__name:"getCode",props:{event:{type:String,default:"register"},count:{type:Number,default:60},phone:{type:String,default:""}},setup(g){const f=g,h=e(60),m=e(null),y=e(1);function x(){return f.phone?2==y.value?(p.alert("请稍后获取验证码"),!1):(y.value=2,m.value=setInterval((()=>{h.value>0?h.value--:(y.value=3,h.value=f.count,clearInterval(m.value))}),1e3),void _.login.getCaptcha({query:[f.phone,f.event],path:[f.phone,f.event]}).then((e=>{console.log(e),200==e.code?p.alert("验证码已发送"):(p.alert(e.msg),y.value=3,clearInterval(m.value))}))):(p.alert("手机号不正确"),!1)}return a((()=>{h.value=f.count})),l((()=>{y.value=1,clearInterval(m.value)})),(e,a)=>{const l=d,p=i;return t(),u(p,{class:"getCode",onClick:x},{default:n((()=>[s(o(l,null,{default:n((()=>[r("发送")])),_:1},512),[[v,1==y.value]]),s(o(l,null,{default:n((()=>[r("("+c(h.value)+"s)",1)])),_:1},512),[[v,2==y.value]]),s(o(l,null,{default:n((()=>[r("重新发送")])),_:1},512),[[v,3==y.value]])])),_:1})}}},[["__scopeId","data-v-39ce6ce9"]]);export{f as g};
|