feat: 打通业务与页面编辑入口
This commit is contained in:
1 parent
d0ef25cfb3
commit
20eb160abf
3 files changed
+32
-5
No files matched your search
@@ -14,6 +14,7 @@ import {
|
||||
} from "antd";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import type {
|
||||
Offering,
|
||||
TemplateAdminField,
|
||||
@@ -41,6 +42,7 @@ export interface RecordContentEditorProps {
|
||||
context: "visual" | "services";
|
||||
onDraft?: (values: PresentationValues) => void;
|
||||
onSaved?: () => void;
|
||||
visualSelection?: { targetKey: string; page: string };
|
||||
}
|
||||
|
||||
function renderField(field: TemplateAdminField) {
|
||||
@@ -103,7 +105,9 @@ export function RecordContentEditor({
|
||||
context,
|
||||
onDraft,
|
||||
onSaved,
|
||||
visualSelection,
|
||||
}: RecordContentEditorProps) {
|
||||
const navigate = useNavigate();
|
||||
const [form] = Form.useForm<PresentationValues>();
|
||||
const queryClient = useQueryClient();
|
||||
const recordName = "name" in record ? record.name : record.title;
|
||||
@@ -183,9 +187,26 @@ export function RecordContentEditor({
|
||||
</div>
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
||||
<MutationError error={save.error} />
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||
保存此项内容
|
||||
</Button>
|
||||
<Space wrap>
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||
保存此项内容
|
||||
</Button>
|
||||
{source === "offering" ? (
|
||||
<Button
|
||||
htmlType="button"
|
||||
onClick={() =>
|
||||
navigate("/admin/brand", {
|
||||
state: {
|
||||
targetKey: visualSelection?.targetKey ?? "linjing-editorial.offerings.item",
|
||||
recordId: record.id,
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
在小程序页面编辑
|
||||
</Button>
|
||||
) : null}
|
||||
</Space>
|
||||
</Space>
|
||||
</Form>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user