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