
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.github.io
 */

import{d as K,L as N,r as n,c as j,e as i,y as q,M as B,i as e,b as o,w as s,N as F,p as r,f as L,g as M,t as T,v as D,h as v,x as E,j as W,k as w}from"./index-nGFMSQGw.js";const A={class:"min-h-screen flex items-center justify-center bg-gray-100"},H={id:"login-box",class:"min-h-[60vh] min-w-[40vw] items-center rounded-lg bg-gray-50 p-6 shadow-lg"},Q={class:"mb-6 text-center"},X={class:"text-xl text-gray-900 font-bold"},Z={class:"mb-4 flex items-center justify-between"},$="QUlXZWI=",G=K({__name:"login",setup(J){var p;const y=F(),x=L(),V=N(),c="AIWeb",k=atob($);if(!c.includes(k))throw document.body.innerHTML="<h1></h1>",new Error("");const S=n("login"),u=n(!1),R=n(((p=y.query.redirect)==null?void 0:p.toString())??"/"),m=n(),t=n({username:localStorage.login_username||"",password:"",remember:!!localStorage.login_username}),U=n({username:[{required:!0,trigger:"blur",message:"请输入用户名"}],password:[{required:!0,trigger:"blur",message:"请输入密码"},{min:6,max:18,trigger:"blur",message:"密码长度为6到18位"}]});function d(){m.value&&m.value.validate(_=>{_&&(u.value=!0,V.login(t.value).then(()=>{u.value=!1,t.value.remember?localStorage.setItem("login_username",t.value.username):localStorage.removeItem("login_username"),x.push(R.value)}).catch(()=>{u.value=!1}))})}return(_,l)=>{const g=W,f=r("el-icon"),b=r("el-input"),h=r("el-form-item"),z=r("el-checkbox"),C=r("el-button"),I=r("el-form");return M(),j("div",A,[i("div",H,[q(o(I,{ref_key:"loginFormRef",ref:m,model:e(t),rules:e(U),class:"login-form mx-12 my-10",autocomplete:"on"},{default:s(()=>[i("div",Q,[i("h3",X," 欢迎来到 "+T(e(c)),1)]),i("div",null,[o(h,{prop:"username",class:"py-2"},{default:s(()=>[o(b,{modelValue:e(t).username,"onUpdate:modelValue":l[0]||(l[0]=a=>e(t).username=a),placeholder:"用户名",text:"",tabindex:"1",autocomplete:"on",size:"large",class:"h-10"},{prefix:s(()=>[o(f,null,{default:s(()=>[o(g,{name:"ep:user"})]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(h,{prop:"password",class:"py-2"},{default:s(()=>[o(b,{modelValue:e(t).password,"onUpdate:modelValue":l[1]||(l[1]=a=>e(t).password=a),type:"password",placeholder:"密码",tabindex:"2",autocomplete:"on","show-password":"",size:"large",class:"h-10",onKeyup:D(d,["enter"])},{prefix:s(()=>[o(f,null,{default:s(()=>[o(g,{name:"ep:lock"})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),i("div",Z,[o(z,{modelValue:e(t).remember,"onUpdate:modelValue":l[2]||(l[2]=a=>e(t).remember=a),size:"large"},{default:s(()=>[v(" 记住我 ")]),_:1},8,["modelValue"])]),o(C,{loading:e(u),type:"primary",size:"large",class:"w-full",onClick:E(d,["prevent"])},{default:s(()=>[v(" 登录 ")]),_:1},8,["loading"])]),_:1},8,["model","rules"]),[[B,e(S)==="login"]])])])}}});typeof w=="function"&&w(G);export{G as default};
