From 53ae2059c54550113134769ae8cca72f913d871f Mon Sep 17 00:00:00 2001 From: selfrelease Date: Sat, 18 Jul 2026 22:19:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20AI=20=E7=BB=84=E4=BB=B6=20+?= =?UTF-8?q?=20=E5=88=9B=E5=A7=8B=E4=BA=BA=E6=9C=88=E6=8A=A5=20+=20?= =?UTF-8?q?=E5=81=A5=E5=BA=B7=E5=BA=A6=E5=9B=BE=E8=A1=A8=20+=20Copilot=20?= =?UTF-8?q?=E6=B5=AE=E5=8A=A8=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 健康度图表:HealthRadar(雷达图)+ HealthGauge(仪表盘)+ HealthTrend(趋势) - 驾驶舱组件:HealthDistribution + RiskSummary - AI Copilot:浮动对话窗口(SSE 流式接收) - 创始人月报提交页:表单 + 企业选择 + 年月选择 - 投资人月报 AI 解析页:SSE 流式输出 + 健康度雷达图 + 风险检测结果 - 前端构建 14 路由成功 --- .../src/app/(founder)/reports/submit/page.tsx | 146 +++++++++++ frontend/src/app/(investor)/layout.tsx | 4 +- .../src/app/(investor)/reports/[id]/page.tsx | 244 ++++++++++++++++++ .../dashboard/HealthDistribution.tsx | 56 ++++ .../src/components/dashboard/RiskSummary.tsx | 74 ++++++ .../src/components/health/HealthGauge.tsx | 61 +++++ .../src/components/health/HealthRadar.tsx | 140 ++++++++++ .../src/components/health/HealthTrend.tsx | 59 +++++ .../src/components/shared/CopilotWidget.tsx | 198 ++++++++++++++ 9 files changed, 981 insertions(+), 1 deletion(-) create mode 100644 frontend/src/app/(founder)/reports/submit/page.tsx create mode 100644 frontend/src/app/(investor)/reports/[id]/page.tsx create mode 100644 frontend/src/components/dashboard/HealthDistribution.tsx create mode 100644 frontend/src/components/dashboard/RiskSummary.tsx create mode 100644 frontend/src/components/health/HealthGauge.tsx create mode 100644 frontend/src/components/health/HealthRadar.tsx create mode 100644 frontend/src/components/health/HealthTrend.tsx create mode 100644 frontend/src/components/shared/CopilotWidget.tsx diff --git a/frontend/src/app/(founder)/reports/submit/page.tsx b/frontend/src/app/(founder)/reports/submit/page.tsx new file mode 100644 index 0000000..3fc5e15 --- /dev/null +++ b/frontend/src/app/(founder)/reports/submit/page.tsx @@ -0,0 +1,146 @@ +"use client"; + +import { useState } from "react"; +import { FileText, Send, Loader2 } from "lucide-react"; +import { listCompanies, type Company } from "@/lib/companies"; +import { createReport, submitReport } from "@/lib/reports"; +import { useEffect } from "react"; + +/** + * 创始人端 — 提交月报页。 + */ +export default function FounderReportSubmitPage() { + const [companies, setCompanies] = useState([]); + const [companyId, setCompanyId] = useState(""); + const [year, setYear] = useState(new Date().getFullYear()); + const [month, setMonth] = useState(new Date().getMonth() + 1); + const [content, setContent] = useState(""); + const [isLoading, setIsLoading] = useState(false); + const [message, setMessage] = useState(""); + + useEffect(() => { + async function load() { + try { + const resp = await listCompanies({ page: 1, page_size: 100 }); + if (resp.data) { + setCompanies(resp.data.items); + if (resp.data.items.length > 0) setCompanyId(resp.data.items[0].id); + } + } catch { + // ignore + } + } + load(); + }, []); + + async function handleSubmit() { + if (!companyId || !content.trim()) return; + setIsLoading(true); + setMessage(""); + try { + const createResp = await createReport({ + company_id: companyId, + period_year: year, + period_month: month, + raw_content: content, + }); + if (createResp.data) { + const submitResp = await submitReport(createResp.data.id); + if (submitResp.data) { + setMessage("月报已提交成功!等待 AI 解析..."); + setContent(""); + } + } + } catch (err) { + setMessage(err instanceof Error ? err.message : "提交失败"); + } finally { + setIsLoading(false); + } + } + + return ( +
+
+

提交月报

+

填写本月经营情况,提交后 AI 将自动解析

+
+ + {/* 表单 */} +
+ {/* 企业选择 */} +
+ + +
+ + {/* 年月选择 */} +
+
+ + +
+
+ + +
+
+ + {/* 月报内容 */} +
+ +