You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

183 lines
12 KiB

import { _ as __nuxt_component_0 } from './nuxt-link-BsKoUOa0.mjs';
import { defineComponent, computed, mergeProps, unref, withCtx, openBlock, createBlock, createVNode, createTextVNode, toDisplayString, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderStyle, ssrInterpolate, ssrRenderList, ssrRenderComponent, ssrRenderAttr, ssrRenderSlot, ssrRenderClass } from 'vue/server-renderer';
import { u as useToast } from './useToast-CS21XT61.mjs';
import { u as useLoading } from './useLoading-D4zrSa2m.mjs';
import { a as useAuthStore, b as useRouter, c as useRoute$1, M as MENU_GROUPS, _ as _export_sfc } from './server.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import 'pinia';
import 'perfect-debounce';
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "AppToast",
__ssrInlineRender: true,
setup(__props) {
const { toasts } = useToast();
function alertClass(type) {
switch (type) {
case "success":
return "alert-success";
case "error":
return "alert-error";
case "warning":
return "alert-warning";
case "info":
default:
return "alert-info";
}
}
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({ class: "toast toast-bottom toast-end z-50" }, _attrs))}><!--[-->`);
ssrRenderList(unref(toasts), (t) => {
_push(`<div class="${ssrRenderClass(["alert", alertClass(t.type)])}"><span>${ssrInterpolate(t.msg)}</span></div>`);
});
_push(`<!--]--></div>`);
};
}
});
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/AppToast.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const __nuxt_component_1 = Object.assign(_sfc_main$2, { __name: "AppToast" });
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "AppLoading",
__ssrInlineRender: true,
setup(__props) {
const { loading } = useLoading();
return (_ctx, _push, _parent, _attrs) => {
if (unref(loading)) {
_push(`<div${ssrRenderAttrs(mergeProps({
class: "fixed inset-0 z-[100] flex items-center justify-center bg-black/30 backdrop-blur-[1px]",
"aria-busy": "true",
role: "alert"
}, _attrs))} data-v-c1ace0c2><div class="flex flex-col items-center gap-3 rounded-2xl bg-white px-10 py-7 shadow-xl" data-v-c1ace0c2><span class="loading loading-spinner loading-lg text-primary" data-v-c1ace0c2></span><span class="text-sm text-slate-600" data-v-c1ace0c2>处理中,请稍候…</span></div></div>`);
} else {
_push(`<!---->`);
}
};
}
});
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/AppLoading.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const __nuxt_component_2 = /* @__PURE__ */ Object.assign(_export_sfc(_sfc_main$1, [["__scopeId", "data-v-c1ace0c2"]]), { __name: "AppLoading" });
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "default",
__ssrInlineRender: true,
setup(__props) {
const auth = useAuthStore();
useRouter();
const route = useRoute$1();
const identityLabel = computed(() => {
const map = { 1: "超级管理员", 2: "管理员", 3: "代理", 4: "运营" };
return map[auth.identity] ?? "";
});
const identityLabelShort = computed(() => {
const map = { 1: "超管", 2: "管理员", 3: "代理", 4: "运营" };
return map[auth.identity] ?? "";
});
const avatarChar = computed(() => (auth.account || "A").charAt(0).toUpperCase());
const menuGroups = MENU_GROUPS;
function hasVisibleItems(group) {
return group.items.some((item) => auth.hasAccess(item.id));
}
const pageTitle = computed(() => {
if (route.meta?.title) return route.meta.title;
for (const g of menuGroups) {
const item = g.items.find((m) => route.path.startsWith(m.to));
if (item) return item.label;
}
return "Console";
});
return (_ctx, _push, _parent, _attrs) => {
const _component_NuxtLink = __nuxt_component_0;
const _component_AppToast = __nuxt_component_1;
const _component_AppLoading = __nuxt_component_2;
_push(`<div${ssrRenderAttrs(mergeProps({ class: "flex min-h-screen" }, _attrs))}><aside class="fixed top-0 left-0 bottom-0 z-30 overflow-y-auto flex flex-col" style="${ssrRenderStyle({ "width": "256px", "background": "#1E293B" })}"><div style="${ssrRenderStyle({ "padding": "20px 20px 16px", "border-bottom": "1px solid rgba(255,255,255,0.06)" })}"><div style="${ssrRenderStyle({ "display": "flex", "align-items": "center", "gap": "12px" })}"><div style="${ssrRenderStyle({ "width": "40px", "height": "40px", "background": "linear-gradient(135deg,#4F46E5,#7C3AED)", "border-radius": "12px", "display": "flex", "align-items": "center", "justify-content": "center", "box-shadow": "0 6px 20px rgba(79,70,229,0.35)", "flex-shrink": "0" })}"><svg style="${ssrRenderStyle({ "width": "22px", "height": "22px", "color": "#fff" })}" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg></div><div><div style="${ssrRenderStyle({ "color": "#fff", "font-weight": "700", "font-size": "15px", "letter-spacing": "-0.02em" })}">${ssrInterpolate(unref(auth).siteTitle || "Admin")}</div><div style="${ssrRenderStyle({ "color": "#64748B", "font-size": "11px", "font-weight": "500" })}">Admin Console · v1.0.1</div></div></div></div><nav style="${ssrRenderStyle({ "padding": "12px 0", "flex": "1" })}"><!--[-->`);
ssrRenderList(unref(menuGroups), (group) => {
_push(`<!--[-->`);
if (hasVisibleItems(group)) {
_push(`<div class="group-title">${ssrInterpolate(group.label)}</div>`);
} else {
_push(`<!---->`);
}
_push(`<!--[-->`);
ssrRenderList(group.items, (item) => {
_push(`<!--[-->`);
if (unref(auth).hasAccess(item.id)) {
_push(ssrRenderComponent(_component_NuxtLink, {
key: item.id,
to: item.to,
class: "sidebar-link",
"active-class": "active"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<svg class="icon" width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="currentColor"${_scopeId}><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"${ssrRenderAttr("d", item.icon)}${_scopeId}></path></svg> ${ssrInterpolate(item.label)}`);
} else {
return [
(openBlock(), createBlock("svg", {
class: "icon",
width: "18",
height: "18",
fill: "none",
viewBox: "0 0 24 24",
stroke: "currentColor"
}, [
createVNode("path", {
"stroke-linecap": "round",
"stroke-linejoin": "round",
"stroke-width": "2",
d: item.icon
}, null, 8, ["d"])
])),
createTextVNode(" " + toDisplayString(item.label), 1)
];
}
}),
_: 2
}, _parent));
} else {
_push(`<!---->`);
}
_push(`<!--]-->`);
});
_push(`<!--]--><!--]-->`);
});
_push(`<!--]--></nav><div style="${ssrRenderStyle({ "margin-top": "auto", "padding": "14px 18px", "border-top": "1px solid rgba(255,255,255,0.06)" })}"><div style="${ssrRenderStyle({ "display": "flex", "align-items": "center", "gap": "10px" })}"><div style="${ssrRenderStyle({ "width": "32px", "height": "32px", "border-radius": "9px", "background": "linear-gradient(135deg,#4F46E5,#7C3AED)", "color": "#fff", "display": "flex", "align-items": "center", "justify-content": "center", "font-weight": "700", "flex-shrink": "0" })}">${ssrInterpolate(avatarChar.value)}</div><div style="${ssrRenderStyle({ "min-width": "0" })}"><div style="${ssrRenderStyle({ "color": "#E2E8F0", "font-size": "13px", "font-weight": "600", "line-height": "1.2", "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" })}">${ssrInterpolate(unref(auth).account || "-")}</div><div style="${ssrRenderStyle({ "color": "#64748B", "font-size": "11px", "margin-top": "2px" })}">${ssrInterpolate(identityLabel.value)}</div></div></div></div></aside><main class="flex-1" style="${ssrRenderStyle({ "margin-left": "256px" })}"><header class="bg-white shadow-sm sticky top-0 z-20 h-16 flex items-center justify-between px-6"><div class="flex items-center gap-2 text-sm"><span class="text-slate-400">首页</span><span class="text-slate-300">/</span><span class="text-slate-700 font-medium">${ssrInterpolate(pageTitle.value)}</span></div><div class="flex items-center gap-2"><div class="dropdown dropdown-end"><div tabindex="0" class="btn btn-ghost btn-sm btn-circle relative"><svg class="h-5 w-5 text-slate-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"></path></svg></div><div tabindex="0" class="dropdown-content z-[2] shadow-xl bg-white rounded-xl w-80 border" style="${ssrRenderStyle({ "max-height": "400px" })}"><div class="flex items-center justify-between px-4 py-3 border-b"><span class="text-sm font-semibold text-slate-700">系统通知</span></div><div class="px-3 py-6 text-center text-slate-400 text-xs">暂无新通知</div></div></div><div class="dropdown dropdown-end"><div tabindex="0" class="flex items-center gap-2 cursor-pointer hover:bg-slate-50 rounded-lg px-3 py-1.5"><div class="avatar placeholder"><div class="bg-indigo-600 text-white rounded-full w-8"><span class="text-sm">${ssrInterpolate(avatarChar.value)}</span></div></div><div><div class="text-sm text-slate-700 leading-tight">${ssrInterpolate(unref(auth).account)}</div><div class="text-[10px] text-slate-400">${ssrInterpolate(identityLabelShort.value)}</div></div></div><ul tabindex="0" class="dropdown-content z-[1] menu p-2 shadow-lg bg-white rounded-lg w-44 border"><li><a class="text-sm text-red-500 cursor-pointer">退出登录</a></li></ul></div></div></header>`);
_push(ssrRenderComponent(_component_AppToast, null, null, _parent));
_push(ssrRenderComponent(_component_AppLoading, null, null, _parent));
_push(`<div class="p-6">`);
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
_push(`</div></main></div>`);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("layouts/default.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=default-MHUXyMZu.mjs.map