feat: 接入模板组合预览
This commit is contained in:
1 parent
6c049b8672
commit
f9c63a6895
2 files changed
+49
No files matched your search
@@ -35,6 +35,8 @@ export function WorkspacePage() {
|
||||
description: string;
|
||||
capabilities: string[];
|
||||
} | null>(null);
|
||||
const [previewIndustry, setPreviewIndustry] = useState("personal");
|
||||
const [previewVisual, setPreviewVisual] = useState("linjing-editorial");
|
||||
const [form] = Form.useForm<Record<string, unknown>>();
|
||||
const [inquiryForm] = Form.useForm<Record<string, unknown>>();
|
||||
const query = useQuery({
|
||||
@@ -49,6 +51,11 @@ export function WorkspacePage() {
|
||||
queryKey: ["template-catalog"],
|
||||
queryFn: () => client.listPublicTemplates(),
|
||||
});
|
||||
const combinationPreview = useQuery({
|
||||
queryKey: ["template-combination-preview", previewIndustry, previewVisual],
|
||||
queryFn: () => client.previewPublicTemplateCombination(previewIndustry, previewVisual),
|
||||
enabled: Boolean(templateCatalog.data),
|
||||
});
|
||||
const visualTemplate = useMutation({
|
||||
mutationFn: (key: string) =>
|
||||
client.updateAdminBrand({
|
||||
@@ -356,6 +363,47 @@ export function WorkspacePage() {
|
||||
{industryTarget?.capabilities.join("、") || "无"}。
|
||||
</Typography.Paragraph>
|
||||
</Modal>
|
||||
<Card title="模板组合预览" style={{ marginBottom: 24 }}>
|
||||
<Space wrap>
|
||||
<Select
|
||||
value={previewIndustry}
|
||||
onChange={setPreviewIndustry}
|
||||
options={(templateCatalog.data?.industries ?? []).map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name,
|
||||
}))}
|
||||
/>
|
||||
<Select
|
||||
value={previewVisual}
|
||||
onChange={setPreviewVisual}
|
||||
options={(templateCatalog.data?.visuals ?? []).map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name,
|
||||
}))}
|
||||
/>
|
||||
</Space>
|
||||
{combinationPreview.isLoading ? (
|
||||
<Card loading style={{ marginTop: 16 }} />
|
||||
) : combinationPreview.data ? (
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 16 }}>
|
||||
<Typography.Text strong>
|
||||
{combinationPreview.data.industry.name} × {combinationPreview.data.visual.name}
|
||||
</Typography.Text>
|
||||
<Space wrap>
|
||||
{combinationPreview.data.runtime.modules.map((item) => (
|
||||
<Tag key={item.key}>
|
||||
{item.title} · {item.variant}
|
||||
</Tag>
|
||||
))}
|
||||
</Space>
|
||||
<Typography.Text type="secondary">
|
||||
能力:
|
||||
{combinationPreview.data.runtime.capabilities.map((item) => item.key).join("、") ||
|
||||
"无"}
|
||||
</Typography.Text>
|
||||
</Space>
|
||||
) : null}
|
||||
</Card>
|
||||
<Card
|
||||
title="动态咨询表单"
|
||||
extra={
|
||||
|
||||
Reference in new issue
Block a user