var k=(v,f,r)=>new Promise((l,d)=>{var a=t=>{try{i(r.next(t))}catch(c){d(c)}},g=t=>{try{i(r.throw(t))}catch(c){d(c)}},i=t=>t.done?l(t.value):Promise.resolve(t.value).then(a,g);i((r=r.apply(v,f)).next())});import{a as N,I as C,c as z,b as E,l as T,r as w,m as U,f as $,k as e,o as K,h as V,w as F,v as b,j as s,p as n,q as I,t as L,B as q,s as A,F as P,x as j}from"./index.0d073eaa.js";import{C as G}from"./index.1491cab6.js";/* empty css              *//* empty css              */import{u as O,a as H,L as J,_ as Q,b as W}from"./LoginFormTitle.620e6f7b.js";import{F as R}from"./Form.48352728.js";import{C as X,R as Y}from"./index.1d29734e.js";import"./Checkbox.476f6e92.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./useSize.bb4e5ce5.js";const fe=N({__name:"LoginForm",setup(v){const f=X,r=Y,l=R.Item,d=C.Password,{t:a}=z(),{notification:g,createErrorModal:i}=j(),{prefixCls:t}=E("login"),c=T(),{setLoginState:Z,getLoginState:B}=O(),{getFormRules:D}=H(),x=w(),y=w(!1),_=w(!1),u=U({account:"admin",password:"123321"}),{validForm:M}=W(x),S=$(()=>e(B)===J.LOGIN);function h(){return k(this,null,function*(){const p=yield M();if(!!p)try{y.value=!0;const o=yield c.login({password:p.password,username:p.account,mode:"none"});o&&g.success({message:a("sys.login.loginSuccessTitle"),description:`${a("sys.login.loginSuccessDesc")}: ${o.realName}`,duration:3})}catch(o){i({title:a("sys.api.errorTip"),content:o.message||a("sys.api.networkExceptionMsg"),getContainer:()=>document.body.querySelector(`.${t}`)||document.body})}finally{y.value=!1}})}return(p,o)=>(K(),V(P,null,[F(s(Q,{class:"enter-x"},null,512),[[b,e(S)]]),F(s(e(R),{class:"p-4 enter-x",model:u,rules:e(D),ref_key:"formRef",ref:x,onKeypress:A(h,["enter"])},{default:n(()=>[s(e(l),{name:"account",class:"enter-x"},{default:n(()=>[s(e(C),{size:"large",value:u.account,"onUpdate:value":o[0]||(o[0]=m=>u.account=m),placeholder:e(a)("sys.login.userName"),class:"fix-auto-fill"},null,8,["value","placeholder"])]),_:1}),s(e(l),{name:"password",class:"enter-x"},{default:n(()=>[s(e(d),{size:"large",visibilityToggle:"",value:u.password,"onUpdate:value":o[1]||(o[1]=m=>u.password=m),placeholder:e(a)("sys.login.password")},null,8,["value","placeholder"])]),_:1}),s(e(r),{class:"enter-x"},{default:n(()=>[s(e(f),{span:12},{default:n(()=>[s(e(l),null,{default:n(()=>[s(e(G),{checked:_.value,"onUpdate:checked":o[2]||(o[2]=m=>_.value=m),size:"small"},{default:n(()=>[I(L(e(a)("sys.login.rememberMe")),1)]),_:1},8,["checked"])]),_:1})]),_:1})]),_:1}),s(e(l),{class:"enter-x"},{default:n(()=>[s(e(q),{type:"primary",size:"large",block:"",onClick:h,loading:y.value},{default:n(()=>[I(L(e(a)("sys.login.loginButton")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules","onKeypress"]),[[b,e(S)]])],64))}});export{fe as default};
