之前误将训练模块加在 uniapp 项目,实际目标项目是 TUICallKit-Vue3 (甄养堂主小程序壳),整体迁入: - hooks/useMetronome.ts 节拍器(音频实例池+预热,无冷启动延迟) - hooks/useTrainingSession.ts 训练 Session 状态机 - hooks/useVoiceCoach.ts 语音教练队列 - hooks/useTrainingBgm.ts 训练/休息 BGM 切换+渐变 - pages/training/index.vue 练一练主页(器械跟练) - pages/training/metronome.vue 独立节拍器(老人友好版, 中央圆即开始/暂停按钮,纯 CSS 几何 icon,大字大按钮) - pages/training/components/exercise-anim.vue CSS 动作动画 - pages/training/exercises.ts 5 个器械动作预设 - static/training/audio/*.mp3 3 种 click 音色(MIT 协议) - scripts/generate-voice.mjs MiMo TTS 批量生成语音脚本 - pages.json 注册 pages/training/index 与 pages/training/metronome - 「我的」页加 DevTrainingEntry 悬浮入口,生产环境自动隐藏 Co-authored-by: Cursor <cursoragent@cursor.com>
117 lines
3.2 KiB
TypeScript
117 lines
3.2 KiB
TypeScript
export type AnimationType =
|
|
| 'curl'
|
|
| 'press'
|
|
| 'sidefly'
|
|
| 'grip'
|
|
| 'crunch'
|
|
|
|
export interface ExercisePreset {
|
|
id: string
|
|
name: string
|
|
equipment: '哑铃' | '握力环' | '健身环' | '徒手'
|
|
icon: string
|
|
animationType: AnimationType
|
|
description: string
|
|
tips: string[]
|
|
contraindication?: string
|
|
|
|
defaultBpm: number
|
|
bpmMin: number
|
|
bpmMax: number
|
|
defaultSets: number
|
|
defaultReps: number
|
|
defaultRestSec: number
|
|
|
|
beatsPerRep: number
|
|
}
|
|
|
|
export const EXERCISE_PRESETS: ExercisePreset[] = [
|
|
{
|
|
id: 'dumbbell-curl',
|
|
name: '哑铃弯举',
|
|
equipment: '哑铃',
|
|
icon: '🏋',
|
|
animationType: 'curl',
|
|
description: '锻炼肱二头肌,注意肘部固定不动',
|
|
tips: ['肘部贴紧身体', '上举吸气,下落呼气', '动作放慢,控制重量'],
|
|
contraindication: '肘关节炎症急性期不宜',
|
|
defaultBpm: 60,
|
|
bpmMin: 40,
|
|
bpmMax: 100,
|
|
defaultSets: 3,
|
|
defaultReps: 12,
|
|
defaultRestSec: 60,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'dumbbell-press',
|
|
name: '哑铃推举',
|
|
equipment: '哑铃',
|
|
icon: '🏋',
|
|
animationType: 'press',
|
|
description: '锻炼肩部三角肌,核心保持收紧',
|
|
tips: ['不要含胸驼背', '推举时呼气', '不要锁死肘关节'],
|
|
contraindication: '肩袖损伤者请咨询医生',
|
|
defaultBpm: 60,
|
|
bpmMin: 40,
|
|
bpmMax: 90,
|
|
defaultSets: 3,
|
|
defaultReps: 10,
|
|
defaultRestSec: 90,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'dumbbell-sidefly',
|
|
name: '哑铃侧平举',
|
|
equipment: '哑铃',
|
|
icon: '🏋',
|
|
animationType: 'sidefly',
|
|
description: '锻炼三角肌中束,重量宜轻不宜重',
|
|
tips: ['手肘微屈', '抬至与肩平齐即可', '想象用肩膀发力,不是手臂'],
|
|
defaultBpm: 60,
|
|
bpmMin: 40,
|
|
bpmMax: 80,
|
|
defaultSets: 3,
|
|
defaultReps: 12,
|
|
defaultRestSec: 60,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'grip-ring',
|
|
name: '握力环训练',
|
|
equipment: '握力环',
|
|
icon: '🟢',
|
|
animationType: 'grip',
|
|
description: '锻炼前臂屈肌群,改善握力',
|
|
tips: ['完全握紧停顿 1 秒', '完全张开放松', '左右手交替'],
|
|
defaultBpm: 80,
|
|
bpmMin: 60,
|
|
bpmMax: 120,
|
|
defaultSets: 4,
|
|
defaultReps: 20,
|
|
defaultRestSec: 45,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'crunch',
|
|
name: '集中机(仰卧卷腹)',
|
|
equipment: '健身环',
|
|
icon: '💪',
|
|
animationType: 'crunch',
|
|
description: '锻炼腹直肌,借助健身环增加阻力',
|
|
tips: ['下背贴地', '用腹部发力,不是脖子', '上抬呼气,下落吸气'],
|
|
contraindication: '腰椎间盘突出急性期不宜',
|
|
defaultBpm: 50,
|
|
bpmMin: 40,
|
|
bpmMax: 80,
|
|
defaultSets: 3,
|
|
defaultReps: 15,
|
|
defaultRestSec: 60,
|
|
beatsPerRep: 2,
|
|
},
|
|
]
|
|
|
|
export function getPresetById(id: string): ExercisePreset | undefined {
|
|
return EXERCISE_PRESETS.find((e) => e.id === id)
|
|
}
|