import{c as x,a as r,b as t,w as a,d as y,r as l,u as V,o as b,e as h,f as k,E as z,g as L,h as p}from"./index-CMZBZO_O.js";import{a as R}from"./index-B4LtVBBd.js";import{u as U}from"./user-DF6vxsuF.js";const B={class:"login-container"},C={class:"login-card"},S={__name:"Login",setup(E){const f=V(),c=U(),d=p(null),n=p(!1),s=k({username:"",password:""}),g={username:[{required:!0,message:"请输入用户名",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]};async function m(){var e;if(await((e=d.value)==null?void 0:e.validate().catch(()=>!1))){n.value=!0;try{const o=await R.login(s);c.setLogin(o.data.token,o.data.user),z.success(`欢迎回来，${o.data.user.realname}`),f.push(L(o.data.user.role))}catch{}finally{n.value=!1}}}return(_,e)=>{const o=l("el-input"),u=l("el-form-item"),w=l("el-button"),v=l("el-form");return b(),x("div",B,[r("div",C,[e[3]||(e[3]=r("h1",null,"⚡ 工时管理系统",-1)),e[4]||(e[4]=r("p",{class:"subtitle"},"跨部门工时管理与项目协同平台",-1)),t(v,{model:s,rules:g,ref_key:"formRef",ref:d,onKeyup:y(m,["enter"])},{default:a(()=>[t(u,{prop:"username"},{default:a(()=>[t(o,{modelValue:s.username,"onUpdate:modelValue":e[0]||(e[0]=i=>s.username=i),placeholder:"请输入用户名","prefix-icon":"User",size:"large"},null,8,["modelValue"])]),_:1}),t(u,{prop:"password"},{default:a(()=>[t(o,{modelValue:s.password,"onUpdate:modelValue":e[1]||(e[1]=i=>s.password=i),placeholder:"请输入密码",type:"password","show-password":"","prefix-icon":"Lock",size:"large"},null,8,["modelValue"])]),_:1}),t(u,null,{default:a(()=>[t(w,{type:"primary",size:"large",loading:n.value,onClick:m,style:{width:"100%",height:"48px","font-size":"16px","border-radius":"10px"}},{default:a(()=>[...e[2]||(e[2]=[h(" 登 录 ",-1)])]),_:1},8,["loading"])]),_:1})]),_:1},8,["model"]),e[5]||(e[5]=r("div",{style:{"text-align":"center",color:"var(--text-muted)","font-size":"12px","margin-top":"16px"}}," 默认管理员账号: admin / admin123 ",-1))])])}}};export{S as default};
