feat: 优化咨询表单配置体验
This commit is contained in:
1 parent
37e898a4b9
commit
2bc2193b44
4 files changed
+62
-14
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
# 执行记录
|
||||||
|
|
||||||
|
- 任务:降低普通品牌管理员创建和编辑咨询表单的理解成本。
|
||||||
|
- 形态:single-full
|
||||||
|
- 进度:3/3
|
||||||
|
- 结果:新增表单提供可直接使用的默认字段,编辑器文案和空状态已业务化,保存与发布边界明确。
|
||||||
|
- 验证:Admin production build、全量 typecheck、lint、format、`git diff --check` 通过。
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# 咨询表单编辑体验
|
||||||
|
|
||||||
|
## 目标
|
||||||
|
|
||||||
|
让普通品牌管理员能够从可用默认项开始创建咨询表单,并理解表单用途、关联业务和客户填写项的含义。
|
||||||
|
|
||||||
|
## 范围
|
||||||
|
|
||||||
|
- 新建表单预填合作咨询名称、称呼、联系电话和需求说明。
|
||||||
|
- 表单用途、关联业务、字段列表使用清楚的业务文案和辅助说明。
|
||||||
|
- 空列表提示如何开始;编辑已有表单前清理旧表单状态。
|
||||||
|
- 明确保存草稿后仍需在发布页发布才会对小程序生效。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||||
|
1,提供开箱可用的默认咨询表单,DONE,新建时预填称呼联系电话和需求说明字段,pnpm --filter @personal-brand/admin build,2026-09-27,0,
|
||||||
|
2,完善表单业务语义和状态提示,DONE,用途、业务关联、字段及草稿发布边界有清晰说明,pnpm --filter @personal-brand/admin build,2026-09-27,0,
|
||||||
|
3,完成质量门禁,DONE,Admin build、typecheck、lint、format 和 diff 检查通过,pnpm format:check,2026-09-27,0,
|
||||||
|
@@ -85,6 +85,19 @@ export function WorkspacePage() {
|
|||||||
const [previewVisual, setPreviewVisual] = useState("linjing-editorial");
|
const [previewVisual, setPreviewVisual] = useState("linjing-editorial");
|
||||||
const [form] = Form.useForm<Record<string, unknown>>();
|
const [form] = Form.useForm<Record<string, unknown>>();
|
||||||
const [inquiryForm] = Form.useForm<Record<string, unknown>>();
|
const [inquiryForm] = Form.useForm<Record<string, unknown>>();
|
||||||
|
const openNewInquiryForm = () => {
|
||||||
|
setEditingForm(null);
|
||||||
|
inquiryForm.setFieldsValue({
|
||||||
|
name: "合作咨询",
|
||||||
|
purpose: "inquiry",
|
||||||
|
fieldsSnapshot: [
|
||||||
|
{ key: "name", label: "您的称呼", type: "text", required: true },
|
||||||
|
{ key: "phone", label: "联系电话", type: "phone", required: true },
|
||||||
|
{ key: "remark", label: "想咨询什么", type: "textarea", required: false },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
setFormOpen(true);
|
||||||
|
};
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
queryKey: ["admin-workspace"],
|
queryKey: ["admin-workspace"],
|
||||||
queryFn: () => client.getAdminWorkspace(),
|
queryFn: () => client.getAdminWorkspace(),
|
||||||
@@ -496,14 +509,7 @@ export function WorkspacePage() {
|
|||||||
<Card
|
<Card
|
||||||
title="动态咨询表单"
|
title="动态咨询表单"
|
||||||
extra={
|
extra={
|
||||||
<Button
|
<Button type="primary" onClick={openNewInquiryForm}>
|
||||||
type="primary"
|
|
||||||
onClick={() => {
|
|
||||||
setEditingForm(null);
|
|
||||||
inquiryForm.resetFields();
|
|
||||||
setFormOpen(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
新增表单
|
新增表单
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
@@ -512,6 +518,7 @@ export function WorkspacePage() {
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={forms.isLoading}
|
loading={forms.isLoading}
|
||||||
dataSource={forms.data ?? []}
|
dataSource={forms.data ?? []}
|
||||||
|
locale={{ emptyText: "还没有咨询入口,点击右上角即可从默认表单开始。" }}
|
||||||
columns={[
|
columns={[
|
||||||
{ title: "名称", dataIndex: "name" },
|
{ title: "名称", dataIndex: "name" },
|
||||||
{ title: "版本", dataIndex: "version", render: (value) => <Tag>v{value}</Tag> },
|
{ title: "版本", dataIndex: "version", render: (value) => <Tag>v{value}</Tag> },
|
||||||
@@ -529,6 +536,7 @@ export function WorkspacePage() {
|
|||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setEditingForm(item);
|
setEditingForm(item);
|
||||||
|
inquiryForm.resetFields();
|
||||||
inquiryForm.setFieldsValue({
|
inquiryForm.setFieldsValue({
|
||||||
name: item.name,
|
name: item.name,
|
||||||
purpose: item.purpose,
|
purpose: item.purpose,
|
||||||
@@ -684,7 +692,11 @@ export function WorkspacePage() {
|
|||||||
}}
|
}}
|
||||||
onOk={() => inquiryForm.submit()}
|
onOk={() => inquiryForm.submit()}
|
||||||
confirmLoading={createForm.isPending || updateForm.isPending}
|
confirmLoading={createForm.isPending || updateForm.isPending}
|
||||||
|
width={760}
|
||||||
>
|
>
|
||||||
|
<Typography.Paragraph type="secondary">
|
||||||
|
先确定客户要提交的事情,再设置你希望客户填写的问题。保存后还需要在“配置与发布”中检查并发布,才会在小程序生效。
|
||||||
|
</Typography.Paragraph>
|
||||||
<Form
|
<Form
|
||||||
form={inquiryForm}
|
form={inquiryForm}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
@@ -721,11 +733,21 @@ export function WorkspacePage() {
|
|||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Form.Item name="name" label="表单名称" rules={[{ required: true }]}>
|
<Form.Item
|
||||||
<Input placeholder="例如:合作咨询" />
|
name="name"
|
||||||
|
label="这份表单叫什么"
|
||||||
|
help="客户会在小程序看到这个名称。"
|
||||||
|
rules={[{ required: true, message: "请填写表单名称" }]}
|
||||||
|
>
|
||||||
|
<Input placeholder="例如:预约上门测量、家庭聚餐预订" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Space style={{ display: "flex" }} align="start">
|
<Space style={{ display: "flex" }} align="start">
|
||||||
<Form.Item name="purpose" label="用途" initialValue="inquiry">
|
<Form.Item
|
||||||
|
name="purpose"
|
||||||
|
label="客户要做什么"
|
||||||
|
help="决定提交按钮和后续处理方式。"
|
||||||
|
initialValue="inquiry"
|
||||||
|
>
|
||||||
<Select
|
<Select
|
||||||
style={{ width: 160 }}
|
style={{ width: 160 }}
|
||||||
options={[
|
options={[
|
||||||
@@ -735,7 +757,7 @@ export function WorkspacePage() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="offeringId" label="关联业务">
|
<Form.Item name="offeringId" label="关联哪项业务" help="不选择表示这是品牌通用入口。">
|
||||||
<Select
|
<Select
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: 220 }}
|
style={{ width: 220 }}
|
||||||
@@ -750,7 +772,10 @@ export function WorkspacePage() {
|
|||||||
<Form.List name="fieldsSnapshot">
|
<Form.List name="fieldsSnapshot">
|
||||||
{(fields, { add, remove }) => (
|
{(fields, { add, remove }) => (
|
||||||
<>
|
<>
|
||||||
<Form.Item label="表单字段">
|
<Form.Item
|
||||||
|
label="客户需要填写什么"
|
||||||
|
help="建议保留称呼和联系电话,再添加与你的业务有关的问题。"
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
add({
|
add({
|
||||||
@@ -779,7 +804,7 @@ export function WorkspacePage() {
|
|||||||
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item {...restField} name={[name, "type"]} label="回答方式">
|
<Form.Item {...restField} name={[name, "type"]} label="回答方式">
|
||||||
<Select style={{ width: 130 }} options={inquiryFieldTypes} />
|
<Select style={{ width: 150 }} options={inquiryFieldTypes} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
Reference in new issue
Block a user