import{_ as y,u as B,a as F,i as x,r as p,o as C,c as v,b as w,d as a,e as n,f as o,g as N,t as c,w as d,h as I,n as P}from"./index-BDh_pN-M.js";import"./index-Bg8xNGen.js";import{B as q}from"./index-DdRBin1M.js";import{_ as D}from"./m-field-password-BspgRYgO.js";import{C as L}from"./index-CbMXeqxJ.js";import"./index-Dgm5--V8.js";import{F as T}from"./index-BlAKgHsW.js";import{s as R,a as U,b as z}from"./index-QU4odbju.js";import{F as $}from"./index-zhU1DFYQ.js";import"./use-id-BjlrU84y.js";const A="/assets/login-logo-BJ7idwne.png",E="/assets/login-bg2-B4VF9ADS.png",G={class:"login-content"},H={class:"logo-container"},J=["src","alt"],M={class:"title-container"},j={class:"main-title"},K={key:0,class:"sub-title"},O={class:"button-container"},Q={class:"forgot-password"},W={__name:"login",setup(X){const r=B(),_=F(),e=x.global.t,f=p(!0);let i=p(!1);const l=p({username:"",password:""}),b=async m=>{var t,u;i.value=!0;try{await _.login({password:l.value.password,username:l.value.username}),U(e("login.loginSuccess"));let s=(t=_.installStatus)==null?void 0:t.stage;if(s)switch(s){case"download":r.push({name:"versionDownload"});break;case"update":r.push({name:"versionInstall"});break;case"restart":r.push({name:"versionInstall"});break;default:r.push({name:"status"});break}else r.push({name:"status"});i.value=!1}catch(s){console.error("登录失败:",s),z(((u=s.data)==null?void 0:u.message)||e("login.loginFailed")),i.value=!1}},h=()=>{R({message:e("login.forgotPasswordHint")})};return C(()=>{let m=localStorage.getItem("lang");f.value=m==="zh_CN"}),(m,t)=>{const u=T,s=L,k=D,S=q,V=$;return w(),v("div",{class:"login-container",style:P({backgroundImage:`url(${o(E)})`})},[a("div",G,[a("div",H,[a("img",{src:o(A),alt:o(e)("login.title"),class:"logo"},null,8,J)]),a("div",M,[a("h1",j,c(o(e)("login.title")),1),f.value?(w(),v("p",K,c(o(e)("login.subtitle")),1)):N("",!0)]),n(V,{onSubmit:b,class:"login-form"},{default:d(()=>[n(s,{inset:"",class:"username-field"},{default:d(()=>[n(u,{modelValue:l.value.username,"onUpdate:modelValue":t[0]||(t[0]=g=>l.value.username=g),name:"username",label:o(e)("login.usernameLabel"),placeholder:o(e)("login.usernamePlaceholder"),rules:[{required:!0,message:o(e)("login.usernameRequired")}],"left-icon":"user-o","auto-complete":"close"},null,8,["modelValue","label","placeholder","rules"])]),_:1}),n(s,{inset:""},{default:d(()=>[n(k,{modelValue:l.value.password,"onUpdate:modelValue":t[1]||(t[1]=g=>l.value.password=g),name:"password",label:o(e)("login.passwordLabel"),placeholder:o(e)("login.passwordPlaceholder"),rules:[{required:!0,message:o(e)("login.passwordRequired")}],"left-icon":"lock",autocomplete:"new-password"},null,8,["modelValue","label","placeholder","rules"])]),_:1}),a("div",O,[n(S,{round:"",block:"",type:"primary","native-type":"submit",class:"login-button",loading:o(i),"loading-text":o(e)("login.loginLoading")},{default:d(()=>[I(c(o(e)("login.loginButton")),1)]),_:1},8,["loading","loading-text"])]),a("div",Q,[a("span",{onClick:h},c(o(e)("login.forgotPassword")),1)])]),_:1})])],4)}}},ie=y(W,[["__scopeId","data-v-defb4c8d"]]);export{ie as default};
