feat(medications): 增强药品详情页面的编辑功能

- 添加剂量、剂型和服药频率的交互式选择器
- 实现提醒时间的动态编辑和添加功能
- 引入玻璃效果优化删除按钮的视觉体验
- 重构常量配置,提取药物相关常量到独立文件
- 创建可复用的InfoCard组件支持玻璃效果
This commit is contained in:
richarjiang
2025-11-11 11:31:06 +08:00
parent 50525f82a1
commit 7ea558847d
4 changed files with 922 additions and 107 deletions

56
constants/Medication.ts Normal file
View File

@@ -0,0 +1,56 @@
/**
* 药物管理相关常量
*/
import type { MedicationForm } from '@/types/medication';
import type { MaterialCommunityIcons } from '@expo/vector-icons';
/**
* 剂型选项配置
*/
export const FORM_OPTIONS: Array<{
id: MedicationForm;
label: string;
icon: keyof typeof MaterialCommunityIcons.glyphMap;
}> = [
{ id: 'capsule', label: '胶囊', icon: 'pill' },
{ id: 'pill', label: '药片', icon: 'tablet' },
{ id: 'injection', label: '注射', icon: 'needle' },
{ id: 'spray', label: '喷雾', icon: 'spray' },
{ id: 'drop', label: '滴剂', icon: 'eyedropper' },
{ id: 'syrup', label: '糖浆', icon: 'bottle-tonic' },
{ id: 'other', label: '其他', icon: 'dots-horizontal' },
];
/**
* 剂型标签映射
*/
export const FORM_LABELS: Record<MedicationForm, string> = {
capsule: '胶囊',
pill: '药片',
injection: '注射',
spray: '喷雾',
drop: '滴剂',
syrup: '糖浆',
other: '其他',
};
/**
* 剂量单位选项
*/
export const DOSAGE_UNITS = ['片', '粒', '毫升', '滴', '喷', '勺'];
/**
* 剂量值选项 (0.5 - 10步长0.5)
*/
export const DOSAGE_VALUES = Array.from({ length: 20 }, (_, i) => (i + 1) * 0.5);
/**
* 每日次数选项
*/
export const TIMES_PER_DAY_OPTIONS = Array.from({ length: 10 }, (_, index) => index + 1);
/**
* 默认服药时间预设
*/
export const DEFAULT_TIME_PRESETS = ['08:00', '12:00', '18:00', '22:00'];