import{d as J,v as O,u as T,r as g,ad as W,a as e,A as N,w as G,P as K,ae as X,o as f,g as w,B as l,k as a,h,c as S,D as C,J as Y,Q as Z,aQ as $,aq as ee,ar as ae,aj as V,aR as le,ag as oe,S as te,am as ne,a7 as ie,ap as se,W as de,H as re}from"./index-BP6bNRoi.js";import{_ as me}from"./XButton-BfzTlH8o.js";import{u as y}from"./useIcon-DZqEaX5R.js";import{u as pe,L as ue,_ as ce,a as ge}from"./LoginFormTitle.vue_vue_type_script_setup_true_lang-BdHKqTBo.js";import{r as _}from"./formRules-9V-NAySD.js";const fe={key:1,class:"getMobileCode",style:{cursor:"pointer"}},be=re(J({name:"MobileForm",__name:"MobileForm",setup(he){const{t:i}=Y(),I=Z(),L=O(),{currentRoute:M,push:E}=T(),x=g(),u=g(!1),P=y({icon:"ep:house"}),B=y({icon:"ep:cellphone"}),Q=y({icon:"ep:circle-check"}),{validForm:R}=ge(x),{handleBackLogin:U,getLoginState:j}=pe(),q=W(()=>e(j)===ue.MOBILE),z={tenantName:[_],mobileNumber:[_],code:[_]},o=N({codeImg:"",tenantEnable:"true",token:"",loading:{signIn:!1},loginForm:{uuid:"",tenantName:"iailab",mobileNumber:"",code:""}}),p=N({smsCode:{mobile:"",scene:21},loginSms:{mobile:"",code:""}}),s=g(0),c=g(""),A=async()=>{await v(),p.smsCode.mobile=o.loginForm.mobileNumber,await $(p.smsCode).then(async()=>{I.success(i("login.SmsSendMsg")),s.value=60;let n=setInterval(()=>{s.value=s.value-1,s.value<=0&&clearInterval(n)},1e3)})};G(()=>M.value,n=>{var t;c.value=(t=n==null?void 0:n.query)==null?void 0:t.redirect},{immediate:!0});const v=async()=>{if(o.tenantEnable==="true"){const n=await ee(o.loginForm.tenantName);ae(n)}};return(n,t)=>{const m=te,d=ne,b=ie,k=se,F=me,D=de;return K((f(),w(D,{ref_key:"formSmsLogin",ref:x,model:e(o).loginForm,rules:z,class:"login-form","label-position":"top","label-width":"120px",size:"large"},{default:l(()=>[a(k,{style:{"margin-right":"-10px","margin-left":"-10px"}},{default:l(()=>[a(d,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:l(()=>[a(m,null,{default:l(()=>[a(ce,{style:{width:"100%"}})]),_:1})]),_:1}),a(d,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:l(()=>[e(o).tenantEnable==="true"?(f(),w(m,{key:0,prop:"tenantName"},{default:l(()=>[a(b,{modelValue:e(o).loginForm.tenantName,"onUpdate:modelValue":t[0]||(t[0]=r=>e(o).loginForm.tenantName=r),placeholder:e(i)("login.tenantNamePlaceholder"),"prefix-icon":e(P),type:"primary",link:""},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})):h("",!0)]),_:1}),a(d,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:l(()=>[a(m,{prop:"mobileNumber"},{default:l(()=>[a(b,{modelValue:e(o).loginForm.mobileNumber,"onUpdate:modelValue":t[1]||(t[1]=r=>e(o).loginForm.mobileNumber=r),placeholder:e(i)("login.mobileNumberPlaceholder"),"prefix-icon":e(B)},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),a(d,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:l(()=>[a(m,{prop:"code"},{default:l(()=>[a(k,{gutter:5,justify:"space-between",style:{width:"100%"}},{default:l(()=>[a(d,{span:24},{default:l(()=>[a(b,{modelValue:e(o).loginForm.code,"onUpdate:modelValue":t[2]||(t[2]=r=>e(o).loginForm.code=r),placeholder:e(i)("login.codePlaceholder"),"prefix-icon":e(Q)},{append:l(()=>[e(s)<=0?(f(),S("span",{key:0,class:"getMobileCode",style:{cursor:"pointer"},onClick:A},C(e(i)("login.getSmsCode")),1)):h("",!0),e(s)>0?(f(),S("span",fe,C(e(s))+"\u79D2\u540E\u53EF\u91CD\u65B0\u83B7\u53D6 ",1)):h("",!0)]),_:1},8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1})]),_:1})]),_:1}),a(d,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:l(()=>[a(m,null,{default:l(()=>[a(F,{loading:e(u),title:e(i)("login.login"),class:"w-[100%]",type:"primary",onClick:t[3]||(t[3]=r=>(async()=>{await v(),await R()&&(V.service({lock:!0,text:"\u6B63\u5728\u52A0\u8F7D\u7CFB\u7EDF\u4E2D...",background:"rgba(0, 0, 0, 0.7)"}),u.value=!0,p.loginSms.mobile=o.loginForm.mobileNumber,p.loginSms.code=o.loginForm.code,await le(p.loginSms).then(async H=>{oe(H),c.value||(c.value="/"),E({path:c.value||L.addRouters[0].path})}).catch(()=>{}).finally(()=>{u.value=!1,setTimeout(()=>{V.service().close()},400)}))})())},null,8,["loading","title"])]),_:1})]),_:1}),a(d,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:l(()=>[a(m,null,{default:l(()=>[a(F,{loading:e(u),title:e(i)("login.backLogin"),class:"w-[100%]",onClick:t[4]||(t[4]=r=>e(U)())},null,8,["loading","title"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])),[[X,e(q)]])}}}),[["__scopeId","data-v-623ad3b7"]]);export{be as default};
|