import{b as i,I as p,ag as Ae,ah as Z,ai as Le,d as Ve,q as Be,i as z,v as S,N as Ce,j as De,p as K,G as h,A as g,w as c,r as m,o as f,a as O,aj as Ne,c as j,l as ee,m as s,f as te,F as V,J as B,af as C,e as b,t as y,D as Ee,ak as Te,al as ne,B as ae,a2 as Ie,am as Fe,ae as Ue,z as We,g as Re}from"./DPwbf7XO.js";import{M as Ge,c as k,s as qe}from"./D1PxpBgp.js";import{U as D}from"./Ce_WBGpl.js";import{g as Je}from"./Cqjv_SrU.js";import{g as Qe,r as Xe}from"./Dl1HJz7f.js";import"./Cv7upGT6.js";var Ye={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M296 250c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 144H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 458H208V148h560v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm440-88H728v-36.6c46.3-13.8 80-56.6 80-107.4 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 50.7 33.7 93.6 80 107.4V764H520c-8.8 0-16 7.2-16 16v152c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V780c0-8.8-7.2-16-16-16zM646 620c0-27.6 22.4-50 50-50s50 22.4 50 50-22.4 50-50 50-50-22.4-50-50zm180 266H566v-60h260v60z"}}]},name:"audit",theme:"outlined"};function re(n){for(var e=1;ezt),r=z(null),be=S(()=>{const o=r.value;return o?.nickname?.trim()||o?.username?.trim()||o?.phone?.trim()||o?.mobile?.trim()||"管理员"});function _(o){return"children"in o}const he=S(()=>{const o=e.path;for(const l of a.value)if(_(l)){const d=l.children.find(v=>o===v.to||o.startsWith(v.to+"/"));if(d)return d.label}else if(o===l.to||o.startsWith(l.to+"/"))return l.label;return"管理后台"}),Oe=S(()=>{const o=e.path;for(const l of a.value)if(_(l)){const d=l.children.find(v=>o===v.to||o.startsWith(v.to+"/"));if(d)return[d.to]}else if(o===l.to)return[l.to];return[]}),A=z([]);function q(){const o=e.path,l=a.value.find(d=>_(d)&&d.children.some(v=>o===v.to||o.startsWith(v.to+"/")));A.value=l?[l.key]:[]}function ye(o){A.value=Array.isArray(o)?o.slice(-1):[]}function _e(o){h(String(o.key))}function L(){t.value=!t.value}function we(){Xe();try{localStorage.removeItem("TenantId"),localStorage.removeItem("UserId")}catch{}k(),h("/login")}function Pe(o){const l=String(o.key);l==="account-info"&&h("/admin/users"),l==="profile"&&h("/profile"),l==="view-site"&&window.open("/","_blank"),l==="logout"&&we()}Ce(()=>e.path,q,{immediate:!0});const w=z(!1);return De(async()=>{if(!Qe()){k(),K.error("请先登录"),await h("/login"),w.value=!0;return}try{const l=await Je();if(r.value=l,qe(l),!l.isAdmin){K.error("您无权访问管理后台,该区域仅限管理员使用"),k(),await h("/login"),w.value=!0;return}}catch{r.value=null,k(),await h("/login"),w.value=!0;return}q(),w.value=!0}),(o,l)=>{const d=m("a-menu-item"),v=m("a-sub-menu"),J=m("a-tag"),Q=m("a-menu"),ze=m("a-layout-sider"),Se=m("a-button"),je=m("a-tooltip"),ke=m("a-avatar"),X=m("a-menu-divider"),$e=m("a-dropdown"),Me=m("a-layout-header"),He=m("a-spin"),xe=m("a-layout-content"),Y=m("a-layout");return f(),g(Y,{class:"layout-shell"},{default:c(()=>[i(ze,{class:"sider",width:220,"collapsed-width":64,breakpoint:"lg",theme:"dark",trigger:null,collapsible:"",collapsed:s(t),"onUpdate:collapsed":l[1]||(l[1]=u=>Ie(t)?t.value=u:null)},{default:c(()=>[O("div",{class:"sider-logo",onClick:l[0]||(l[0]=u=>("navigateTo"in o?o.navigateTo:s(h))("/admin"))},[l[3]||(l[3]=O("img",{src:Pt,alt:"logo",class:"logo-img"},null,-1)),i(Ne,{name:"logo-text"},{default:c(()=>[s(t)?ee("",!0):(f(),j("span",St,"决策咨询网"))]),_:1})]),i(Q,{mode:"inline",theme:"dark","selected-keys":s(Oe),"open-keys":s(t)?[]:s(A),"inline-collapsed":s(t),onOpenChange:ye,onClick:_e},{default:c(()=>[(f(!0),j(V,null,te(s(a),u=>(f(),j(V,{key:_(u)?u.key:u.to},[_(u)?(f(),g(v,{key:u.key},B({title:c(()=>[b(y(u.label),1)]),default:c(()=>[(f(!0),j(V,null,te(u.children,P=>(f(),g(d,{key:P.to},B({default:c(()=>[b(" "+y(P.label),1)]),_:2},[P.icon?{name:"icon",fn:c(()=>[(f(),g(C(P.icon)))]),key:"0"}:void 0]),1024))),128))]),_:2},[u.icon?{name:"icon",fn:c(()=>[(f(),g(C(u.icon)))]),key:"0"}:void 0]),1024)):(f(),g(d,{key:u.to},B({default:c(()=>[b(" "+y(u.label)+" ",1),!s(t)&&u.badge?(f(),g(J,{key:0,color:u.badge==="NEW"?"green":"orange",class:"nav-badge"},{default:c(()=>[b(y(u.badge),1)]),_:2},1032,["color"])):ee("",!0)]),_:2},[u.icon?{name:"icon",fn:c(()=>[(f(),g(C(u.icon)))]),key:"0"}:void 0]),1024))],64))),128))]),_:1},8,["selected-keys","open-keys","inline-collapsed"]),O("div",{class:"sider-collapse-trigger",role:"button",tabindex:"0","aria-label":s(t)?"展开菜单":"收起菜单",onClick:L,onKeydown:[ne(ae(L,["prevent"]),["enter"]),ne(ae(L,["prevent"]),["space"])]},[s(t)?(f(),g(s(Ee),{key:0,style:{"font-size":"10px"}})):(f(),g(s(Te),{key:1,style:{"font-size":"10px"}}))],40,jt)]),_:1},8,["collapsed"]),i(Y,{class:We(["main-layout",{"main-layout--collapsed":s(t)}])},{default:c(()=>[i(Me,{class:"main-header"},{default:c(()=>[O("div",kt,[O("div",$t,[i(J,{color:"red",class:"admin-badge"},{default:c(()=>[...l[4]||(l[4]=[b("决策咨询网",-1)])]),_:1}),O("span",Mt,y(s(he)),1)]),O("div",Ht,[i(je,{title:"查看网站首页"},{default:c(()=>[i(Se,{type:"text",size:"small",onClick:l[2]||(l[2]=u=>("navigateTo"in o?o.navigateTo:s(h))("/"))},{icon:c(()=>[i(s(M))]),default:c(()=>[l[5]||(l[5]=b(" 网站首页 ",-1))]),_:1})]),_:1}),i($e,{placement:"bottomRight",trigger:["click"]},{overlay:c(()=>[i(Q,{onClick:Pe,class:"user-dropdown-menu"},{default:c(()=>[i(d,{key:"account-info"},{default:c(()=>[i(s(D),{style:{"margin-right":"8px"}}),l[6]||(l[6]=b(" 账户信息 ",-1))]),_:1}),i(d,{key:"profile"},{default:c(()=>[i(s(F),{style:{"margin-right":"8px"}}),l[7]||(l[7]=b(" 个人信息 ",-1))]),_:1}),i(X),i(d,{key:"view-site"},{default:c(()=>[i(s(M),{style:{"margin-right":"8px"}}),l[8]||(l[8]=b(" 查看网站 ",-1))]),_:1}),i(X),i(d,{key:"logout",class:"logout-item"},{default:c(()=>[i(s(U),{style:{"margin-right":"8px"}}),l[9]||(l[9]=b(" 退出登录 ",-1))]),_:1})]),_:1})]),default:c(()=>[O("div",xt,[i(ke,{size:28,src:s(r)?.avatar||s(r)?.avatarUrl},{icon:c(()=>[i(s(D))]),_:1},8,["src"]),O("span",At,y(s(be)),1),i(s(Fe),{style:{"font-size":"10px",opacity:"0.6","margin-left":"2px"}})])]),_:1})])])]),_:1}),i(xe,{class:"main-content"},{default:c(()=>[s(w)?Ue(o.$slots,"default",{key:1},void 0,!0):(f(),g(He,{key:0,size:"large",tip:"加载中...",class:"spin"}))]),_:3})]),_:3},8,["class"])]),_:3})}}}),Tt=Re(Lt,[["__scopeId","data-v-0012ff67"]]);export{Tt as default};