MobileForm-b978db90.js 4.9 KB

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