Initial import of WebUp Cloud

This commit is contained in:
WebUp Cloud committed 2026-11-07 13:31:14 +08:00
commit db82325ed7
216 files changed
+33718

No files matched your search

+297
View File
@@ -0,0 +1,297 @@
<script setup lang="ts">
import { ref, computed } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useSession } from "../store";
import {
ShieldCheck,
LayoutDashboard,
Users,
Code2,
Server,
Activity,
Settings2,
History,
LogOut,
ArrowUpRight,
Menu,
Cloud,
Globe,
LifeBuoy,
Puzzle,
} from "lucide-vue-next";
const store = useSession(),
route = useRoute(),
router = useRouter(),
mobile = ref(false);
const links = [
{
to: "/admin/overview",
name: "运营总览",
icon: LayoutDashboard,
permission: "",
},
{
to: "/admin/extensions",
name: "插件与主题",
icon: Puzzle,
permission: "extensions:manage",
},
{
to: "/admin/tickets",
name: "工单管理",
icon: LifeBuoy,
permission: "tickets:manage",
},
{
to: "/admin/domains",
name: "域名与 HTTPS",
icon: Globe,
permission: "domains:write",
},
{
to: "/admin/sites",
name: "网站管理 / 人工审核",
icon: Server,
permission: "hosting:write|moderation:write|users:read",
},
{
to: "/admin/nodes",
name: "服务器与节点",
icon: Server,
permission: "nodes:write",
},
{
to: "/admin/integrations",
name: "邮件 / 短信 / CDN / ESA",
icon: Cloud,
permission: "integrations:write",
},
{
to: "/admin/users",
name: "用户管理",
icon: Users,
permission: "users:read",
},
{
to: "/admin/models",
name: "模型与供应商",
icon: Code2,
permission: "models:write",
},
{
to: "/admin/tasks",
name: "开发任务运营",
icon: Activity,
permission: "tasks:manage|finance:write|audit:read",
},
{
to: "/admin/plans",
name: "托管套餐",
icon: Server,
permission: "finance:write",
},
{
to: "/admin/settings",
name: "系统设置",
icon: Settings2,
permission: "settings:write",
},
{
to: "/admin/audit",
name: "操作审计",
icon: History,
permission: "audit:read",
},
];
const visible = computed(() =>
links.filter(
(l) =>
!l.permission ||
l.permission.split("|").some((p) => store.user?.permissions.includes(p)),
),
);
async function logout() {
try {
await store.logout();
} finally {
router.push("/admin/login");
}
}
</script>
<template>
<div class="shell admin-portal">
<aside :class="{ open: mobile }">
<RouterLink to="/admin/overview" class="brand"
><img
v-if="store.settings.logoUrl"
:src="store.settings.logoUrl"
alt="WebUp Logo"
/><span v-else class="admin-brand-icon"
><ShieldCheck :size="22"
/></span>
<div>
<strong>{{ store.settings.siteName || "平台管理" }}</strong
><small>ADMIN CONSOLE</small>
</div></RouterLink
>
<div class="admin-space">
<span class="avatar">{{ store.user?.displayName.slice(0, 1) }}</span>
<div>
<b>{{ store.user?.displayName }}</b
><small>{{ store.user?.email }}</small>
</div>
</div>
<p class="nav-label">管理中心</p>
<nav>
<RouterLink
v-for="l in visible"
:key="l.to"
:to="l.to"
:class="{
active:
route.path === l.to ||
(l.to === '/admin/tickets' && route.path.startsWith(l.to + '/')),
}"
@click="mobile = false"
><component :is="l.icon" :size="18" />{{ l.name }}</RouterLink
>
</nav>
<div class="sidebar-bottom">
<div class="admin-security">
<ShieldCheck :size="18" />
<p>管理操作由后端校验权限<br />敏感变更记录审计日志</p>
</div>
<RouterLink to="/console" class="logout"
><ArrowUpRight :size="17" />进入用户工作台</RouterLink
><RouterLink to="/" class="logout"
><Cloud :size="17" />返回网站首页</RouterLink
><button class="logout" @click="logout">
<LogOut :size="17" />退出管理员登录
</button>
</div>
</aside>
<div class="main-wrap">
<header>
<div class="breadcrumb">
<button
class="icon-button"
@click="mobile = !mobile"
aria-label="切换管理导航"
>
<Menu :size="18" /></button
><span>管理后台</span><span>/</span
><b>{{
links.find(
(l) =>
route.path === l.to ||
(l.to === "/admin/tickets" &&
route.path.startsWith(l.to + "/")),
)?.name || "平台管理"
}}</b>
</div>
<span class="badge"><ShieldCheck :size="14" />管理员专用</span>
</header>
<main>
<div v-if="store.settings.previewMode === 'true'" class="alert info">
本地测试管理后台 · 独立测试数据库,测试余额非真实资金。
</div>
<slot />
</main>
<footer>
<span>{{ store.settings.siteName }} · 平台管理</span
><span>RBAC 权限控制 · 操作可追溯</span>
</footer>
</div>
</div>
</template>
<style scoped>
.admin-portal > aside {
background: #17243d;
border-right: 0;
color: #eef3ff;
}
.admin-portal .brand {
gap: 11px;
}
.admin-portal .brand strong {
font-size: 16px;
max-width: 155px;
display: block;
}
.brand small {
display: block;
letter-spacing: 2px;
font-size: 8px;
color: #8195b5;
margin-top: 5px;
}
.admin-brand-icon {
width: 36px;
height: 36px;
background: #2c436a;
display: grid;
place-items: center;
border-radius: 10px;
color: #a3bdff;
}
.admin-space {
display: flex;
gap: 10px;
align-items: center;
padding: 18px 10px;
margin: 27px 0 24px;
border-top: 1px solid #2a3750;
border-bottom: 1px solid #2a3750;
min-width: 0;
}
.admin-space > div {
min-width: 0;
}
.admin-space b {
font-size: 11px;
}
.admin-space small {
display: block;
font-size: 9px;
color: #8598b8;
overflow: hidden;
text-overflow: ellipsis;
}
.admin-space .avatar {
background: #314568;
border-color: #425a83;
color: #b2c5e8;
}
.nav-label {
color: #6d83a6;
}
.admin-portal nav > a {
color: #9bacc7;
}
.admin-portal nav > a:hover {
background: #233655;
color: #eef3ff;
}
.admin-portal nav > a.active {
background: #2d4875;
color: #e7efff;
}
.admin-portal .logout {
color: #95a9c8;
font-size: 10px;
padding: 12px;
}
.admin-security {
padding: 16px 12px;
display: flex;
gap: 10px;
color: #7189b1;
}
.admin-security p {
font-size: 9px;
line-height: 1.8;
}
.admin-security svg {
flex-shrink: 0;
}
</style>