var b=(_,v,i)=>new Promise((r,n)=>{var o=l=>{try{a(i.next(l))}catch(p){n(p)}},d=l=>{try{a(i.throw(l))}catch(p){n(p)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,d);a((i=i.apply(_,v)).next())});import{_ as S,l as C,m as V,g as B,o as f,c as m,a as s,f as M,s as k,H as h,I as D,t as g,j as E,d as u,J as L}from"./index-1784378651390.js";const R={class:"login-screen"},H={class:"login-shell"},I={class:"login-field"},N={class:"login-field login-password-field"},U={class:"login-password-control"},q=["type"],K=["aria-label","aria-pressed"],P={class:"login-field-assist","aria-live":"polite"},$={key:0,class:"login-caps-lock"},j={key:1},A={key:0,class:"login-error",role:"alert"},F=["disabled"],J={__name:"index",setup(_){const v=C(),i=V(),r=u(""),n=u(""),o=u(!1),d=u(!1),a=u(!1),l=u(""),p=B(()=>{const t=typeof v.query.redirect=="string"?decodeURIComponent(v.query.redirect):"/platform";return t.startsWith("/login")?"/platform":t||"/platform"});function w(){return b(this,null,function*(){if(l.value="",!r.value||!n.value){l.value="请输入账号和密码。";return}a.value=!0;try{yield L(r.value,n.value),i.replace(p.value)}catch(t){l.value=x(t)}finally{a.value=!1}})}function y(t){var e;d.value=!!((e=t==null?void 0:t.getModifierState)!=null&&e.call(t,"CapsLock"))}function x(t){const e=String((t==null?void 0:t.message)||"").trim();return/401|403|账号|密码|unauthor/i.test(e)?"账号或密码不正确，请核对后重试。":/network|fetch|timeout|连接|服务|502|503|504/i.test(e)?"登录服务暂时无法连接，请稍后重试。":"暂时无法登录，请稍后重试。"}return(t,e)=>(f(),m("div",R,[s("div",H,[e[9]||(e[9]=s("div",{class:"login-brand"},[s("span",null,"红原县数字畜牧业监管平台"),s("small",null,"Hongyuan Digital Animal Husbandry Supervision Platform")],-1)),s("form",{class:"login-panel","aria-label":"平台用户登录",onSubmit:M(w,["prevent"])},[e[6]||(e[6]=s("div",{class:"login-panel-kicker"},"SCREEN 2.0 · V2.2",-1)),e[7]||(e[7]=s("div",{class:"login-panel-title"},"用户登录",-1)),e[8]||(e[8]=s("p",{class:"login-panel-intro"},"使用平台账号进入红原县数字畜牧业监管大屏",-1)),s("label",I,[e[4]||(e[4]=s("span",null,"账号",-1)),k(s("input",{"onUpdate:modelValue":e[0]||(e[0]=c=>r.value=c),autocomplete:"username",autofocus:"",placeholder:"请输入平台账号"},null,512),[[h,r.value,void 0,{trim:!0}]])]),s("label",N,[e[5]||(e[5]=s("span",null,"密码",-1)),s("span",U,[k(s("input",{"onUpdate:modelValue":e[1]||(e[1]=c=>n.value=c),autocomplete:"current-password",placeholder:"请输入密码",type:o.value?"text":"password",onKeydown:y,onKeyup:y,onBlur:e[2]||(e[2]=c=>d.value=!1)},null,40,q),[[D,n.value]]),s("button",{class:"login-password-toggle",type:"button","aria-label":o.value?"隐藏密码":"显示密码","aria-pressed":o.value,onClick:e[3]||(e[3]=c=>o.value=!o.value)},g(o.value?"隐藏":"显示"),9,K)])]),s("div",P,[d.value?(f(),m("span",$,"大写锁定已开启")):(f(),m("span",j,"账号由平台管理员统一分配"))]),l.value?(f(),m("div",A,g(l.value),1)):E("",!0),s("button",{class:"login-submit",disabled:a.value,type:"submit"},g(a.value?"登录中":"登录"),9,F)],32)])]))}},W=S(J,[["__scopeId","data-v-f6092897"]]);export{W as default};
