import{d as F,b as g,g as f,m as n,_ as H,p as q,u as N,r as b,B as Q,C as S,w as T,G as U,a as d,x as $,f as l,e as i,j as r,k as x,S as M,t as m,v as j,U as K,l as O}from"./index.a8f46cbf.js";import{_ as G}from"./plugin-vue_export-helper.41ffa612.js";import{l as I}from"./lock.2eb1d007.js";const L=F({name:"User"}),P={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Z=n("path",{fill:"currentColor",d:"M512 512a192 192 0 1 0 0-384 192 192 0 0 0 0 384zm0 64a256 256 0 1 1 0-512 256 256 0 0 1 0 512zm320 320v-96a96 96 0 0 0-96-96H288a96 96 0 0 0-96 96v96a32 32 0 1 1-64 0v-96a160 160 0 0 1 160-160h448a160 160 0 0 1 160 160v96a32 32 0 1 1-64 0z"},null,-1),J=[Z];function W(C,_,p,c,h,t){return g(),f("svg",P,J)}var X=G(L,[["render",W]]);const Y={class:"login-page"},ee={class:"login-card"},oe={key:0,class:"login-footer"},te=F({__name:"index",setup(C){const{user:_}=q(),p=N(),c=b(),h=b(),t=Q({redirect:"",loginForm:{username:"",password:""},loginRules:{username:[{required:!0,message:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",trigger:"blur"}],password:[{required:!0,validator:E,trigger:"blur"}]},loading:!1,capslockTooltipDisabled:!0,otherQuery:{},clientHeight:document.documentElement.clientHeight,showCopyright:!0});function E(o,e,s){e?e.length<6?s(new Error("\u5BC6\u7801\u957F\u5EA6\u4E0D\u80FD\u5C11\u4E8E 6 \u4F4D")):s():s(new Error("\u8BF7\u8F93\u5165\u5BC6\u7801"))}const{loginForm:a,loginRules:k,loading:B,capslockTooltipDisabled:w,showCopyright:D}=S(t);function V(o){const{key:e}=o;t.capslockTooltipDisabled=!(e&&e.length===1&&e>="A"&&e<="Z")}function v(){var o;(o=c.value)==null||o.validate(e=>{!e||(t.loading=!0,_.login(t.loginForm).then(()=>{O.push({path:t.redirect||"/",query:t.otherQuery}),t.loading=!1}).catch(()=>{t.loading=!1}))})}T(p,()=>{const o=p.query;o&&(t.redirect=o.redirect||"",t.otherQuery=R(o))},{immediate:!0});function R(o){return Object.keys(o).reduce((e,s)=>(s!=="redirect"&&(e[s]=o[s]),e),{})}return U(()=>{window.onresize=()=>{t.clientHeight>document.documentElement.clientHeight?t.showCopyright=!1:t.showCopyright=!0}}),(o,e)=>{const s=d("el-input"),y=d("el-form-item"),z=d("el-tooltip"),A=d("el-button");return g(),f("div",Y,[n("div",ee,[e[4]||(e[4]=n("div",{class:"login-card__header"},[n("h1",{class:"login-card__title"},[n("img",{src:"http://localhost:3078/src/assets/logo.png",alt:"",style:{"margin-right":"10px"}}),$(" \u76AE\u80A4\u68C0\u6D4B\u4EEA\u7BA1\u7406\u5E73\u53F0")])],-1)),l(r(M),{ref_key:"loginFormRef",ref:c,model:r(a),rules:r(k),class:"login-form",autocomplete:"off","label-position":"top",onSubmit:e[3]||(e[3]=x(()=>{},["prevent"]))},{default:i(()=>[l(y,{prop:"username",label:o.$t("login.username")},{default:i(()=>[l(s,{modelValue:r(a).username,"onUpdate:modelValue":e[0]||(e[0]=u=>r(a).username=u),placeholder:o.$t("login.username"),name:"username",type:"text",tabindex:"1","prefix-icon":r(X),autocomplete:"off",maxlength:"20",size:"large",clearable:""},null,8,["modelValue","placeholder","prefix-icon"])]),_:1},8,["label"]),l(z,{disabled:r(w),content:"\u5927\u5199\u9501\u5B9A\u5DF2\u5F00\u542F",placement:"right"},{default:i(()=>[l(y,{prop:"password",label:o.$t("login.password")},{default:i(()=>[l(s,{ref_key:"passwordRef",ref:h,modelValue:r(a).password,"onUpdate:modelValue":e[1]||(e[1]=u=>r(a).password=u),type:"password",placeholder:o.$t("login.password"),name:"password","prefix-icon":r(I),tabindex:"2",autocomplete:"new-password","show-password":"",maxlength:"20",size:"large",onKeyup:[V,K(v,["enter"])],onBlur:e[2]||(e[2]=u=>w.value=!0)},null,8,["modelValue","placeholder","prefix-icon"])]),_:1},8,["label"])]),_:1},8,["disabled"]),l(A,{class:"login-submit",size:"large",type:"primary",loading:r(B),"native-type":"submit",onClick:x(v,["prevent"])},{default:i(()=>[$(m(o.$t("login.login")),1)]),_:1},8,["loading"])]),_:1},8,["model","rules"])]),r(D)?(g(),f("div",oe,[n("p",null,m(o.$t("login.copyright")),1),n("p",null,m(o.$t("login.icp")),1)])):j("v-if",!0)])}}});var ne=H(te,[["__scopeId","data-v-37dfd6fc"]]);export{ne as default};