import{d as H,u as J,n as K,p as O,o as u,q as i,w as e,r as a,k as L,a as l,b as t,g as c,h as R,c as B,s as D,F as I,t as N,v as Q,x as p,y as X,z as Y,j as Z,A as v,f as ee,B as te,C as S,_ as oe}from"./index-DIl-pxgT.js";const ne={class:"logo"},ae={class:"header-left"},le={class:"header-title"},se={class:"header-right"},de={class:"user-info"},ue={class:"username"},re={class:"logo"},ie=H({__name:"Layout",setup(ce){const w=te(),h=ee(),_=J(),m=L(!1),x=L(window.innerWidth),g=v(()=>x.value<768),y=v(()=>w.path),U=v(()=>{var s;return((s=w.meta)==null?void 0:s.title)||"PropDataGuard"}),b=v(()=>{const s=h.getRoutes().find(o=>o.name==="Layout");return(s==null?void 0:s.children.filter(o=>{var d;return(d=o.meta)==null?void 0:d.title}))||[]});function E(s){s==="logout"&&(_.logout(),h.push("/login"))}function k(){x.value=window.innerWidth}return K(()=>{window.addEventListener("resize",k),!_.userInfo&&_.token&&_.fetchUserInfo()}),O(()=>{window.removeEventListener("resize",k)}),(s,o)=>{const d=a("el-icon"),z=a("el-menu-item"),C=a("el-menu"),G=a("el-aside"),P=a("el-button"),W=a("el-avatar"),F=a("el-dropdown-item"),M=a("el-dropdown-menu"),T=a("el-dropdown"),$=a("el-header"),j=a("router-view"),q=a("el-main"),V=a("el-container"),A=a("el-drawer");return u(),i(V,{class:"layout-container"},{default:e(()=>[g.value?N("",!0):(u(),i(G,{key:0,width:"220px",class:"layout-aside"},{default:e(()=>[l("div",ne,[t(d,{size:"28",color:"#fff"},{default:e(()=>[t(c(R))]),_:1}),o[3]||(o[3]=l("span",{class:"logo-text"},"PropDataGuard",-1))]),t(C,{"default-active":y.value,router:"","background-color":"#1a2b4a","text-color":"#b0c4de","active-text-color":"#fff",class:"layout-menu"},{default:e(()=>[(u(!0),B(I,null,D(b.value,n=>(u(),i(z,{key:n.path,index:n.path},{default:e(()=>{var r;return[t(d,null,{default:e(()=>{var f;return[(u(),i(S((f=n.meta)==null?void 0:f.icon)))]}),_:2},1024),l("span",null,p((r=n.meta)==null?void 0:r.title),1)]}),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])]),_:1})),t(V,{direction:"vertical"},{default:e(()=>[t($,{class:"layout-header",height:"56px"},{default:e(()=>[l("div",ae,[g.value?(u(),i(P,{key:0,type:"primary",text:"",onClick:o[0]||(o[0]=n=>m.value=!0)},{default:e(()=>[t(d,{size:"22"},{default:e(()=>[t(c(Q))]),_:1})]),_:1})):N("",!0),l("span",le,p(U.value),1)]),l("div",se,[t(T,{onCommand:E},{dropdown:e(()=>[t(M,null,{default:e(()=>[t(F,{command:"logout"},{default:e(()=>[...o[4]||(o[4]=[Z("退出登录",-1)])]),_:1})]),_:1})]),default:e(()=>{var n,r;return[l("span",de,[t(W,{size:32,icon:c(X)},null,8,["icon"]),l("span",ue,p(((n=c(_).userInfo)==null?void 0:n.real_name)||((r=c(_).userInfo)==null?void 0:r.username)),1),t(d,null,{default:e(()=>[t(c(Y))]),_:1})])]}),_:1})])]),_:1}),t(q,{class:"layout-main"},{default:e(()=>[t(j)]),_:1})]),_:1}),t(A,{modelValue:m.value,"onUpdate:modelValue":o[2]||(o[2]=n=>m.value=n),direction:"ltr",size:"220px","with-header":!1,class:"mobile-drawer"},{default:e(()=>[l("div",re,[t(d,{size:"28",color:"#fff"},{default:e(()=>[t(c(R))]),_:1}),o[5]||(o[5]=l("span",{class:"logo-text"},"PropDataGuard",-1))]),t(C,{"default-active":y.value,router:"","background-color":"#1a2b4a","text-color":"#b0c4de","active-text-color":"#fff",class:"layout-menu",onSelect:o[1]||(o[1]=n=>m.value=!1)},{default:e(()=>[(u(!0),B(I,null,D(b.value,n=>(u(),i(z,{key:n.path,index:n.path},{default:e(()=>{var r;return[t(d,null,{default:e(()=>{var f;return[(u(),i(S((f=n.meta)==null?void 0:f.icon)))]}),_:2},1024),l("span",null,p((r=n.meta)==null?void 0:r.title),1)]}),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])]),_:1},8,["modelValue"])]),_:1})}}}),fe=oe(ie,[["__scopeId","data-v-6b05a74f"]]);export{fe as default};
//# sourceMappingURL=Layout-DzZsTvlW.js.map
