fix: 前端构建修复+后端静态托管+Docker部署

This commit is contained in:
2026-08-12 17:05:30 +08:00
parent 2716e2c691
commit ddbc3f59c7
+25 -16
View File
@@ -36,12 +36,13 @@ export default function ProjectDetail() {
useEffect(() => {
if (!id) return;
const projectId = Number(id);
setLoading(true);
Promise.all([
projectApi.get(id),
projectApi.stats(id),
taskApi.list({ project_id: id }),
artifactApi.list({ project_id: id }),
projectApi.get(projectId),
projectApi.stats(projectId),
taskApi.list({ project_id: projectId }),
artifactApi.list({ project_id: projectId }),
])
.then(([p, s, t, a]) => {
setProject(p);
@@ -65,6 +66,15 @@ export default function ProjectDetail() {
return <Empty description="项目不存在" />;
}
const taskStatusDist = stats
? [
{ status: 'pending', count: stats.pending_tasks },
{ status: 'in_progress', count: stats.in_progress_tasks },
{ status: 'review', count: stats.review_tasks },
{ status: 'done', count: stats.done_tasks },
].filter((item) => item.count > 0)
: [];
return (
<div>
<div
@@ -102,7 +112,9 @@ export default function ProjectDetail() {
<ProjectStatusTag status={project.status} />
</Descriptions.Item>
<Descriptions.Item label="预算">
{project.budget != null ? `¥${project.budget.toFixed(2)}` : '-'}
{project.budget_limit_cents != null
? `¥${(project.budget_limit_cents / 100).toFixed(2)}`
: '-'}
</Descriptions.Item>
<Descriptions.Item label="创建时间">
{dayjs(project.created_at).format('YYYY-MM-DD HH:mm')}
@@ -133,15 +145,15 @@ export default function ProjectDetail() {
<Col xs={12} md={6}>
<Statistic
title="已完成"
value={stats.completed_tasks}
value={stats.done_tasks}
valueStyle={{ color: '#52c41a' }}
/>
</Col>
<Col xs={12} md={6}>
<Card>
<Statistic
title="活跃 AI 工作者"
value={stats.active_workers}
title="待审核"
value={stats.pending_reviews}
valueStyle={{ color: '#1677ff' }}
/>
</Card>
@@ -150,7 +162,7 @@ export default function ProjectDetail() {
<Card>
<Statistic
title="总花费"
value={stats.total_cost}
value={stats.total_cost_cents / 100}
precision={2}
prefix="¥"
valueStyle={{ color: '#fa8c16' }}
@@ -160,17 +172,14 @@ export default function ProjectDetail() {
</Row>
)}
{stats && (
{stats && taskStatusDist.length > 0 && (
<Card title="任务状态分布" size="small" style={{ marginBottom: 16 }}>
<Space wrap>
{Object.entries(stats.tasks_by_status || {}).map(([status, count]) => (
{taskStatusDist.map(({ status, count }) => (
<Tag key={status} style={{ padding: '4px 12px', fontSize: 14 }}>
<TaskStatusTag status={status as Task['status']} /> {count}
</Tag>
))}
{Object.keys(stats.tasks_by_status || {}).length === 0 && (
<Text type="secondary"></Text>
)}
</Space>
</Card>
)}
@@ -210,8 +219,8 @@ export default function ProjectDetail() {
renderItem={(art) => (
<List.Item key={art.id}>
<List.Item.Meta
title={art.name}
description={`${art.type} · ${dayjs(art.created_at).format('MM-DD HH:mm')}`}
title={art.title}
description={`${art.artifact_type} · ${dayjs(art.created_at).format('MM-DD HH:mm')}`}
/>
</List.Item>
)}