hookehuyr

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
......@@ -5,6 +5,35 @@
---
## [2026-02-08] - 优化年龄与出生年月日联动逻辑
### 优化
- 调整计划书模板字段顺序:年龄在前,出生年月日在后
- 实现年龄 → 出生年月日自动计算(当前年份 - 年龄,默认1月1日)
- 保留出生年月日 → 年龄双向联动(用户可手动调整出生日期)
- 简化占位符文案,避免用户理解混乱
- 修复 AgePicker 组件不触发 change 事件的问题
### 改进细节
- **AgePicker.vue**: 添加 `change` 事件支持,确保父组件能监听年龄变化
- **LifeInsuranceTemplate.vue**: 实现双向联动逻辑
- **CriticalIllnessTemplate.vue**: 实现双向联动逻辑
- **SavingsTemplate.vue**: 实现双向联动逻辑
### 用户体验改进
- ✅ 用户先录入年龄(简单快捷)
- ✅ 系统自动计算出生年月日(默认1月1日)
- ✅ 用户仍可手动调整出生年月日(灵活性)
- ✅ 简化文案,避免不必要的理解错误
### 影响文件
- `src/components/PlanFields/AgePicker.vue`
- `src/components/PlanTemplates/LifeInsuranceTemplate.vue`
- `src/components/PlanTemplates/CriticalIllnessTemplate.vue`
- `src/components/PlanTemplates/SavingsTemplate.vue`
---
## [2026-02-08] - 修复 LoadMoreList 页面双重滚动问题
### 修复
......
......@@ -251,7 +251,6 @@ const onConfirm = ({ selectedValue, selectedOptions }) => {
if (h !== undefined && t !== undefined && u !== undefined) {
const age = parseInt(h) * 100 + parseInt(t) * 10 + parseInt(u)
if (!Number.isNaN(age)) {
console.log('[AgePicker] 确认选择年龄:', age)
emit('update:modelValue', age)
emit('change', age) // 触发 change 事件,供父组件监听
} else {
......
......@@ -150,29 +150,14 @@ watch(
* 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日)
*/
const onAgeChange = (age) => {
console.log('[CriticalIllnessTemplate] onAgeChange 触发,接收到的 age:', age, 'type:', typeof age)
if (age !== undefined && age !== null && age !== '') {
const currentYear = new Date().getFullYear()
const birthYear = currentYear - age
console.log('[CriticalIllnessTemplate] 计算出生年份:', {
currentYear,
age,
birthYear
})
// 格式化为 YYYY-MM-DD,默认使用1月1日
const month = String(1).padStart(2, '0')
const day = String(1).padStart(2, '0')
const birthday = `${birthYear}-${month}-${day}`
console.log('[CriticalIllnessTemplate] 设置出生日期:', birthday)
form.birthday = birthday
console.log('[CriticalIllnessTemplate] form.birthday 设置后:', form.birthday)
} else {
console.log('[CriticalIllnessTemplate] age 无效,跳过计算')
form.birthday = `${birthYear}-${month}-${day}`
}
}
......
......@@ -150,29 +150,14 @@ watch(
* 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日)
*/
const onAgeChange = (age) => {
console.log('[LifeInsuranceTemplate] onAgeChange 触发,接收到的 age:', age, 'type:', typeof age)
if (age !== undefined && age !== null && age !== '') {
const currentYear = new Date().getFullYear()
const birthYear = currentYear - age
console.log('[LifeInsuranceTemplate] 计算出生年份:', {
currentYear,
age,
birthYear
})
// 格式化为 YYYY-MM-DD,默认使用1月1日
const month = String(1).padStart(2, '0')
const day = String(1).padStart(2, '0')
const birthday = `${birthYear}-${month}-${day}`
console.log('[LifeInsuranceTemplate] 设置出生日期:', birthday)
form.birthday = birthday
console.log('[LifeInsuranceTemplate] form.birthday 设置后:', form.birthday)
} else {
console.log('[LifeInsuranceTemplate] age 无效,跳过计算')
form.birthday = `${birthYear}-${month}-${day}`
}
}
......
......@@ -312,29 +312,14 @@ const withdrawalPeriods = computed(() => {
* 计算公式:当前年份 - 年龄 = 出生年份(默认1月1日)
*/
const onAgeChange = (age) => {
console.log('[SavingsTemplate] onAgeChange 触发,接收到的 age:', age, 'type:', typeof age)
if (age !== undefined && age !== null && age !== '') {
const currentYear = new Date().getFullYear()
const birthYear = currentYear - age
console.log('[SavingsTemplate] 计算出生年份:', {
currentYear,
age,
birthYear
})
// 格式化为 YYYY-MM-DD,默认使用1月1日
const month = String(1).padStart(2, '0')
const day = String(1).padStart(2, '0')
const birthday = `${birthYear}-${month}-${day}`
console.log('[SavingsTemplate] 设置出生日期:', birthday)
form.birthday = birthday
console.log('[SavingsTemplate] form.birthday 设置后:', form.birthday)
} else {
console.log('[SavingsTemplate] age 无效,跳过计算')
form.birthday = `${birthYear}-${month}-${day}`
}
}
......