"use client"; import { useState } from "react"; import { BookOpenText, MessageSquareText, Send, Users, } from "lucide-react"; import { RawDetails } from "@/components/display"; import { EmptyState, ErrorBanner, Loading, PageHeading, } from "@/components/feedback"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select } from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import { UsageGuide } from "@/components/usage-guide"; import { ApiError } from "@/lib/api"; import { academicApi } from "@/lib/services"; const TYPES = [ { value: "journal-club", label: "文献汇报" }, { value: "case-discussion", label: "病例讨论" }, { value: "seminar", label: "专题讲座" }, { value: "rounds", label: "教学查房" }, ]; export default function AcademicPage() { const [records, setRecords] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [type, setType] = useState(""); const [title, setTitle] = useState(""); const [content, setContent] = useState(""); const [mentorFeedback, setMentorFeedback] = useState(""); const [submitting, setSubmitting] = useState(false); async function loadRecords() { setLoading(true); setError(null); try { const res = await academicApi.listRecords(); setRecords(Array.isArray(res) ? res : []); } catch (err) { setError(err instanceof ApiError ? err.message : "加载失败"); } finally { setLoading(false); } } async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setSubmitting(true); setError(null); try { await academicApi.addRecord({ type: type || undefined, title, content, mentorFeedback: mentorFeedback || undefined, }); setType(""); setTitle(""); setContent(""); setMentorFeedback(""); await loadRecords(); } catch (err) { setError(err instanceof ApiError ? err.message : "提交失败"); } finally { setSubmitting(false); } } return (
} title="学术交流" description="文献汇报、病例讨论记录与导师反馈,沉淀学术交流轨迹。" /> 新增交流记录
setTitle(e.target.value)} placeholder="如:糖尿病肾病最新诊疗进展" required />