feat: 拆分发布中心内容和小程序标签页
This commit is contained in:
1 parent
3d0252d187
commit
ab1531d9b0
1 file changed
+302
-270
@@ -13,6 +13,7 @@ import {
|
||||
Space,
|
||||
Spin,
|
||||
Tag,
|
||||
Tabs,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
@@ -44,6 +45,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
const [settingsAppId, setSettingsAppId] = useState("");
|
||||
const [settingsArtifactPath, setSettingsArtifactPath] = useState("");
|
||||
const [settingsPrivateKey, setSettingsPrivateKey] = useState("");
|
||||
const [activeTab, setActiveTab] = useState("content");
|
||||
const brand = useQuery({
|
||||
queryKey: ["publication-brand"],
|
||||
queryFn: () => client.getAdminBrand(),
|
||||
@@ -157,7 +159,6 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
mutationFn: (values: { appId?: string; artifactPath?: string; privateKey?: string }) =>
|
||||
client.updateAdminMiniAppSettings(values),
|
||||
onSuccess: () => {
|
||||
setSettingsOpen(false);
|
||||
message.success("小程序上传配置已保存");
|
||||
void miniAppSettings.refetch();
|
||||
},
|
||||
@@ -185,9 +186,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
const loading = [brand, workspace, catalog, readiness, releases, miniAppReleases].some(
|
||||
(query) => query.isLoading,
|
||||
);
|
||||
const error = [brand, workspace, catalog, readiness, releases, miniAppReleases].find(
|
||||
(query) => query.isError,
|
||||
)?.error;
|
||||
const error = [
|
||||
brand,
|
||||
workspace,
|
||||
catalog,
|
||||
readiness,
|
||||
releases,
|
||||
miniAppReleases,
|
||||
miniAppSettings,
|
||||
].find((query) => query.isError)?.error;
|
||||
const retry = () => {
|
||||
void brand.refetch();
|
||||
void workspace.refetch();
|
||||
@@ -212,12 +219,13 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
? brand.data.config.visualTemplateKey
|
||||
: (visuals[0]?.key ?? null);
|
||||
const currentRelease = releases.data?.find((item) => item.status === "published");
|
||||
const settings = miniAppSettings.data;
|
||||
useEffect(() => {
|
||||
if (!miniAppSettings.data) return;
|
||||
setSettingsAppId(miniAppSettings.data.appId);
|
||||
setSettingsArtifactPath(miniAppSettings.data.artifactPath);
|
||||
setSettingsPrivateKey("");
|
||||
}, [miniAppSettings.data]);
|
||||
}, [settings]);
|
||||
const publishedHistory = (releases.data ?? []).filter(
|
||||
(item) => item.status === "published" || item.status === "superseded",
|
||||
);
|
||||
@@ -228,293 +236,317 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
isEnabled: boolean;
|
||||
}>;
|
||||
|
||||
const contentTab = <Space direction="vertical" size={24} style={{ width: "100%" }}></Space>;
|
||||
const miniAppTab = <Space direction="vertical" size={24} style={{ width: "100%" }}></Space>;
|
||||
|
||||
return (
|
||||
<QueryState loading={loading} error={error} onRetry={retry}>
|
||||
<AdminPageHeader
|
||||
title="配置与发布"
|
||||
description="编辑内容不会立即影响小程序;确认后统一发布当前品牌。"
|
||||
/>
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>1. 选择表达方式</Typography.Title>
|
||||
<Space wrap>
|
||||
<Select
|
||||
aria-label="行业模板"
|
||||
style={{ width: 220 }}
|
||||
value={industryKey}
|
||||
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
||||
options={(catalog.data?.industries ?? []).map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name,
|
||||
}))}
|
||||
onChange={(key: BrandTemplateKey) => setIndustryTarget(key)}
|
||||
/>
|
||||
<Select
|
||||
aria-label="视觉模板"
|
||||
style={{ width: 220 }}
|
||||
value={visualKey}
|
||||
disabled={!canManageTemplate}
|
||||
loading={selectVisual.isPending}
|
||||
options={visuals.map((item) => ({ value: item.key, label: item.name }))}
|
||||
onChange={(key) => selectVisual.mutate(key)}
|
||||
/>
|
||||
{canManageTemplate && (
|
||||
<Button onClick={() => navigate("/admin/workspace")}>高级模板设置</Button>
|
||||
)}
|
||||
</Space>
|
||||
{workspace.data?.installations.length ? (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
<MutationError error={install.error || selectVisual.error} />
|
||||
<Divider />
|
||||
<Space wrap>
|
||||
<Typography.Text>示例内容</Typography.Text>
|
||||
{sample.isLoading && <Spin size="small" />}
|
||||
{sample.data && (
|
||||
<Tag color={sample.data.alreadyImported ? "green" : "blue"}>
|
||||
{sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
</Tag>
|
||||
)}
|
||||
<Button
|
||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
||||
loading={importSample.isPending}
|
||||
onClick={() => importSample.mutate()}
|
||||
>
|
||||
导入示例内容
|
||||
</Button>
|
||||
{sample.isError && <Button onClick={() => void sample.refetch()}>重试</Button>}
|
||||
</Space>
|
||||
{sample.isError && (
|
||||
<Alert
|
||||
type="error"
|
||||
message={sample.error instanceof Error ? sample.error.message : "示例内容加载失败"}
|
||||
showIcon
|
||||
style={{ marginTop: 8 }}
|
||||
/>
|
||||
)}
|
||||
{sample.data && !sample.data.alreadyImported && (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
将向草稿添加{" "}
|
||||
{Object.entries(sample.data.counts)
|
||||
.map(([key, count]) => `${key} ${count} 项`)
|
||||
.join("、")}
|
||||
;发布前请替换示例文案和图片。
|
||||
</Typography.Paragraph>
|
||||
)}
|
||||
<MutationError error={importSample.error} />
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Typography.Title level={4}>2. 核对草稿内容</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
此处核对的是待发布内容,不是小程序视觉预览。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>{brand.data?.name || "未命名品牌"}</Typography.Text>
|
||||
<Typography.Text>{brand.data?.tagline || "尚未填写品牌定位"}</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用业务项:{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用咨询表单:
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
items={[
|
||||
{ key: "content", label: "内容发布", children: contentTab },
|
||||
{ key: "miniapp", label: "小程序发布", children: miniAppTab },
|
||||
]}
|
||||
/>
|
||||
{activeTab === "content" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>1. 选择表达方式</Typography.Title>
|
||||
<Space wrap>
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑小程序页面</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务展示和详情</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任证明</Button>
|
||||
<Select
|
||||
aria-label="行业模板"
|
||||
style={{ width: 220 }}
|
||||
value={industryKey}
|
||||
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
||||
options={(catalog.data?.industries ?? []).map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name,
|
||||
}))}
|
||||
onChange={(key: BrandTemplateKey) => setIndustryTarget(key)}
|
||||
/>
|
||||
<Select
|
||||
aria-label="视觉模板"
|
||||
style={{ width: 220 }}
|
||||
value={visualKey}
|
||||
disabled={!canManageTemplate}
|
||||
loading={selectVisual.isPending}
|
||||
options={visuals.map((item) => ({ value: item.key, label: item.name }))}
|
||||
onChange={(key) => selectVisual.mutate(key)}
|
||||
/>
|
||||
{canManageTemplate && (
|
||||
<Button onClick={() => navigate("/admin/workspace")}>高级模板设置</Button>
|
||||
)}
|
||||
</Space>
|
||||
</Space>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Typography.Title level={4}>3. 检查并发布</Typography.Title>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Tag color={currentRelease ? "green" : "default"}>
|
||||
{currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
</Tag>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{(readiness.data?.checks ?? []).map((check) => (
|
||||
<Space key={check.key}>
|
||||
<Tag color={check.passed ? "success" : "warning"}>
|
||||
{check.passed ? "已完成" : "待完善"}
|
||||
{workspace.data?.installations.length ? (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
<MutationError error={install.error || selectVisual.error} />
|
||||
<Divider />
|
||||
<Space wrap>
|
||||
<Typography.Text>示例内容</Typography.Text>
|
||||
{sample.isLoading && <Spin size="small" />}
|
||||
{sample.data && (
|
||||
<Tag color={sample.data.alreadyImported ? "green" : "blue"}>
|
||||
{sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
</Tag>
|
||||
<Typography.Text>{check.label}</Typography.Text>
|
||||
{check.help ? (
|
||||
<Typography.Text type="secondary">{check.help}</Typography.Text>
|
||||
) : null}
|
||||
{!check.passed && (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() =>
|
||||
navigate(check.destination ?? destinations[check.key] ?? "/admin/overview")
|
||||
}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
))}
|
||||
</Space>
|
||||
<Space wrap style={{ marginTop: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!readiness.data?.ready}
|
||||
onClick={() => setConfirmAction("publish")}
|
||||
>
|
||||
发布当前草稿
|
||||
</Button>
|
||||
{currentRelease && (
|
||||
<Button danger onClick={() => setConfirmAction("revoke")}>
|
||||
撤回当前版本
|
||||
)}
|
||||
<Button
|
||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
||||
loading={importSample.isPending}
|
||||
onClick={() => importSample.mutate()}
|
||||
>
|
||||
导入示例内容
|
||||
</Button>
|
||||
{sample.isError && <Button onClick={() => void sample.refetch()}>重试</Button>}
|
||||
</Space>
|
||||
{sample.isError && (
|
||||
<Alert
|
||||
type="error"
|
||||
message={sample.error instanceof Error ? sample.error.message : "示例内容加载失败"}
|
||||
showIcon
|
||||
style={{ marginTop: 8 }}
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={publish.error || revoke.error} />
|
||||
<Divider />
|
||||
<Typography.Title level={5}>发布记录</Typography.Title>
|
||||
{releases.data?.length ? (
|
||||
{sample.data && !sample.data.alreadyImported && (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
将向草稿添加{" "}
|
||||
{Object.entries(sample.data.counts)
|
||||
.map(([key, count]) => `${key} ${count} 项`)
|
||||
.join("、")}
|
||||
;发布前请替换示例文案和图片。
|
||||
</Typography.Paragraph>
|
||||
)}
|
||||
<MutationError error={importSample.error} />
|
||||
</section>
|
||||
</Space>
|
||||
)}
|
||||
{activeTab === "miniapp" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>1. 核对草稿内容</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
此处核对的是待发布内容,不是小程序视觉预览。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{releases.data.map((item) => (
|
||||
<Space key={item.id} wrap>
|
||||
<Typography.Text>v{item.version}</Typography.Text>
|
||||
<Tag color={item.status === "published" ? "green" : "default"}>{item.status}</Tag>
|
||||
<Typography.Text type="secondary">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</Typography.Text>
|
||||
{item.note && <Typography.Text>{item.note}</Typography.Text>}
|
||||
{item.status === "superseded" && publishedHistory.length > 1 && (
|
||||
<Button size="small" onClick={() => setRollbackVersion(item.version)}>
|
||||
恢复此版本
|
||||
<Typography.Text strong>{brand.data?.name || "未命名品牌"}</Typography.Text>
|
||||
<Typography.Text>{brand.data?.tagline || "尚未填写品牌定位"}</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用业务项:{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用咨询表单:
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Space wrap>
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑小程序页面</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务展示和详情</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任证明</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</section>
|
||||
</Space>
|
||||
)}
|
||||
|
||||
{activeTab === "content" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>3. 检查并发布</Typography.Title>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Tag color={currentRelease ? "green" : "default"}>
|
||||
{currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
</Tag>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{(readiness.data?.checks ?? []).map((check) => (
|
||||
<Space key={check.key}>
|
||||
<Tag color={check.passed ? "success" : "warning"}>
|
||||
{check.passed ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<Typography.Text>{check.label}</Typography.Text>
|
||||
{check.help ? (
|
||||
<Typography.Text type="secondary">{check.help}</Typography.Text>
|
||||
) : null}
|
||||
{!check.passed && (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() =>
|
||||
navigate(check.destination ?? destinations[check.key] ?? "/admin/overview")
|
||||
}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
))}
|
||||
</Space>
|
||||
) : (
|
||||
<Empty description="暂无发布记录" />
|
||||
)}
|
||||
<MutationError error={rollback.error} />
|
||||
</section>
|
||||
<section>
|
||||
<Typography.Title level={4}>小程序代码发布</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
使用微信官方 miniprogram-ci 上传代码;审核与发布状态需按微信平台结果人工确认。
|
||||
</Typography.Paragraph>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Button
|
||||
disabled={!currentRelease}
|
||||
loading={createMiniAppRelease.isPending}
|
||||
onClick={() => createMiniAppRelease.mutate()}
|
||||
>
|
||||
基于当前品牌版本创建任务
|
||||
</Button>
|
||||
<Button onClick={() => setSettingsOpen(true)}>上传配置</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<Tag color="green">已配置上传凭据</Tag>
|
||||
) : (
|
||||
<Tag color="warning">未配置上传凭据</Tag>
|
||||
)}
|
||||
</Space>
|
||||
<Divider />
|
||||
{miniAppReleases.data?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{miniAppReleases.data.map((task) => (
|
||||
<Card key={task.id} size="small">
|
||||
<Space wrap>
|
||||
<Typography.Text>品牌 v{task.version}</Typography.Text>
|
||||
<Tag
|
||||
color={
|
||||
task.status === "published"
|
||||
? "green"
|
||||
: task.status === "failed"
|
||||
? "red"
|
||||
: "blue"
|
||||
}
|
||||
>
|
||||
{task.status}
|
||||
<Space wrap style={{ marginTop: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!readiness.data?.ready}
|
||||
onClick={() => setConfirmAction("publish")}
|
||||
>
|
||||
发布当前草稿
|
||||
</Button>
|
||||
{currentRelease && (
|
||||
<Button danger onClick={() => setConfirmAction("revoke")}>
|
||||
撤回当前版本
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={publish.error || revoke.error} />
|
||||
<Divider />
|
||||
<Typography.Title level={5}>发布记录</Typography.Title>
|
||||
{releases.data?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{releases.data.map((item) => (
|
||||
<Space key={item.id} wrap>
|
||||
<Typography.Text>v{item.version}</Typography.Text>
|
||||
<Tag color={item.status === "published" ? "green" : "default"}>
|
||||
{item.status}
|
||||
</Tag>
|
||||
{task.weappUploadId && (
|
||||
<Typography.Text type="secondary">
|
||||
微信版本 {task.weappUploadId}
|
||||
</Typography.Text>
|
||||
)}
|
||||
{task.error && <Typography.Text type="danger">{task.error}</Typography.Text>}
|
||||
{task.status === "built" && (
|
||||
<Button
|
||||
size="small"
|
||||
loading={uploadMiniAppRelease.isPending}
|
||||
onClick={() => uploadMiniAppRelease.mutate(task.id)}
|
||||
>
|
||||
上传微信
|
||||
</Button>
|
||||
)}
|
||||
{task.status === "uploaded" && (
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "under_review" })
|
||||
}
|
||||
>
|
||||
标记提交审核
|
||||
</Button>
|
||||
)}
|
||||
{task.status === "under_review" && (
|
||||
<>
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "approved" })
|
||||
}
|
||||
>
|
||||
审核通过
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "rejected" })
|
||||
}
|
||||
>
|
||||
审核驳回
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{task.status === "approved" && (
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "published" })
|
||||
}
|
||||
>
|
||||
标记已发布
|
||||
</Button>
|
||||
)}
|
||||
{task.status === "failed" && (
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() => updateMiniAppStatus.mutate({ id: task.id, status: "built" })}
|
||||
>
|
||||
重置可上传
|
||||
<Typography.Text type="secondary">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</Typography.Text>
|
||||
{item.note && <Typography.Text>{item.note}</Typography.Text>}
|
||||
{item.status === "superseded" && publishedHistory.length > 1 && (
|
||||
<Button size="small" onClick={() => setRollbackVersion(item.version)}>
|
||||
恢复此版本
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</Card>
|
||||
))}
|
||||
))}
|
||||
</Space>
|
||||
) : (
|
||||
<Empty description="暂无发布记录" />
|
||||
)}
|
||||
<MutationError error={rollback.error} />
|
||||
</section>
|
||||
<section>
|
||||
<Typography.Title level={4}>小程序代码发布</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
使用微信官方 miniprogram-ci 上传代码;审核与发布状态需按微信平台结果人工确认。
|
||||
</Typography.Paragraph>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Button
|
||||
disabled={!currentRelease}
|
||||
loading={createMiniAppRelease.isPending}
|
||||
onClick={() => createMiniAppRelease.mutate()}
|
||||
>
|
||||
基于当前品牌版本创建任务
|
||||
</Button>
|
||||
<Button onClick={() => setSettingsOpen(true)}>上传配置</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<Tag color="green">已配置上传凭据</Tag>
|
||||
) : (
|
||||
<Tag color="warning">未配置上传凭据</Tag>
|
||||
)}
|
||||
</Space>
|
||||
) : (
|
||||
<Empty description="暂无小程序发布任务" />
|
||||
)}
|
||||
</section>
|
||||
</Space>
|
||||
<Divider />
|
||||
{miniAppReleases.data?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{miniAppReleases.data.map((task) => (
|
||||
<Card key={task.id} size="small">
|
||||
<Space wrap>
|
||||
<Typography.Text>品牌 v{task.version}</Typography.Text>
|
||||
<Tag
|
||||
color={
|
||||
task.status === "published"
|
||||
? "green"
|
||||
: task.status === "failed"
|
||||
? "red"
|
||||
: "blue"
|
||||
}
|
||||
>
|
||||
{task.status}
|
||||
</Tag>
|
||||
{task.weappUploadId && (
|
||||
<Typography.Text type="secondary">
|
||||
微信版本 {task.weappUploadId}
|
||||
</Typography.Text>
|
||||
)}
|
||||
{task.error && <Typography.Text type="danger">{task.error}</Typography.Text>}
|
||||
{task.status === "built" && (
|
||||
<Button
|
||||
size="small"
|
||||
loading={uploadMiniAppRelease.isPending}
|
||||
onClick={() => uploadMiniAppRelease.mutate(task.id)}
|
||||
>
|
||||
上传微信
|
||||
</Button>
|
||||
)}
|
||||
{task.status === "uploaded" && (
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "under_review" })
|
||||
}
|
||||
>
|
||||
标记提交审核
|
||||
</Button>
|
||||
)}
|
||||
{task.status === "under_review" && (
|
||||
<>
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "approved" })
|
||||
}
|
||||
>
|
||||
审核通过
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "rejected" })
|
||||
}
|
||||
>
|
||||
审核驳回
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{task.status === "approved" && (
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "published" })
|
||||
}
|
||||
>
|
||||
标记已发布
|
||||
</Button>
|
||||
)}
|
||||
{task.status === "failed" && (
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() =>
|
||||
updateMiniAppStatus.mutate({ id: task.id, status: "built" })
|
||||
}
|
||||
>
|
||||
重置可上传
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</Card>
|
||||
))}
|
||||
</Space>
|
||||
) : (
|
||||
<Empty description="暂无小程序发布任务" />
|
||||
)}
|
||||
</section>
|
||||
</Space>
|
||||
)}
|
||||
<Modal
|
||||
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
||||
open={confirmAction !== null}
|
||||
|
||||
Reference in new issue
Block a user