You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
1 year ago
|
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:'<g fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="4"><rect width="36" height="22" x="6" y="22" rx="2"/><path stroke-linecap="round" d="M14 22v-8c0-5.523 4.477-10 10-10s10 4.477 10 10v8m-10 8v6"/></g>'},Y={width:48,height:48,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"><circle cx="24" cy="12" r="8"/><path d="M42 44c0-9.941-8.059-18-18-18S6 34.059 6 44"/></g>'},ee={width:48,height:48,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M6 16c.635 1.22 1.596 2.35 2.823 3.355C12.26 22.173 17.779 24 24 24s11.739-1.827 15.177-4.645C40.404 18.35 41.365 17.22 42 16m-13.023 8l2.071 7.727m6.305-10.373l5.657 5.656M5 27.01l5.657-5.657m6.271 10.375L18.998 24"/>'},oe={width:48,height:48,body:'<g fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="4"><path d="M24 36c11.046 0 20-12 20-12s-8.954-12-20-12S4 24 4 24s8.954 12 20 12Z"/><path d="M24 29a5 5 0 1 0 0-10a5 5 0 0 0 0 10Z"/></g>'},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
|