LoginForm-37509a4a.js 5.6 KB

1
  1. import{d as H,r as m,u as Q,af as X,e as J,a as e,x as W,w as Y,b as Z,k as $,v as aa,o as V,C as N,A as o,f as l,a2 as ea,a4 as ta,D as k,E as L,P as la,ah as oa,ca as ra,aq as P,ak as na,al as sa,am as ia,an as pa,ab as ma,U as da,H as ua,a8 as ca,ao as ga,K as fa,V as _a,L as ha,M as ya,B as wa,ap as xa,__tla as ba}from"./index-c503e084.js";import{_ as Fa,__tla as va}from"./Verify-65ef8e58.js";import{_ as Va,__tla as Na}from"./XButton-45ab19b2.js";import{E as ka,__tla as La}from"./el-link-0fc54ed2.js";import{u as f,__tla as Pa}from"./useIcon-9195ef28.js";import{u as Ea,L as Ma,a as Ua,__tla as za}from"./useLogin-2dd90770.js";import{u as Sa,__tla as Ia}from"./useMessage-a84d7826.js";import{r as _,__tla as Ka}from"./formRules-9e699c52.js";import{_ as ja}from"./_plugin-vue_export-helper-1b428a4d.js";let E,qa=Promise.all([(()=>{try{return ba}catch{}})(),(()=>{try{return va}catch{}})(),(()=>{try{return Na}catch{}})(),(()=>{try{return La}catch{}})(),(()=>{try{return Pa}catch{}})(),(()=>{try{return za}catch{}})(),(()=>{try{return Ia}catch{}})(),(()=>{try{return Ka}catch{}})()]).then(async()=>{let h;h=(u=>(ha("data-v-bea7adde"),u=u(),ya(),u))(()=>wa("img",{alt:"",class:"w-100px",style:{margin:"0 auto"},src:"/assets/zxlogo-ba620d76.png"},null,-1)),E=ja(H({name:"LoginForm",__name:"LoginForm",setup(u){const{t:p}=la();Sa();const M=f({icon:"ep:house"}),U=f({icon:"ep:avatar"}),z=f({icon:"ep:lock"}),y=m(),{validForm:S}=Ua(y),{setLoginState:Ca,getLoginState:I}=Ea(),{currentRoute:K,push:j}=Q(),q=X(),d=m(""),c=m(!1),w=m(),C=m("blockPuzzle"),O=J(()=>e(I)===Ma.LOGIN),R={tenantName:[_],username:[_],password:[_]},a=W({isShowPassword:!1,captchaEnable:"false",tenantEnable:"false",loginForm:{tenantName:"\u975E\u7E41\u79D1\u6280",username:"",password:"",captchaVerification:"",rememberMe:!1}}),x=async()=>{a.captchaEnable==="false"?await F({}):w.value.show()},b=m(),F=async r=>{c.value=!0;try{if(await(async()=>{if(a.tenantEnable==="true"){const s=await xa(a.loginForm.tenantName);P(s)}})(),!await S())return;a.loginForm.captchaVerification=r.captchaVerification;const t=await na(a.loginForm);if(!t)return;b.value=sa.service({lock:!0,text:"\u6B63\u5728\u52A0\u8F7D\u7CFB\u7EDF\u4E2D...",background:"rgba(0, 0, 0, 0.7)"}),a.loginForm.rememberMe?ia(a.loginForm):pa(),ma(t),d.value||(d.value="/"),d.value.indexOf("sso")!==-1?window.location.href=window.location.href.replace("/login?redirect=",""):j({path:d.value||q.addRouters[0].path})}finally{c.value=!1,b.value.close()}};return Y(()=>K.value,r=>{var t;d.value=(t=r==null?void 0:r.query)==null?void 0:t.redirect},{immediate:!0}),Z(()=>{(()=>{const r=oa();r&&(a.loginForm={...a.loginForm,username:r.username?r.username:a.loginForm.username,password:r.password?r.password:a.loginForm.password,rememberMe:!!r.rememberMe,tenantName:r.tenantName?r.tenantName:a.loginForm.tenantName})})(),(async()=>{const r=location.host,t=await ra(r);t&&(a.loginForm.tenantName=t.name,P(t.id))})()}),(r,t)=>{const s=da,i=ua,g=ca,T=ga,A=ka,v=fa,B=Va,D=Fa,G=_a;return $((V(),N(G,{ref_key:"formLogin",ref:y,model:e(a).loginForm,rules:R,class:"login-form","label-position":"top","label-width":"120px",size:"large"},{default:o(()=>[l(v,{style:{"margin-right":"-10px","margin-left":"-10px"}},{default:o(()=>[l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:o(()=>[l(s,{class:"flex justify-center"},{default:o(()=>[h]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:o(()=>[e(a).tenantEnable==="true"?(V(),N(s,{key:0,prop:"tenantName"},{default:o(()=>[l(g,{modelValue:e(a).loginForm.tenantName,"onUpdate:modelValue":t[0]||(t[0]=n=>e(a).loginForm.tenantName=n),placeholder:e(p)("login.tenantNamePlaceholder"),"prefix-icon":e(M),link:"",type:"primary"},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})):ea("",!0)]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:o(()=>[l(s,{prop:"username"},{default:o(()=>[l(g,{modelValue:e(a).loginForm.username,"onUpdate:modelValue":t[1]||(t[1]=n=>e(a).loginForm.username=n),placeholder:e(p)("login.usernamePlaceholder"),"prefix-icon":e(U)},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:o(()=>[l(s,{prop:"password"},{default:o(()=>[l(g,{modelValue:e(a).loginForm.password,"onUpdate:modelValue":t[2]||(t[2]=n=>e(a).loginForm.password=n),placeholder:e(p)("login.passwordPlaceholder"),"prefix-icon":e(z),"show-password":"",type:"password",onKeyup:t[3]||(t[3]=ta(n=>x(),["enter"]))},null,8,["modelValue","placeholder","prefix-icon"])]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px","margin-top":"-20px","margin-bottom":"-20px"}},{default:o(()=>[l(s,null,{default:o(()=>[l(v,{justify:"space-between",style:{width:"100%"}},{default:o(()=>[l(i,{span:6},{default:o(()=>[l(T,{modelValue:e(a).loginForm.rememberMe,"onUpdate:modelValue":t[4]||(t[4]=n=>e(a).loginForm.rememberMe=n)},{default:o(()=>[k(L(e(p)("login.remember")),1)]),_:1},8,["modelValue"])]),_:1}),l(i,{offset:6,span:12},{default:o(()=>[l(A,{style:{float:"right"},type:"primary"},{default:o(()=>[k(L(e(p)("login.forgetPassword")),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(i,{span:24,style:{"padding-right":"10px","padding-left":"10px"}},{default:o(()=>[l(s,null,{default:o(()=>[l(B,{loading:e(c),title:e(p)("login.login"),class:"w-[100%]",type:"primary",onClick:t[5]||(t[5]=n=>x())},null,8,["loading","title"])]),_:1})]),_:1}),l(D,{ref_key:"verify",ref:w,captchaType:e(C),imgSize:{width:"400px",height:"200px"},mode:"pop",onSuccess:F},null,8,["captchaType"])]),_:1})]),_:1},8,["model"])),[[aa,e(O)]])}}}),[["__scopeId","data-v-bea7adde"]])});export{qa as __tla,E as default};