import{d as S,r as m,u as j,a as z,b as U,e as q,f as B,g as L,h as P,o as I,i as s,j as o,w as t,_ as E,k as O,N as V,l as r,P as A,m as K,L as T,n as D,p as C,B as F,q as G,s as M,t as $,R as H,v as J}from"./index-9PRMimni.js";import{_ as Q}from"./account-logo-BpiiJsxI.js";import{_ as W}from"./logo-ALUC3Uje.js";import X from"./TogglePage-BjOMGgVd.js";const Y={class:"view-account"},Z={class:"view-account-container"},ee={class:"view-account-form"},se={class:"w-full"},oe={class:"flex justify-between"},te={class:"flex-initial"},ae={class:"flex view-account-other"},ne={class:"flex-initial mx-2"},le={href:"javascript:"},ie={class:"flex-initial mx-2"},re={href:"javascript:"},ce=S({__name:"login",setup(ue){const v=m(),c=j(),g=m(!1),h=m(!0),n=z({username:"admin",password:"123456",isCaptcha:!1}),y={username:{required:!0,message:"请输入用户名",trigger:"blur"},password:{required:!0,message:"请输入密码",trigger:"blur"},isCaptcha:{required:!0,type:"boolean",trigger:"change",message:"请点击按钮进行验证码校验",validator:(d,e)=>e===!0}},N=U(),w=q(),x=B(),b=d=>{d.preventDefault(),v.value.validate(async e=>{if(e)c.error("请填写完整信息");else{const{username:l,password:u}=n;c.loading("登录中..."),g.value=!0;const a={username:l,password:u},{code:_,message:p}=await N.login(a);if(_==H.SUCCESS){const f=decodeURIComponent(x.query?.redirect||"/");c.success("登录成功！"),w.replace(f).then(k=>{x.name=="login"&&w.replace("/")})}else c.info(p||"登录失败")}})},R=()=>{n.isCaptcha=!0};return(d,e)=>{const l=V,u=O,a=E,_=L("mi-captcha"),p=D,f=F,k=$;return I(),P("div",Y,[e[9]||(e[9]=s("div",{class:"view-account-header"},null,-1)),s("div",Z,[e[8]||(e[8]=s("div",{class:"view-account-top"},[s("div",{class:"view-account-top-logo"},[s("img",{src:Q,alt:""})]),s("div",{class:"view-account-top-desc"},"Naive Admin中台前端/设计解决方案")],-1)),s("div",ee,[o(k,{ref_key:"formRef",ref:v,"label-placement":"left",size:"large",model:n,rules:y},{default:t(()=>[o(a,{path:"username"},{default:t(()=>[o(u,{value:n.username,"onUpdate:value":e[0]||(e[0]=i=>n.username=i),placeholder:"请输入用户名"},{prefix:t(()=>[o(l,{size:"18",color:"#808695"},{default:t(()=>[o(r(A))]),_:1})]),_:1},8,["value"])]),_:1}),o(a,{path:"password"},{default:t(()=>[o(u,{value:n.password,"onUpdate:value":e[1]||(e[1]=i=>n.password=i),type:"password",showPasswordOn:"click",placeholder:"请输入密码",onKeyup:K(b,["enter"])},{prefix:t(()=>[o(l,{size:"18",color:"#808695"},{default:t(()=>[o(r(T))]),_:1})]),_:1},8,["value"])]),_:1}),o(a,{path:"isCaptcha"},{default:t(()=>[s("div",se,[o(_,{width:"384","theme-color":"#2d8cf0",logo:r(W),onSuccess:R},null,8,["logo"])])]),_:1}),o(a,{class:"default-color"},{default:t(()=>[s("div",oe,[s("div",te,[o(p,{checked:h.value,"onUpdate:checked":e[2]||(e[2]=i=>h.value=i)},{default:t(()=>e[3]||(e[3]=[C("自动登录")])),_:1},8,["checked"])]),e[4]||(e[4]=s("div",{class:"flex-initial order-last"},[s("a",{href:"javascript:"},"忘记密码")],-1))])]),_:1}),o(a,null,{default:t(()=>[o(f,{type:"primary",onClick:b,size:"large",loading:g.value,block:""},{default:t(()=>e[5]||(e[5]=[C(" 登录 ")])),_:1},8,["loading"])]),_:1}),o(a,{class:"default-color"},{default:t(()=>[s("div",ae,[e[6]||(e[6]=s("div",{class:"flex-initial"},[s("span",null,"其它登录方式")],-1)),s("div",ne,[s("a",le,[o(l,{size:"24",color:"#2d8cf0"},{default:t(()=>[o(r(G))]),_:1})])]),s("div",ie,[s("a",re,[o(l,{size:"24",color:"#2d8cf0"},{default:t(()=>[o(r(M))]),_:1})])]),e[7]||(e[7]=s("div",{class:"flex-initial",style:{"margin-left":"auto"}},[s("a",{href:"javascript:"},"注册账号")],-1))])]),_:1})]),_:1},8,["model"])])]),o(X)])}}}),me=J(ce,[["__scopeId","data-v-1ba122c1"]]);export{me as default};
