import{f as b,u as g,c as i,a as t,b as f,w as c,m as x,i as e,d as v,t as h,k,v as w,x as V,y as C,j as N,q as u,e as M,o as d,z as q,A as B,_ as D}from"./2JCroH3R.js";import{u as T}from"./Ba751Df4.js";import"./CbPNayBJ.js";import"./DrJDeGiv.js";const z={class:"auth-page"},A={class:"auth-container"},L={class:"auth-header"},S={key:0,class:"error-banner"},U={class:"form-group"},j={class:"input-wrapper"},E={class:"form-group"},H={class:"input-wrapper"},I=["type"],P=["disabled"],$={key:0,class:"loading-spinner",style:{width:"18px",height:"18px","border-width":"2px"}},F={key:1},G={class:"auth-footer"},J=b({__name:"login",setup(K){g({title:"登录 - 智享生活",meta:[{name:"description",content:"登录智享生活账号,享受今日菜价、百事圈社区等本地民生服务"},{name:"robots",content:"noindex"}]});const{login:_}=T(),a=q({username:"",password:""}),n=u(!1),r=u(!1),o=u(""),y=async()=>{if(!a.username.trim()||!a.password.trim()){o.value="请填写用户名和密码";return}r.value=!0,o.value="";try{await _({username:a.username.trim(),password:a.password}),B("/")}catch(p){o.value=p.message||"登录失败,请检查用户名和密码"}finally{r.value=!1}};return(p,s)=>{const m=M;return d(),i("div",z,[t("div",A,[t("div",L,[f(m,{to:"/",class:"auth-logo"},{default:c(()=>[...s[3]||(s[3]=[t("i",{class:"fas fa-home"},null,-1)])]),_:1}),s[4]||(s[4]=t("h1",{class:"auth-title"},"登录智享生活",-1)),s[5]||(s[5]=t("p",{class:"auth-subtitle text-secondary"},"欢迎回来,登录后享受更多服务",-1))]),t("form",{class:"auth-form card",onSubmit:x(y,["prevent"])},[e(o)?(d(),i("div",S,[s[6]||(s[6]=t("i",{class:"fas fa-exclamation-circle"},null,-1)),v(" "+h(e(o)),1)])):k("",!0),t("div",U,[s[8]||(s[8]=t("label",{for:"username"},"用户名",-1)),t("div",j,[s[7]||(s[7]=t("i",{class:"fas fa-user"},null,-1)),w(t("input",{id:"username","onUpdate:modelValue":s[0]||(s[0]=l=>e(a).username=l),type:"text",placeholder:"请输入用户名",required:"",autocomplete:"username"},null,512),[[V,e(a).username]])])]),t("div",E,[s[10]||(s[10]=t("label",{for:"password"},"密码",-1)),t("div",H,[s[9]||(s[9]=t("i",{class:"fas fa-lock"},null,-1)),w(t("input",{id:"password","onUpdate:modelValue":s[1]||(s[1]=l=>e(a).password=l),type:e(n)?"text":"password",placeholder:"请输入密码",required:"",autocomplete:"current-password"},null,8,I),[[C,e(a).password]]),t("button",{type:"button",class:"toggle-password",onClick:s[2]||(s[2]=l=>n.value=!e(n))},[t("i",{class:N(e(n)?"fas fa-eye-slash":"fas fa-eye")},null,2)])])]),t("button",{type:"submit",class:"btn btn-primary btn-block",disabled:e(r)},[e(r)?(d(),i("div",$)):(d(),i("span",F,"登录"))],8,P)],32),t("div",G,[s[12]||(s[12]=t("span",{class:"text-secondary"},"还没有账号?",-1)),f(m,{to:"/register"},{default:c(()=>[...s[11]||(s[11]=[v("立即注册",-1)])]),_:1})])])])}}}),X=D(J,[["__scopeId","data-v-4a8093fd"]]);export{X as default};