feat: 完善后台设计语言细节
- 统一说明文案层级:Typography.Paragraph 次要文案迁移到 admin-section-description - 状态色补齐边框与中间调令牌,Alert/错误条/Descriptions 与 StatusTag 同源 - 咨询详情描述列表去表格线,改为键值展示并统一令牌 - 新增 BrandMark,侧栏与登录页标识改用品牌首字 - 信任内容改用列表行,空状态、表格骨架屏、主按钮脏检查落地 - design.md 同步令牌映射、切换控件选型与组件清单
This commit is contained in:
1 parent
2f26828f09
commit
3ef46b0aa8
25 files changed
+836
-393
No files matched your search
@@ -4,8 +4,10 @@ import type { AdminBooking, InquirySubmission } from "@personal-brand/api-client
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { useState } from "react";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { EmptyState } from "../../components/EmptyState.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { ErrorNote } from "../../components/QueryState.js";
|
||||
import { ListSkeleton, TableSkeleton } from "../../components/TableSkeleton.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../components/StatusTag.js";
|
||||
|
||||
@@ -125,52 +127,66 @@ export function InquiriesPage() {
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
rowKey="id"
|
||||
loading={query.isLoading}
|
||||
locale={{ emptyText: "还没有预约咨询。" }}
|
||||
dataSource={query.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: "bookingNo",
|
||||
render: (value: string, item: AdminBooking) => (
|
||||
<Button type="link" onClick={() => setSelectedId(item.id)}>
|
||||
{value}
|
||||
</Button>
|
||||
{query.isLoading && !query.data ? (
|
||||
<TableSkeleton />
|
||||
) : (
|
||||
<Table
|
||||
rowKey="id"
|
||||
locale={{
|
||||
emptyText: (
|
||||
<EmptyState
|
||||
compact
|
||||
title="还没有预约咨询"
|
||||
description="访客在小程序提交预约后,会出现在这里。"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "联系人", dataIndex: "customerName" },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: string) => (
|
||||
<StatusTag tone={statusTones[value] ?? "neutral"} label={labels[value] ?? value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: AdminBooking) => (
|
||||
<Space>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Button type="link" size="small" onClick={() => read.mutate(item.id)}>
|
||||
标记已读
|
||||
}}
|
||||
dataSource={query.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: "bookingNo",
|
||||
render: (value: string, item: AdminBooking) => (
|
||||
<Button type="link" onClick={() => setSelectedId(item.id)}>
|
||||
{value}
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "联系人", dataIndex: "customerName" },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: string) => (
|
||||
<StatusTag
|
||||
tone={statusTones[value] ?? "neutral"}
|
||||
label={labels[value] ?? value}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: AdminBooking) => (
|
||||
<Space>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Button type="link" size="small" onClick={() => read.mutate(item.id)}>
|
||||
标记已读
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Drawer
|
||||
title="咨询详情"
|
||||
open={Boolean(selectedId)}
|
||||
@@ -179,7 +195,7 @@ export function InquiriesPage() {
|
||||
width={520}
|
||||
>
|
||||
{detail.data && (
|
||||
<Descriptions column={1} bordered size="small">
|
||||
<Descriptions className="admin-descriptions" column={1} size="small">
|
||||
<Descriptions.Item label="编号">{detail.data.bookingNo}</Descriptions.Item>
|
||||
<Descriptions.Item label="联系人">{detail.data.customerName}</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
@@ -219,79 +235,90 @@ export function InquiriesPage() {
|
||||
options={inquiryStatuses.map((value) => ({ value, label: inquiryLabels[value] }))}
|
||||
/>
|
||||
</Space>
|
||||
<Table<InquirySubmission>
|
||||
rowKey="id"
|
||||
loading={submissions.isLoading}
|
||||
dataSource={(submissions.data ?? []).filter(
|
||||
(item) => !submissionStatus || item.status === submissionStatus,
|
||||
)}
|
||||
locale={{ emptyText: submissions.isLoading ? "加载中" : "暂无动态咨询提交" }}
|
||||
columns={[
|
||||
{ title: "表单", dataIndex: ["inquiryForm", "name"] },
|
||||
{
|
||||
title: "来源业务",
|
||||
dataIndex: ["offering", "name"],
|
||||
render: (value: string | null | undefined) => value || "品牌咨询",
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: InquirySubmission["status"]) => (
|
||||
<StatusTag
|
||||
tone={statusTones[value] ?? "neutral"}
|
||||
label={inquiryLabels[value] ?? value}
|
||||
{submissions.isLoading && !submissions.data ? (
|
||||
<ListSkeleton rows={3} />
|
||||
) : (
|
||||
<Table<InquirySubmission>
|
||||
rowKey="id"
|
||||
dataSource={(submissions.data ?? []).filter(
|
||||
(item) => !submissionStatus || item.status === submissionStatus,
|
||||
)}
|
||||
locale={{
|
||||
emptyText: (
|
||||
<EmptyState
|
||||
compact
|
||||
title="暂无动态咨询提交"
|
||||
description="按模板表单提交的咨询会汇总在这里。"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "版本", dataIndex: "formVersion", render: (value) => `v${value}` },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "内容",
|
||||
dataIndex: "values",
|
||||
render: (value: Record<string, unknown>) => {
|
||||
const entries = Object.entries(value ?? {});
|
||||
return entries.length
|
||||
? entries.map(([key, item]) => `${key}: ${String(item)}`).join(";")
|
||||
: "暂无内容";
|
||||
}}
|
||||
columns={[
|
||||
{ title: "表单", dataIndex: ["inquiryForm", "name"] },
|
||||
{
|
||||
title: "来源业务",
|
||||
dataIndex: ["offering", "name"],
|
||||
render: (value: string | null | undefined) => value || "品牌咨询",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "跟进",
|
||||
render: (_: unknown, item: InquirySubmission) => (
|
||||
<Space>
|
||||
<Button type="link" size="small" onClick={() => setSelectedSubmission(item)}>
|
||||
查看
|
||||
</Button>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
options={inquiryStatuses.map((value) => ({
|
||||
value,
|
||||
label: inquiryLabels[value],
|
||||
}))}
|
||||
onChange={(value) => updateSubmission.mutate({ id: item.id, status: value })}
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: InquirySubmission["status"]) => (
|
||||
<StatusTag
|
||||
tone={statusTones[value] ?? "neutral"}
|
||||
label={inquiryLabels[value] ?? value}
|
||||
/>
|
||||
<Input
|
||||
size="small"
|
||||
placeholder="备注"
|
||||
defaultValue={item.adminNote ?? ""}
|
||||
onPressEnter={(event) =>
|
||||
updateSubmission.mutate({
|
||||
id: item.id,
|
||||
status: item.status,
|
||||
adminNote: event.currentTarget.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "版本", dataIndex: "formVersion", render: (value) => `v${value}` },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "内容",
|
||||
dataIndex: "values",
|
||||
render: (value: Record<string, unknown>) => {
|
||||
const entries = Object.entries(value ?? {});
|
||||
return entries.length
|
||||
? entries.map(([key, item]) => `${key}: ${String(item)}`).join(";")
|
||||
: "暂无内容";
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "跟进",
|
||||
render: (_: unknown, item: InquirySubmission) => (
|
||||
<Space>
|
||||
<Button type="link" size="small" onClick={() => setSelectedSubmission(item)}>
|
||||
查看
|
||||
</Button>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
options={inquiryStatuses.map((value) => ({
|
||||
value,
|
||||
label: inquiryLabels[value],
|
||||
}))}
|
||||
onChange={(value) => updateSubmission.mutate({ id: item.id, status: value })}
|
||||
/>
|
||||
<Input
|
||||
size="small"
|
||||
placeholder="备注"
|
||||
defaultValue={item.adminNote ?? ""}
|
||||
onPressEnter={(event) =>
|
||||
updateSubmission.mutate({
|
||||
id: item.id,
|
||||
status: item.status,
|
||||
adminNote: event.currentTarget.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Drawer
|
||||
title="动态咨询详情"
|
||||
open={Boolean(selectedSubmission)}
|
||||
@@ -299,7 +326,7 @@ export function InquiriesPage() {
|
||||
width={520}
|
||||
>
|
||||
{selectedSubmission && (
|
||||
<Descriptions column={1} bordered size="small">
|
||||
<Descriptions className="admin-descriptions" column={1} size="small">
|
||||
<Descriptions.Item label="表单">
|
||||
{selectedSubmission.inquiryForm?.name || "品牌咨询"}
|
||||
</Descriptions.Item>
|
||||
|
||||
Reference in new issue
Block a user