import{d as R,r as m,u as w,bz as B,a as E,b as M,e as A,f as z,c as U,o as k,w as e,j as o,_ as q,k as L,N as O,l as C,bA as D,m as G,B as V,p as x,h as K,D as P,A as j,bB as T,R as F,t as H,v as J}from"./index-9PRMimni.js";const Q={key:0},W=R({__name:"MobileLogin",emits:["goRegister"],setup(X){const g=m(),a=w(),f=m(!1),l=m("获取验证码"),u=m(!1),N=B.BASE_LOGIN_NAME,t=E({mobile:"",code:""}),S={mobile:{required:!0,message:"手机号码不能为空",trigger:"blur"},code:{required:!0,message:"验证码不能为空",trigger:"blur"}},h=M(),v=A(),b=z(),y=i=>{i.preventDefault(),g.value.validate(async s=>{if(s)a.error("请填写完整信息，并且进行验证码校验");else{const{mobile:c,code:d}=t;a.loading("登录中..."),f.value=!0;const n={mobile:c,code:d};try{const{code:_,message:p}=await h.login(n);if(a.destroyAll(),_==F.SUCCESS){const r=decodeURIComponent(b.query?.redirect||"/");a.success("登录成功，即将进入系统"),b.name===N?v.replace("/"):v.replace(r)}else a.info(p||"登录失败")}finally{f.value=!1}}})};function I(){if(!t.mobile)return a.error("手机号码不能为空");l.value=60,u.value=!0;let i=setInterval(()=>{l.value--,l.value<=0&&(clearInterval(i),l.value="获取验证码",u.value=!1)},1e3)}return(i,s)=>{const c=O,d=L,n=q,_=V,p=H;return k(),U(p,{ref_key:"formRef",ref:g,"show-label":!1,"show-require-mark":!1,size:"large",model:t,rules:S,class:"plus-login-form"},{default:e(()=>[o(n,{path:"mobile"},{default:e(()=>[o(d,{value:t.mobile,"onUpdate:value":s[0]||(s[0]=r=>t.mobile=r),placeholder:"输入手机号码",class:"rounded-lg"},{prefix:e(()=>[o(c,{size:"18",color:"#808695"},{default:e(()=>[o(C(D))]),_:1})]),_:1},8,["value"])]),_:1}),o(n,{path:"code"},{default:e(()=>[o(d,{value:t.code,"onUpdate:value":s[1]||(s[1]=r=>t.code=r),placeholder:"输入验证码",onKeyup:G(y,["enter"]),class:"rounded-lg"},{prefix:e(()=>[o(c,{size:"18",color:"#808695"},{default:e(()=>[o(C(T))]),_:1})]),suffix:e(()=>[o(_,{text:"",type:"primary",disabled:u.value,onClick:I},{default:e(()=>[x(j(l.value),1),u.value?(k(),K("span",Q,"s")):P("",!0)]),_:1},8,["disabled"])]),_:1},8,["value"])]),_:1}),o(n,{"show-label":!1},{default:e(()=>[o(_,{type:"primary",onClick:y,size:"large",loading:f.value,block:"",class:"rounded-lg"},{default:e(()=>s[2]||(s[2]=[x(" 登录 ")])),_:1},8,["loading"])]),_:1})]),_:1},8,["model"])}}}),Z=J(W,[["__scopeId","data-v-37095613"]]);export{Z as default};
