feat: 统一 Admin 后台设计语言
用中性灰底 + 单一强调色重做后台视觉,并集中到一套令牌: - 新增 apps/admin/src/lib/theme.ts,通过 ConfigProvider 注入主题令牌 - 新增 apps/admin/src/styles/admin.css 与 AdminSection、MetricCard、StatusTag 组件 - 侧栏改白底浅色并补图标,顶栏改 56px 白底,内容区最大宽 1200px - 全部页面接入状态标签,antd 原生彩色 Tag 与内联色值清零 - 登录与改密页、加载态骨架屏、错误提示条统一 - brand 页两个 Tab 统一为白卡片容器,消除双标题与宽度不一致 设计规范见 apps/admin/design.md。
This commit is contained in:
1 parent
bb94d80e13
commit
2f26828f09
34 files changed
+2159
-922
No files matched your search
+127
-99
@@ -6,17 +6,31 @@ import {
|
||||
App,
|
||||
Button,
|
||||
Card,
|
||||
ConfigProvider,
|
||||
Form,
|
||||
Input,
|
||||
Layout,
|
||||
Menu,
|
||||
Select,
|
||||
Space,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import zhCN from "antd/locale/zh_CN";
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
BarsOutlined,
|
||||
CloudUploadOutlined,
|
||||
MessageOutlined,
|
||||
MobileOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
SettingOutlined,
|
||||
TeamOutlined,
|
||||
ThunderboltOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { createApiClient } from "./lib/api.js";
|
||||
import { adminTheme } from "./lib/theme.js";
|
||||
import { LoadingStack } from "./components/QueryState.js";
|
||||
import { StatusTag } from "./components/StatusTag.js";
|
||||
import "./styles/admin.css";
|
||||
const FeatureInquiriesPage = React.lazy(() =>
|
||||
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
||||
default: module.InquiriesPage,
|
||||
@@ -88,19 +102,27 @@ function Login({
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Card title="个人品牌后台" style={{ maxWidth: 420, margin: "120px auto" }}>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="username" label="账号" initialValue="admin" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="password" label="密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
||||
登录
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
<div className="admin-auth">
|
||||
<Card className="admin-auth-card">
|
||||
<div className="admin-auth-brand">
|
||||
<span className="admin-sider-brand-mark">品</span>
|
||||
<span className="admin-header-brand">个人品牌后台</span>
|
||||
</div>
|
||||
<p className="admin-auth-hint">管理你的品牌表达、内容发布与客户咨询。</p>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="username" label="账号" initialValue="admin" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="password" label="密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" size="large" htmlType="submit" loading={loading} block>
|
||||
登录
|
||||
</Button>
|
||||
</Form>
|
||||
<p className="admin-auth-footnote">仅限授权成员访问。</p>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -133,27 +155,33 @@ function ChangePassword({ onComplete }: { onComplete: () => void }) {
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Card title="首次登录需要修改密码" style={{ maxWidth: 420, margin: "120px auto" }}>
|
||||
<Typography.Paragraph type="secondary">请先设置只有你本人知道的新密码。</Typography.Paragraph>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
rules={[{ required: true, min: 8, message: "请输入至少 8 位新密码" }]}
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
||||
保存新密码
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
<div className="admin-auth">
|
||||
<Card className="admin-auth-card">
|
||||
<div className="admin-auth-brand">
|
||||
<span className="admin-sider-brand-mark">品</span>
|
||||
<span className="admin-header-brand">首次登录需要修改密码</span>
|
||||
</div>
|
||||
<p className="admin-auth-hint">请先设置只有你本人知道的新密码。</p>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
rules={[{ required: true, min: 8, message: "请输入至少 8 位新密码" }]}
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" size="large" htmlType="submit" loading={loading} block>
|
||||
保存新密码
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -183,12 +211,12 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
type: "group" as const,
|
||||
label: "日常经营",
|
||||
children: [
|
||||
{ key: "overview", label: "当前品牌概览" },
|
||||
{ key: "publication", label: "配置与发布" },
|
||||
{ key: "brand", label: "小程序页面" },
|
||||
{ key: "trust", label: "信任内容" },
|
||||
{ key: "services", label: "业务提供项" },
|
||||
{ key: "inquiries", label: "咨询记录" },
|
||||
{ key: "overview", label: "当前品牌概览", icon: <AppstoreOutlined /> },
|
||||
{ key: "publication", label: "配置与发布", icon: <CloudUploadOutlined /> },
|
||||
{ key: "brand", label: "小程序页面", icon: <MobileOutlined /> },
|
||||
{ key: "trust", label: "信任内容", icon: <SafetyCertificateOutlined /> },
|
||||
{ key: "services", label: "业务提供项", icon: <BarsOutlined /> },
|
||||
{ key: "inquiries", label: "咨询记录", icon: <MessageOutlined /> },
|
||||
],
|
||||
},
|
||||
...(role === "editor"
|
||||
@@ -198,43 +226,39 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
type: "group" as const,
|
||||
label: "系统管理",
|
||||
children: [
|
||||
{ key: "workspace", label: "模板与表单设置" },
|
||||
{ key: "capabilities", label: "能力插件" },
|
||||
{ key: "members", label: "团队成员" },
|
||||
{ key: "workspace", label: "模板与表单设置", icon: <SettingOutlined /> },
|
||||
{ key: "capabilities", label: "能力插件", icon: <ThunderboltOutlined /> },
|
||||
{ key: "members", label: "团队成员", icon: <TeamOutlined /> },
|
||||
],
|
||||
},
|
||||
]),
|
||||
];
|
||||
return (
|
||||
<Layout style={{ minHeight: "100vh" }}>
|
||||
<Layout.Sider breakpoint="lg" collapsedWidth={0}>
|
||||
<Typography.Title level={4} style={{ color: "white", padding: 20 }}>
|
||||
当前品牌工作区
|
||||
</Typography.Title>
|
||||
<Layout className="admin-shell">
|
||||
<Layout.Sider className="admin-sider" breakpoint="lg" collapsedWidth={0} width={232}>
|
||||
<div className="admin-sider-brand">
|
||||
<span className="admin-sider-brand-mark">品</span>
|
||||
<span className="admin-sider-brand-name">品牌工作区</span>
|
||||
</div>
|
||||
<Menu
|
||||
theme="dark"
|
||||
selectedKeys={[page]}
|
||||
onClick={({ key }) => navigate(`/admin/${key}`)}
|
||||
items={items}
|
||||
/>
|
||||
</Layout.Sider>
|
||||
<Layout>
|
||||
<Layout.Header
|
||||
style={{
|
||||
background: "white",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Space>
|
||||
<Typography.Text strong>{brand.data?.name || "当前品牌"}</Typography.Text>
|
||||
<Typography.Text type="secondary">品牌工作区</Typography.Text>
|
||||
<Tag color={role === "owner" ? "blue" : "default"}>
|
||||
{role === "owner" ? "负责人" : "内容编辑"}
|
||||
</Tag>
|
||||
<Layout className="admin-main">
|
||||
<Layout.Header className="admin-header">
|
||||
<div className="admin-header-left">
|
||||
<span className="admin-header-brand">{brand.data?.name || "当前品牌"}</span>
|
||||
<span className="admin-header-context">品牌工作区</span>
|
||||
<StatusTag
|
||||
tone={role === "owner" ? "info" : "neutral"}
|
||||
label={role === "owner" ? "负责人" : "内容编辑"}
|
||||
/>
|
||||
<Select
|
||||
size="small"
|
||||
variant="outlined"
|
||||
className="admin-brand-switcher"
|
||||
value={brand.data?.id}
|
||||
loading={memberships.isLoading}
|
||||
onChange={(value) => {
|
||||
@@ -245,35 +269,37 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
label: item.brand.name,
|
||||
}))}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
<Button type="text" onClick={onLogout}>
|
||||
退出登录
|
||||
</Button>
|
||||
</Layout.Header>
|
||||
<Layout.Content style={{ padding: 24 }}>
|
||||
<Suspense fallback={<Card loading />}>
|
||||
<Routes>
|
||||
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
||||
<Route
|
||||
path="/admin/publication"
|
||||
element={<FeaturePublicationPage canManageTemplate={role !== "editor"} />}
|
||||
/>
|
||||
<Route path="/admin/brand" element={<FeatureBrandPage />} />
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/workspace" element={<FeatureWorkspacePage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/members" element={<FeatureMembersPage />} />
|
||||
)}
|
||||
<Route path="/admin/trust" element={<FeatureTrustContentPage />} />
|
||||
<Route path="/admin/services" element={<FeatureServicesPage />} />
|
||||
<Route path="/admin/inquiries" element={<FeatureInquiriesPage />} />
|
||||
<Route path="*" element={<Navigate to="/admin/overview" replace />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
<Layout.Content className="admin-content">
|
||||
<div className="admin-content-inner">
|
||||
<Suspense fallback={<LoadingStack />}>
|
||||
<Routes>
|
||||
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
||||
<Route
|
||||
path="/admin/publication"
|
||||
element={<FeaturePublicationPage canManageTemplate={role !== "editor"} />}
|
||||
/>
|
||||
<Route path="/admin/brand" element={<FeatureBrandPage />} />
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/workspace" element={<FeatureWorkspacePage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/members" element={<FeatureMembersPage />} />
|
||||
)}
|
||||
<Route path="/admin/trust" element={<FeatureTrustContentPage />} />
|
||||
<Route path="/admin/services" element={<FeatureServicesPage />} />
|
||||
<Route path="/admin/inquiries" element={<FeatureInquiriesPage />} />
|
||||
<Route path="*" element={<Navigate to="/admin/overview" replace />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</div>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
@@ -315,12 +341,14 @@ function Root() {
|
||||
}
|
||||
createRoot(document.getElementById("app")!).render(
|
||||
<React.StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<App>
|
||||
<BrowserRouter>
|
||||
<Root />
|
||||
</BrowserRouter>
|
||||
</App>
|
||||
</QueryClientProvider>
|
||||
<ConfigProvider locale={zhCN} theme={adminTheme}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<App>
|
||||
<BrowserRouter>
|
||||
<Root />
|
||||
</BrowserRouter>
|
||||
</App>
|
||||
</QueryClientProvider>
|
||||
</ConfigProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
Reference in new issue
Block a user