feat: 支持后台切换视觉模板
This commit is contained in:
1 parent
65f0e0c92a
commit
4a6cd3adc6
3 files changed
+37
No files matched your search
@@ -38,6 +38,17 @@ export function WorkspacePage() {
|
|||||||
queryKey: ["public-runtime-workspace"],
|
queryKey: ["public-runtime-workspace"],
|
||||||
queryFn: () => client.getPublicWorkspace(),
|
queryFn: () => client.getPublicWorkspace(),
|
||||||
});
|
});
|
||||||
|
const visualTemplate = useMutation({
|
||||||
|
mutationFn: (key: string) =>
|
||||||
|
client.updateAdminBrand({
|
||||||
|
config: { ...(runtimeQuery.data?.brand?.config ?? {}), visualTemplateKey: key },
|
||||||
|
}),
|
||||||
|
onSuccess: () => {
|
||||||
|
message.success("视觉模板已切换");
|
||||||
|
void runtimeQuery.refetch();
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ["admin-brand"] });
|
||||||
|
},
|
||||||
|
});
|
||||||
const install = useMutation({
|
const install = useMutation({
|
||||||
mutationFn: (key: "personal" | "food") => client.installAdminTemplate(key),
|
mutationFn: (key: "personal" | "food") => client.installAdminTemplate(key),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -157,6 +168,25 @@ export function WorkspacePage() {
|
|||||||
小程序和后台预览消费同一份 Runtime Workspace;模板 key
|
小程序和后台预览消费同一份 Runtime Workspace;模板 key
|
||||||
只用于安装和版本管理,不作为客户端业务分支。
|
只用于安装和版本管理,不作为客户端业务分支。
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
|
<Space wrap>
|
||||||
|
<Typography.Text strong>视觉模板</Typography.Text>
|
||||||
|
<Select
|
||||||
|
value={runtimeQuery.data?.visualTemplate?.key ?? "linjing-editorial"}
|
||||||
|
loading={visualTemplate.isPending}
|
||||||
|
onChange={(key) => visualTemplate.mutate(key)}
|
||||||
|
options={[
|
||||||
|
{ value: "linjing-editorial", label: "林境建筑画册" },
|
||||||
|
{ value: "minimal-neutral", label: "极简留白" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
{runtimeQuery.data?.visualTemplate && (
|
||||||
|
<Tag>
|
||||||
|
v{runtimeQuery.data.visualTemplate.version} ·{" "}
|
||||||
|
{Object.values(runtimeQuery.data.visualTemplate.variants).join(" / ")}
|
||||||
|
</Tag>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
<MutationError error={visualTemplate.error} />
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
- [ ] Phase 3:模板中心、安装快照、升级和回滚。
|
- [ ] Phase 3:模板中心、安装快照、升级和回滚。
|
||||||
- [x] 建立行业模板与视觉模板注册表,并注册林境建筑画册与极简留白视觉模板。
|
- [x] 建立行业模板与视觉模板注册表,并注册林境建筑画册与极简留白视觉模板。
|
||||||
- [x] Runtime Workspace 合并品牌配置中的视觉模板主题、版本和模块变体。
|
- [x] Runtime Workspace 合并品牌配置中的视觉模板主题、版本和模块变体。
|
||||||
|
- [x] Admin 工作空间支持切换视觉模板并保存 `visualTemplateKey`。
|
||||||
- [ ] Phase 4:Capability Plugin。
|
- [ ] Phase 4:Capability Plugin。
|
||||||
- [ ] Phase 5:林境门作与第二行业双模板验证。
|
- [ ] Phase 5:林境门作与第二行业双模板验证。
|
||||||
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。
|
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。
|
||||||
|
|||||||
@@ -380,6 +380,12 @@ export class ApiClient {
|
|||||||
}
|
}
|
||||||
getAdminWorkspace(): Promise<{
|
getAdminWorkspace(): Promise<{
|
||||||
brand: BrandProfile;
|
brand: BrandProfile;
|
||||||
|
visualTemplate?: {
|
||||||
|
key: string;
|
||||||
|
version: string;
|
||||||
|
name: string;
|
||||||
|
variants: Record<string, string>;
|
||||||
|
} | null;
|
||||||
installations: unknown[];
|
installations: unknown[];
|
||||||
modules: BrandModule[];
|
modules: BrandModule[];
|
||||||
fields: BrandFieldDefinition[];
|
fields: BrandFieldDefinition[];
|
||||||
|
|||||||
Reference in new issue
Block a user