+ {/* 头部 */}
+
+
+
设计中心
+
+ 集中管理 {total} 个功能页面的低代码设计 · 点「设计」在新标签页打开设计器
+
+
+
+
+ setQ(e.target.value)}
+ placeholder="搜索页面名称 / 路径 / 模板ID…"
+ data-testid="design-center-search"
+ />
+ {q ? (
+ setQ('')}>
+ 清除
+
+ ) : null}
+
+
+
+ {loading ? (
+
加载中…
+ ) : error ? (
+
菜单加载失败:{error}
+ ) : (
+ <>
+ {q ? (
+
+ 命中 {shown} 个页面
+
+ ) : null}
+ {filtered.map((g) => (
+
+
+ {g.root}
+ {g.leaves.length}
+
+
+ {g.leaves.map((l) => (
+
+
+
+ {l.name}
+
+
+ {l.path || l.templateId}
+
+
+
+
+ ))}
+
+
+ ))}
+ {filtered.length === 0 ? (
+
没有匹配的页面
+ ) : null}
+ >
+ )}
+
+ );
+}
diff --git a/src/pages/PageRenderPage.tsx b/src/pages/PageRenderPage.tsx
index e8c8171..97d51cd 100644
--- a/src/pages/PageRenderPage.tsx
+++ b/src/pages/PageRenderPage.tsx
@@ -8,7 +8,6 @@ import { fetchSchema } from '../api/schema';
import { AmisRenderer } from '../components/AmisRenderer';
import { recordRecentPage } from '../utils/recentPages';
import { useTabTitle } from '../shell/TabTitleContext';
-import { getProfile } from '../auth/token';
// ---- amis 渲染层错误边界(class component,捕获子树抛错)----
interface ErrorBoundaryState {
@@ -71,36 +70,6 @@ function SchemaErrorCard({ templateId, summary }: { templateId: string; summary:
);
}
-// ---- 管理员设计按钮 ----
-function DesignButton({ templateId }: { templateId: string }) {
- const profile = getProfile();
- const isAdmin = profile?.account === 'admin' || profile?.userId === 'ADMIN';
- if (!isAdmin) return null;
- return (
-
-
+ {/* 设计入口已收敛到顶栏「设计中心」(admin),不再每页一颗按钮 */}
diff --git a/src/shell/Topbar.tsx b/src/shell/Topbar.tsx
index 2be7bf2..a063959 100644
--- a/src/shell/Topbar.tsx
+++ b/src/shell/Topbar.tsx
@@ -1,5 +1,6 @@
// Topbar — 顶栏:品牌 + 搜索 + 待办入口 + 用户信息 + 设置入口
// 从原型 frame.jsx Topbar 迁移,待办 badge 数由父层传入(后续可接真实 API)
+import { useNavigate } from 'react-router-dom';
import { Icon } from '../components/ui/Icon';
import { GlobalSearch } from './GlobalSearch';
import type { MenuLeaf } from '../api/menu';
@@ -28,6 +29,8 @@ export function Topbar({
}: TopbarProps) {
// 用户名显示:取 name 首字作头像
const avatarChar = profile?.name?.[0] ?? '?';
+ const navigate = useNavigate();
+ const isAdmin = profile?.account === 'admin' || profile?.userId === 'ADMIN';
return (
@@ -63,6 +66,18 @@ export function Topbar({
) : null}
+ {/* 设计中心(管理员)—— 集中式低代码设计入口,替代每页设计按钮 */}
+ {isAdmin ? (
+
+ ) : null}
+
{/* 设置 */}