import{d as E,dJ as x,aR as C,ac as k,dK as N,r as R,o as b,c as h,e as d,t as F,u,b as o,w as a,aT as S,f as T,m as q,bP as B,b0 as D,a as K,bX as f,dL as L,dM as M,_ as U}from"./index.f859bf4e.js";import{E as $,s as j,t as A}from"./el-input.f35758e8.js";import{u as J}from"./user.0bac8e4f.js";import"./send_request.cc43fdb9.js";const O={class:"login-wrap"},P={class:"login-container"},X={class:"ms-login"},z={class:"ms-title"},G={class:"login-btn"},H={key:0,class:"company-info"},Q=E({__name:"login",setup(W){const _=x(),r=C({username:"root",password:"root"}),V={username:[{required:!0,message:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",trigger:"blur"}],password:[{required:!0,message:"\u8BF7\u8F93\u5165\u5BC6\u7801",trigger:"blur"}]},p=k(),v=g=>{!g||g.validate(async(s,l)=>{if(!s){console.log("invalidFields",l),Object.values(l).forEach(e=>{e.forEach(t=>{B.error({message:t.message,grouping:!0})})});return}J({username:r.username,password:r.password}).then(async e=>{var i,c,m,n,y,I,w;if(!e)return;console.log("login data",e,e.userInfo),B.success("\u767B\u5F55\u6210\u529F"),localStorage.setItem("ms_username",(i=e.userInfo)==null?void 0:i.username),localStorage.setItem("ms_realname",(c=e.userInfo)==null?void 0:c.realname),localStorage.setItem("ms_user_id",(m=e.userInfo)==null?void 0:m.id),localStorage.setItem("ms_role_id",(n=e.userInfo)==null?void 0:n.roleId);let t=(w=(I=(y=_.currentRoute)==null?void 0:y.value)==null?void 0:I.query)==null?void 0:w.redirectTo;t&&!t.includes("/login")?_.push(t):_.push("/")})})};return N().clearTags(),(g,s)=>{const l=D,e=$,t=j,i=R("Right"),c=K,m=A;return b(),h("div",O,[d("div",P,[d("div",X,[d("div",z,F(u(f).siteFullTitle),1),o(m,{model:r,rules:V,ref_key:"login",ref:p,"label-width":"0px",class:"ms-content"},{default:a(()=>[o(t,{prop:"username"},{default:a(()=>[o(e,{modelValue:r.username,"onUpdate:modelValue":s[0]||(s[0]=n=>r.username=n),placeholder:"\u7528\u6237\u540D"},{prepend:a(()=>[o(l,{icon:u(L)},null,8,["icon"])]),_:1},8,["modelValue"])]),_:1}),o(t,{prop:"password"},{default:a(()=>[o(e,{type:"password",placeholder:"\u5BC6\u7801",modelValue:r.password,"onUpdate:modelValue":s[1]||(s[1]=n=>r.password=n),onKeyup:s[2]||(s[2]=S(n=>v(p.value),["enter"]))},{prepend:a(()=>[o(l,{icon:u(M)},null,8,["icon"])]),_:1},8,["modelValue"])]),_:1}),d("div",G,[o(l,{type:"primary",onClick:s[3]||(s[3]=n=>v(p.value))},{default:a(()=>[T(" \u767B \u5F55\xA0"),o(c,null,{default:a(()=>[o(i)]),_:1})]),_:1})])]),_:1},8,["model"])])]),u(f).companyName?(b(),h("div",H,F(u(f).companyName),1)):q("",!0)])}}});const te=U(Q,[["__scopeId","data-v-0fd4c22f"]]);export{te as default};
