import{d as S,r as p,u as j,bz as B,a as E,b as U,e as q,f as I,c as O,o as P,w as t,j as s,i as o,_ as A,k as G,N as M,l as c,P as V,m as F,L as K,n as D,p as k,B as T,q as H,s as J,R as Q,t as W}from"./index-9PRMimni.js";const X={class:"mb-6 default-color"},Y={class:"flex justify-between"},Z={class:"flex-initial"},$={class:"mb-4 default-color"},ee={class:"flex view-account-other"},se={class:"flex-initial mx-2"},oe={href:"javascript:"},te={class:"flex-initial mx-2"},ae={href:"javascript:"},re=S({__name:"LoginForm",emits:["goRegister"],setup(ne,{emit:y}){const g=p(),l=j(),d=p(!1),v=p(!0),N=B.BASE_LOGIN_NAME,a=E({username:"admin",password:"123456"}),R={username:{required:!0,message:"请输入用户名",trigger:"blur"},password:{required:!0,message:"请输入密码",trigger:"blur"}},C=y,L=U(),h=q(),w=I(),x=b=>{b.preventDefault(),g.value.validate(async e=>{if(e)l.error("请填写完整信息");else{const{username:n,password:u}=a;l.loading("登录中..."),d.value=!0;const r={username:n,password:u};try{const{code:_,message:f}=await L.login(r);if(l.destroyAll(),_==Q.SUCCESS){const m=decodeURIComponent(w.query?.redirect||"/");l.success("登录成功，即将进入系统"),w.name===N?h.replace("/"):h.replace(m)}else l.info(f||"登录失败")}finally{d.value=!1}}})};function z(){C("goRegister")}return(b,e)=>{const n=M,u=G,r=A,_=D,f=T,m=W;return P(),O(m,{ref_key:"formRef",ref:g,"show-label":!1,"show-require-mark":!1,size:"large",model:a,rules:R},{default:t(()=>[s(r,{path:"username"},{default:t(()=>[s(u,{value:a.username,"onUpdate:value":e[0]||(e[0]=i=>a.username=i),placeholder:"请输入用户名"},{prefix:t(()=>[s(n,{size:"18",color:"#808695"},{default:t(()=>[s(c(V))]),_:1})]),_:1},8,["value"])]),_:1}),s(r,{path:"password"},{default:t(()=>[s(u,{value:a.password,"onUpdate:value":e[1]||(e[1]=i=>a.password=i),type:"password",showPasswordOn:"click",placeholder:"请输入密码",onKeyup:F(x,["enter"])},{prefix:t(()=>[s(n,{size:"18",color:"#808695"},{default:t(()=>[s(c(K))]),_:1})]),_:1},8,["value"])]),_:1}),o("div",X,[o("div",Y,[o("div",Z,[s(_,{checked:v.value,"onUpdate:checked":e[2]||(e[2]=i=>v.value=i)},{default:t(()=>e[3]||(e[3]=[k("自动登录")])),_:1},8,["checked"])]),e[4]||(e[4]=o("div",{class:"flex-initial order-last"},[o("a",{href:"javascript:"},"忘记密码")],-1))])]),s(r,{"show-label":!1},{default:t(()=>[s(f,{type:"primary",onClick:x,size:"large",loading:d.value,block:""},{default:t(()=>e[5]||(e[5]=[k(" 登录 ")])),_:1},8,["loading"])]),_:1}),o("div",$,[o("div",ee,[e[6]||(e[6]=o("div",{class:"flex-initial"},[o("span",null,"其它登录方式")],-1)),o("div",se,[o("a",oe,[s(n,{size:"24",color:"#2d8cf0"},{default:t(()=>[s(c(H))]),_:1})])]),o("div",te,[o("a",ae,[s(n,{size:"24",color:"#2d8cf0"},{default:t(()=>[s(c(J))]),_:1})])]),o("div",{class:"flex-initial",style:{"margin-left":"auto"}},[o("a",{href:"javascript:",onClick:z},"注册账号")])])])]),_:1},8,["model"])}}});export{re as _};
