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:
81
frontend-patient/src/pages/profile/ProfilePage.tsx
Normal file
81
frontend-patient/src/pages/profile/ProfilePage.tsx
Normal file
@@ -0,0 +1,81 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { PageHeader } from '@/components/layout/PageHeader';
|
||||
import { Card } from '@/components/common/Card';
|
||||
import { Badge } from '@/components/common/Badge';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useNotificationStore } from '@/stores/notification.store';
|
||||
import styles from './ProfilePage.module.css';
|
||||
|
||||
export function ProfilePage() {
|
||||
const navigate = useNavigate();
|
||||
const { user, logout } = useAuth();
|
||||
const { unreadCount } = useNotificationStore();
|
||||
|
||||
const handleLogout = () => {
|
||||
if (confirm('确定要退出登录吗?')) {
|
||||
logout();
|
||||
navigate('/login', { replace: true });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<PageHeader title="我的" showBack={false} />
|
||||
|
||||
<Card className={styles.profileCard} onClick={() => navigate('/profile/edit')}>
|
||||
<div className={styles.avatar}>{user?.nickname?.[0] || '用'}</div>
|
||||
<div className={styles.profileInfo}>
|
||||
<div className={styles.nickname}>{user?.nickname || '用户'} <span className={styles.editHint}>编辑</span></div>
|
||||
<div className={styles.phone}>{user?.phone}</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card className={styles.statsCard}>
|
||||
<div className={styles.stat}>
|
||||
<span className={styles.statValue}>{user?.height || '-'}cm</span>
|
||||
<span className={styles.statLabel}>身高</span>
|
||||
</div>
|
||||
<div className={styles.statDivider} />
|
||||
<div className={styles.stat}>
|
||||
<span className={styles.statValue}>{user?.weight || '-'}kg</span>
|
||||
<span className={styles.statLabel}>体重</span>
|
||||
</div>
|
||||
<div className={styles.statDivider} />
|
||||
<div className={styles.stat}>
|
||||
<span className={styles.statValue}>{user?.medicalHistory?.join('、') || '-'}</span>
|
||||
<span className={styles.statLabel}>病史</span>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<div className={styles.menuList}>
|
||||
<button className={styles.menuItem} onClick={() => navigate('/health/medications')}>
|
||||
<span>💊 我的用药</span>
|
||||
<span>→</span>
|
||||
</button>
|
||||
<button className={styles.menuItem} onClick={() => navigate('/notifications')}>
|
||||
<span>🔔 消息通知</span>
|
||||
<div className={styles.menuRight}>
|
||||
{unreadCount > 0 && <Badge count={unreadCount} />}
|
||||
<span>→</span>
|
||||
</div>
|
||||
</button>
|
||||
<button className={styles.menuItem} onClick={() => navigate('/home/device-binding')}>
|
||||
<span>📡 设备管理</span>
|
||||
<span>→</span>
|
||||
</button>
|
||||
<button className={styles.menuItem} onClick={() => navigate('/profile/settings')}>
|
||||
<span>⚙️ 设置</span>
|
||||
<span>→</span>
|
||||
</button>
|
||||
<button className={styles.menuItem} onClick={() => navigate('/profile/settings/about')}>
|
||||
<span>ℹ️ 关于</span>
|
||||
<span>→</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button className={styles.logoutBtn} onClick={handleLogout}>
|
||||
退出登录
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user