import{_ as F,u as k,a as x,b as C,i as N,r as g,o as q,c as f,d as v,e as s,f as n,g as o,h as I,t as u,w as c,j as P,n as L}from"./index-BV0H45HW.js";import"./index-BtHEBb5f.js";import{B as R}from"./index-CBHeC2k-.js";import{_ as T}from"./m-field-password-h91Wshz0.js";import{C as D}from"./index-BRaRnE7I.js";import"./index-B7M1Z4gS.js";import{F as U}from"./index-CvTKOhUw.js";import{s as z,a as $,b as j}from"./index-BbxsW7ll.js";import{F as A}from"./index-DV1z_BeD.js";import"./use-id-B-gQUfBT.js";const E="/assets/login-logo-BJ7idwne.png",G="/assets/login-bg2-B4VF9ADS.png",H={class:"login-content"},J={class:"logo-container"},M=["src","alt"],K={class:"title-container"},O={class:"main-title"},Q={key:0,class:"sub-title"},W={class:"button-container"},X={class:"forgot-password"},Y={__name:"login",setup(Z){const p=k(),w=x(),b=C(),e=N.global.t,_=g(!0);let r=g(!1);const t=g({username:"",password:""}),h=async d=>{var a,i;r.value=!0;try{await b.login({password:t.value.password,username:t.value.username}),$(e("login.loginSuccess")),((a=w.query)==null?void 0:a.redirect)?(p.push({name:"versionInstall"}),localStorage.setItem("redirect","")):p.push({name:"status"}),r.value=!1}catch(l){console.error("登录失败:",l),j(((i=l.data)==null?void 0:i.message)||e("login.loginFailed")),r.value=!1}},S=()=>{z({message:e("login.forgotPasswordHint")})};return q(()=>{let d=localStorage.getItem("lang");_.value=d==="zh_CN"}),(d,a)=>{const i=U,l=D,V=T,y=R,B=A;return v(),f("div",{class:"login-container",style:L({backgroundImage:`url(${o(G)})`})},[s("div",H,[s("div",J,[s("img",{src:o(E),alt:o(e)("login.title"),class:"logo"},null,8,M)]),s("div",K,[s("h1",O,u(o(e)("login.title")),1),_.value?(v(),f("p",Q,u(o(e)("login.subtitle")),1)):I("",!0)]),n(B,{onSubmit:h,class:"login-form"},{default:c(()=>[n(l,{inset:"",class:"username-field"},{default:c(()=>[n(i,{modelValue:t.value.username,"onUpdate:modelValue":a[0]||(a[0]=m=>t.value.username=m),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(l,{inset:""},{default:c(()=>[n(V,{modelValue:t.value.password,"onUpdate:modelValue":a[1]||(a[1]=m=>t.value.password=m),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}),s("div",W,[n(y,{round:"",block:"",type:"primary","native-type":"submit",class:"login-button",loading:o(r),"loading-text":o(e)("login.loginLoading")},{default:c(()=>[P(u(o(e)("login.loginButton")),1)]),_:1},8,["loading","loading-text"])]),s("div",X,[s("span",{onClick:S},u(o(e)("login.forgotPassword")),1)])]),_:1})])],4)}}},ce=F(Y,[["__scopeId","data-v-80018b74"]]);export{ce as default};
