Initial commit: HealthManager full-stack health management platform
Backend: .NET 10 + PostgreSQL + EF Core + JWT + SignalR Frontend patient: React 19 + TypeScript + Vite (mobile H5) Frontend doctor: React 19 + TypeScript + Vite (desktop web)
This commit is contained in:
52
frontend-patient/src/pages/services/ReportUploadPage.tsx
Normal file
52
frontend-patient/src/pages/services/ReportUploadPage.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Button } from '@/components/common/Button';
|
||||
import { Input } from '@/components/common/Input';
|
||||
import { PageHeader } from '@/components/layout/PageHeader';
|
||||
import { ToastContainer, toast } from '@/components/common/Toast';
|
||||
import * as reportService from '@/services/report.service';
|
||||
import styles from './ReportUploadPage.module.css';
|
||||
|
||||
export function ReportUploadPage() {
|
||||
const navigate = useNavigate();
|
||||
const [title, setTitle] = useState('');
|
||||
const [category, setCategory] = useState('血液检查');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const categories = ['血液检查', '心电图', '影像学', '尿液检查', '其他'];
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!title.trim()) { toast('请输入报告名称', 'error'); return; }
|
||||
setLoading(true);
|
||||
await reportService.uploadReport({ title, category });
|
||||
toast('上传成功,正在解读中...');
|
||||
setTimeout(() => navigate(-1), 800);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="page--no-tab">
|
||||
<PageHeader title="上传报告" />
|
||||
<div className={styles.form}>
|
||||
<Input label="报告名称" value={title} onChange={(e) => setTitle(e.target.value)} placeholder="如:血脂全套检查报告" />
|
||||
|
||||
<div className={styles.catLabel}>报告类型</div>
|
||||
<div className={styles.catGrid}>
|
||||
{categories.map((c) => (
|
||||
<button key={c} className={`${styles.catChip} ${category === c ? styles.catActive : ''}`} onClick={() => setCategory(c)}>{c}</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className={styles.uploadArea}>
|
||||
<span style={{ fontSize: 40 }}>📸</span>
|
||||
<span style={{ fontSize: '14px', color: '#6B7280' }}>点击拍照或选择图片上传</span>
|
||||
<span style={{ fontSize: '11px', color: '#9CA3AF' }}>模拟上传,直接保存即可</span>
|
||||
</div>
|
||||
|
||||
<Button variant="primary" size="lg" fullWidth loading={loading} onClick={handleSubmit}>
|
||||
提交上传
|
||||
</Button>
|
||||
</div>
|
||||
<ToastContainer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user