chore: 清理调试日志并更新 CHANGELOG
- 移除年龄联动相关的所有 console.log 调试语句 - 更新 CHANGELOG.md 记录年龄与出生年月日联动优化 影响文件: - src/components/PlanFields/AgePicker.vue - src/components/PlanTemplates/LifeInsuranceTemplate.vue - src/components/PlanTemplates/CriticalIllnessTemplate.vue - src/components/PlanTemplates/SavingsTemplate.vue - docs/CHANGELOG.md
Showing
5 changed files
with
32 additions
and
49 deletions
| ... | @@ -5,6 +5,35 @@ | ... | @@ -5,6 +5,35 @@ |
| 5 | 5 | ||
| 6 | --- | 6 | --- |
| 7 | 7 | ||
| 8 | +## [2026-02-08] - 优化年龄与出生年月日联动逻辑 | ||
| 9 | + | ||
| 10 | +### 优化 | ||
| 11 | +- 调整计划书模板字段顺序:年龄在前,出生年月日在后 | ||
| 12 | +- 实现年龄 → 出生年月日自动计算(当前年份 - 年龄,默认1月1日) | ||
| 13 | +- 保留出生年月日 → 年龄双向联动(用户可手动调整出生日期) | ||
| 14 | +- 简化占位符文案,避免用户理解混乱 | ||
| 15 | +- 修复 AgePicker 组件不触发 change 事件的问题 | ||
| 16 | + | ||
| 17 | +### 改进细节 | ||
| 18 | +- **AgePicker.vue**: 添加 `change` 事件支持,确保父组件能监听年龄变化 | ||
| 19 | +- **LifeInsuranceTemplate.vue**: 实现双向联动逻辑 | ||
| 20 | +- **CriticalIllnessTemplate.vue**: 实现双向联动逻辑 | ||
| 21 | +- **SavingsTemplate.vue**: 实现双向联动逻辑 | ||
| 22 | + | ||
| 23 | +### 用户体验改进 | ||
| 24 | +- ✅ 用户先录入年龄(简单快捷) | ||
| 25 | +- ✅ 系统自动计算出生年月日(默认1月1日) | ||
| 26 | +- ✅ 用户仍可手动调整出生年月日(灵活性) | ||
| 27 | +- ✅ 简化文案,避免不必要的理解错误 | ||
| 28 | + | ||
| 29 | +### 影响文件 | ||
| 30 | +- `src/components/PlanFields/AgePicker.vue` | ||
| 31 | +- `src/components/PlanTemplates/LifeInsuranceTemplate.vue` | ||
| 32 | +- `src/components/PlanTemplates/CriticalIllnessTemplate.vue` | ||
| 33 | +- `src/components/PlanTemplates/SavingsTemplate.vue` | ||
| 34 | + | ||
| 35 | +--- | ||
| 36 | + | ||
| 8 | ## [2026-02-08] - 修复 LoadMoreList 页面双重滚动问题 | 37 | ## [2026-02-08] - 修复 LoadMoreList 页面双重滚动问题 |
| 9 | 38 | ||
| 10 | ### 修复 | 39 | ### 修复 | ... | ... |
| ... | @@ -251,7 +251,6 @@ const onConfirm = ({ selectedValue, selectedOptions }) => { | ... | @@ -251,7 +251,6 @@ const onConfirm = ({ selectedValue, selectedOptions }) => { |
| 251 | if (h !== undefined && t !== undefined && u !== undefined) { | 251 | if (h !== undefined && t !== undefined && u !== undefined) { |
| 252 | const age = parseInt(h) * 100 + parseInt(t) * 10 + parseInt(u) | 252 | const age = parseInt(h) * 100 + parseInt(t) * 10 + parseInt(u) |
| 253 | if (!Number.isNaN(age)) { | 253 | if (!Number.isNaN(age)) { |
| 254 | - console.log('[AgePicker] 确认选择年龄:', age) | ||
| 255 | emit('update:modelValue', age) | 254 | emit('update:modelValue', age) |
| 256 | emit('change', age) // 触发 change 事件,供父组件监听 | 255 | emit('change', age) // 触发 change 事件,供父组件监听 |
| 257 | } else { | 256 | } else { | ... | ... |
| ... | @@ -150,29 +150,14 @@ watch( | ... | @@ -150,29 +150,14 @@ watch( |
| 150 | * 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日) | 150 | * 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日) |
| 151 | */ | 151 | */ |
| 152 | const onAgeChange = (age) => { | 152 | const onAgeChange = (age) => { |
| 153 | - console.log('[CriticalIllnessTemplate] onAgeChange 触发,接收到的 age:', age, 'type:', typeof age) | ||
| 154 | - | ||
| 155 | if (age !== undefined && age !== null && age !== '') { | 153 | if (age !== undefined && age !== null && age !== '') { |
| 156 | const currentYear = new Date().getFullYear() | 154 | const currentYear = new Date().getFullYear() |
| 157 | const birthYear = currentYear - age | 155 | const birthYear = currentYear - age |
| 158 | 156 | ||
| 159 | - console.log('[CriticalIllnessTemplate] 计算出生年份:', { | ||
| 160 | - currentYear, | ||
| 161 | - age, | ||
| 162 | - birthYear | ||
| 163 | - }) | ||
| 164 | - | ||
| 165 | // 格式化为 YYYY-MM-DD,默认使用1月1日 | 157 | // 格式化为 YYYY-MM-DD,默认使用1月1日 |
| 166 | const month = String(1).padStart(2, '0') | 158 | const month = String(1).padStart(2, '0') |
| 167 | const day = String(1).padStart(2, '0') | 159 | const day = String(1).padStart(2, '0') |
| 168 | - const birthday = `${birthYear}-${month}-${day}` | 160 | + form.birthday = `${birthYear}-${month}-${day}` |
| 169 | - | ||
| 170 | - console.log('[CriticalIllnessTemplate] 设置出生日期:', birthday) | ||
| 171 | - form.birthday = birthday | ||
| 172 | - | ||
| 173 | - console.log('[CriticalIllnessTemplate] form.birthday 设置后:', form.birthday) | ||
| 174 | - } else { | ||
| 175 | - console.log('[CriticalIllnessTemplate] age 无效,跳过计算') | ||
| 176 | } | 161 | } |
| 177 | } | 162 | } |
| 178 | 163 | ... | ... |
| ... | @@ -150,29 +150,14 @@ watch( | ... | @@ -150,29 +150,14 @@ watch( |
| 150 | * 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日) | 150 | * 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日) |
| 151 | */ | 151 | */ |
| 152 | const onAgeChange = (age) => { | 152 | const onAgeChange = (age) => { |
| 153 | - console.log('[LifeInsuranceTemplate] onAgeChange 触发,接收到的 age:', age, 'type:', typeof age) | ||
| 154 | - | ||
| 155 | if (age !== undefined && age !== null && age !== '') { | 153 | if (age !== undefined && age !== null && age !== '') { |
| 156 | const currentYear = new Date().getFullYear() | 154 | const currentYear = new Date().getFullYear() |
| 157 | const birthYear = currentYear - age | 155 | const birthYear = currentYear - age |
| 158 | 156 | ||
| 159 | - console.log('[LifeInsuranceTemplate] 计算出生年份:', { | ||
| 160 | - currentYear, | ||
| 161 | - age, | ||
| 162 | - birthYear | ||
| 163 | - }) | ||
| 164 | - | ||
| 165 | // 格式化为 YYYY-MM-DD,默认使用1月1日 | 157 | // 格式化为 YYYY-MM-DD,默认使用1月1日 |
| 166 | const month = String(1).padStart(2, '0') | 158 | const month = String(1).padStart(2, '0') |
| 167 | const day = String(1).padStart(2, '0') | 159 | const day = String(1).padStart(2, '0') |
| 168 | - const birthday = `${birthYear}-${month}-${day}` | 160 | + form.birthday = `${birthYear}-${month}-${day}` |
| 169 | - | ||
| 170 | - console.log('[LifeInsuranceTemplate] 设置出生日期:', birthday) | ||
| 171 | - form.birthday = birthday | ||
| 172 | - | ||
| 173 | - console.log('[LifeInsuranceTemplate] form.birthday 设置后:', form.birthday) | ||
| 174 | - } else { | ||
| 175 | - console.log('[LifeInsuranceTemplate] age 无效,跳过计算') | ||
| 176 | } | 161 | } |
| 177 | } | 162 | } |
| 178 | 163 | ... | ... |
| ... | @@ -312,29 +312,14 @@ const withdrawalPeriods = computed(() => { | ... | @@ -312,29 +312,14 @@ const withdrawalPeriods = computed(() => { |
| 312 | * 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日) | 312 | * 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日) |
| 313 | */ | 313 | */ |
| 314 | const onAgeChange = (age) => { | 314 | const onAgeChange = (age) => { |
| 315 | - console.log('[SavingsTemplate] onAgeChange 触发,接收到的 age:', age, 'type:', typeof age) | ||
| 316 | - | ||
| 317 | if (age !== undefined && age !== null && age !== '') { | 315 | if (age !== undefined && age !== null && age !== '') { |
| 318 | const currentYear = new Date().getFullYear() | 316 | const currentYear = new Date().getFullYear() |
| 319 | const birthYear = currentYear - age | 317 | const birthYear = currentYear - age |
| 320 | 318 | ||
| 321 | - console.log('[SavingsTemplate] 计算出生年份:', { | ||
| 322 | - currentYear, | ||
| 323 | - age, | ||
| 324 | - birthYear | ||
| 325 | - }) | ||
| 326 | - | ||
| 327 | // 格式化为 YYYY-MM-DD,默认使用1月1日 | 319 | // 格式化为 YYYY-MM-DD,默认使用1月1日 |
| 328 | const month = String(1).padStart(2, '0') | 320 | const month = String(1).padStart(2, '0') |
| 329 | const day = String(1).padStart(2, '0') | 321 | const day = String(1).padStart(2, '0') |
| 330 | - const birthday = `${birthYear}-${month}-${day}` | 322 | + form.birthday = `${birthYear}-${month}-${day}` |
| 331 | - | ||
| 332 | - console.log('[SavingsTemplate] 设置出生日期:', birthday) | ||
| 333 | - form.birthday = birthday | ||
| 334 | - | ||
| 335 | - console.log('[SavingsTemplate] form.birthday 设置后:', form.birthday) | ||
| 336 | - } else { | ||
| 337 | - console.log('[SavingsTemplate] age 无效,跳过计算') | ||
| 338 | } | 323 | } |
| 339 | } | 324 | } |
| 340 | 325 | ... | ... |
-
Please register or login to post a comment