import{d as h,u as v,c as x,a as t,b as p,e as o,w as r,f as k,r as n,g as A,h as T,o as U,i as N,j as R,k as S,D as q}from"./index-CcdGGfCj.js";import{_ as c,a as B}from"./http-CGjljVXL.js";import{l as C}from"./logo-DSdTLzUt.js";import{u as D}from"./auth-EXu5ynQ_.js";const E={class:"login-page"},L={class:"login-panel"},M={class:"login-brand"},I={class:"brand-mark"},j=["src"],G=h({__name:"LoginView",setup(z){const l=D(),f=v(),_=A(),g=T(),s=R({username:"",password:""}),m=S(),w={username:[{required:!0,message:"请输入管理员账号",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]};async function b(){var i;if(!l.loading&&await((i=m.value)==null?void 0:i.validate().catch(()=>!1)))try{await l.login(s.username,s.password),_.replace(String(g.query.redirect||q))}catch(e){const a=B(e);f.error(a.message,a.copyText)}}return(i,e)=>{const a=n("el-input"),d=n("el-form-item"),V=n("el-button"),y=n("el-form");return U(),x("main",E,[t("section",L,[t("div",M,[t("span",I,[t("img",{src:p(C),alt:""},null,8,j)]),e[2]||(e[2]=t("span",null,"剧游AI",-1))]),e[4]||(e[4]=t("div",{class:"login-heading"},[t("h1",{id:"login-title"},"管理后台登录")],-1)),o(y,{ref_key:"formRef",ref:m,model:s,rules:w,"label-position":"top",size:"large",onSubmit:k(b,["prevent"])},{default:r(()=>[o(d,{label:"管理员账号",prop:"username"},{default:r(()=>[o(a,{modelValue:s.username,"onUpdate:modelValue":e[0]||(e[0]=u=>s.username=u),modelModifiers:{trim:!0},autocomplete:"username",placeholder:"请输入管理员账号"},{prefix:r(()=>[o(c,{name:"User"})]),_:1},8,["modelValue"])]),_:1}),o(d,{label:"密码",prop:"password"},{default:r(()=>[o(a,{modelValue:s.password,"onUpdate:modelValue":e[1]||(e[1]=u=>s.password=u),type:"password",autocomplete:"current-password","show-password":"",placeholder:"请输入密码"},{prefix:r(()=>[o(c,{name:"Lock"})]),_:1},8,["modelValue"])]),_:1}),o(V,{class:"login-submit",type:"primary","native-type":"submit",loading:p(l).loading},{default:r(()=>[...e[3]||(e[3]=[N("登录",-1)])]),_:1},8,["loading"])]),_:1},8,["model"])])])}}});export{G as default};
