import{d as C,G as $,H as z,al as D,D as N,r as p,a as q,o as E,v as F,b as l,c as T,e as o,j as s,f as e,w as n,g as H,h as b,t as O,x as P,y as W,aU as Z,m as k,q as A,_ as G}from"./index-93dfb385.js";import{u as J,a as V}from"./hooks-381c0830.js";import{u as K}from"./user-e9c47f7a.js";const g=C({name:"Motion",props:{delay:{type:Number,default:50}},render(){const{delay:r}=this,m=$("motion");return z(D("div",{},{default:()=>[this.$slots.default()]}),[[m,{initial:{opacity:0,y:100},enter:{opacity:1,y:0,transition:{delay:r}}}]])}}),Q=""+new URL("../png/login_bg-7a357d15.png",import.meta.url).href,X={width:48,height:48,body:''},Y={width:48,height:48,body:''},ee={width:48,height:48,body:''},oe={width:48,height:48,body:''},I=r=>(P("data-v-7a9b03bb"),r=r(),W(),r),te={class:"select-none"},se=["src"],ne={class:"login-container"},ae=I(()=>o("div",{class:"login-left"},[o("span",{class:"login-left-title"},"欢迎使用"),o("span",{class:"systeam-name"},"虚拟病人系统"),o("span",{class:"desc"},"Welcome to the Virtual Patient System")],-1)),le={class:"login-box"},re={class:"login-form"},ie=I(()=>o("div",{class:"top"},[o("p",{class:"title"},"欢迎登录虚拟病人系统"),o("p",{class:"top_desc"},"Welcome to login")],-1)),ce={class:"w-full h-[20px] flex justify-between items-center"},de=C({name:"Login",__name:"index",setup(r){const m=N(),c=p(!1),h=p(),v=p(!1),{initStorage:M}=J();M();const a=q({username:"",password:""}),y=async u=>{c.value=!0,u&&await u.validate((t,_)=>{if(t)K().loginByUsername({userAccount:a.username,password:a.password}).then(f=>{c.value=!1,f.code===200&&(Z().then(()=>{m.push("/selectCase")}),k("登录成功",{type:"success"}))}).catch(()=>{c.value=!1,k("登录失败",{type:"error"})});else return c.value=!1,_})},d=p("password"),w=p();function x({code:u}){u==="Enter"&&y(h.value)}function S(){d.value==="password"?d.value="text":d.value="password",A(()=>{w.value.focus()})}return E(()=>{window.document.addEventListener("keypress",x)}),F(()=>{window.document.removeEventListener("keypress",x)}),(u,t)=>{const _=l("el-input"),f=l("el-form-item"),U=l("IconifyIconOffline"),L=l("el-icon"),j=l("el-checkbox"),R=l("el-button"),B=l("el-form");return H(),T("div",te,[o("img",{src:s(Q),class:"wave"},null,8,se),o("div",ne,[ae,o("div",le,[o("div",re,[ie,e(B,{ref_key:"ruleFormRef",ref:h,model:a,size:"large"},{default:n(()=>[e(s(g),{delay:100},{default:n(()=>[e(f,{rules:[{required:!0,message:"请输入账号",trigger:"blur"}],prop:"username"},{default:n(()=>[e(_,{style:{height:"60px","font-size":"16px"},modelValue:a.username,"onUpdate:modelValue":t[0]||(t[0]=i=>a.username=i),placeholder:"账号","prefix-icon":s(V)(s(Y))},null,8,["modelValue","prefix-icon"])]),_:1})]),_:1}),e(s(g),{delay:150},{default:n(()=>[e(f,{prop:"password",rules:[{required:!0,message:"请输入密码",trigger:"blur"}]},{default:n(()=>[e(_,{style:{height:"60px","font-size":"16px"},ref_key:"refInput",ref:w,type:d.value,modelValue:a.password,"onUpdate:modelValue":t[1]||(t[1]=i=>a.password=i),placeholder:"密码","prefix-icon":s(V)(s(X))},{suffix:n(()=>[e(L,{class:"el-icon el-input__icon el-input__password",onClick:S},{default:n(()=>[e(U,{icon:d.value=="password"?s(ee):s(oe)},null,8,["icon"])]),_:1})]),_:1},8,["type","modelValue","prefix-icon"])]),_:1})]),_:1}),e(s(g),{delay:250},{default:n(()=>[o("div",ce,[e(j,{modelValue:v.value,"onUpdate:modelValue":t[2]||(t[2]=i=>v.value=i)},{default:n(()=>[b(O("记住密码"))]),_:1},8,["modelValue"])]),e(R,{class:"w-full mt-9 login-btn",size:"large",type:"primary",color:"rgba(66, 135, 255, 1)",loading:c.value,onClick:t[3]||(t[3]=i=>y(h.value))},{default:n(()=>[b(" 登录 ")]),_:1},8,["loading"])]),_:1})]),_:1},8,["model"])])])])])}}});const fe=G(de,[["__scopeId","data-v-7a9b03bb"]]);export{fe as default};