import{e as N,r as t,d as z,P as h,Q as w,a7 as n,f as e,a4 as a,F as A,a9 as R,H as T,ab as y,a5 as U,ac as D,ad as M,a8 as P}from"./vue-bf422dc1.js";import{a as q,b as E,_ as L}from"./index-8db2df2c.js";import{M as m,l as $,I as H,F as O,B as Q,e as j}from"./ui-ba7aaa7e.js";import"./libs-51817cd7.js";import"./plugins-ca970193.js";import"./others-9f318174.js";import"./echarts-bf9d612c.js";import"./icons-a8498fb6.js";const G=r=>(D("data-v-4566b1a0"),r=r(),M(),r),J={class:"login-wrapper"},K={class:"h-full"},W={class:"login-container"},X=G(()=>n("div",{class:"title-container"},[n("h1",{class:"title margin-no"},"管理员登录")],-1)),Y={class:"copyright"},Z=N({__name:"index",setup(r){const _=P(),f=q();(()=>{f.accessToken&&(m.success("已登录, 正在跳转到工作台..."),_.push({path:"/admin/workbench"}))})();const x={username:"",password:""},I={username:[{required:!0,message:"用户名必填",type:"error"}],password:[{required:!0,message:"密码必填",type:"error"}]},v=t("password"),S=t(),o=t({...x}),l=t(!1),u=t("登录"),i=t(!1),k=async g=>{if(g.validateResult===!0){u.value="登录中...",i.value=!0;try{await f.login(o.value),m.success("登陆成功"),_.push({path:"/admin/workbench"}),i.value=!1}catch(s){u.value="登录",i.value=!1,m.error(s.msg)}}},V=E(),C=z(()=>V.config.site_info_copyright);return(g,s)=>{const d=$,b=H,p=O,F=Q,B=j;return h(),w("div",J,[n("div",K,[n("div",W,[X,e(B,{ref_key:"form",ref:S,class:U(["item-container",`login-${v.value}`]),data:o.value,rules:I,"label-width":"0",onSubmit:k},{default:a(()=>[v.value=="password"?(h(),w(A,{key:0},[e(p,{name:"username"},{default:a(()=>[e(b,{modelValue:o.value.username,"onUpdate:modelValue":s[0]||(s[0]=c=>o.value.username=c),size:"large",placeholder:"请输入账号/手机号/邮箱"},{"prefix-icon":a(()=>[e(d,{name:"user"})]),_:1},8,["modelValue"])]),_:1}),e(p,{name:"password"},{default:a(()=>[e(b,{modelValue:o.value.password,"onUpdate:modelValue":s[2]||(s[2]=c=>o.value.password=c),size:"large",type:l.value?"text":"password",clearable:"",placeholder:"请输入登录密码"},{"prefix-icon":a(()=>[e(d,{name:"lock-on"})]),"suffix-icon":a(()=>[e(d,{name:l.value?"browse":"browse-off",onClick:s[1]||(s[1]=c=>l.value=!l.value)},null,8,["name"])]),_:1},8,["modelValue","type"])]),_:1})],64)):R("",!0),e(p,{class:"btn-container"},{default:a(()=>[e(F,{block:"",type:"submit",size:"large",disabled:i.value},{default:a(()=>[T(y(u.value),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["class","data"])])]),n("footer",Y,y(C.value),1)])}}});const ce=L(Z,[["__scopeId","data-v-4566b1a0"]]);export{ce as default};
