hookehuyr

fix: 将birthday字段重命名为birth_date以保持一致性

<!--
* @Date: 2025-08-27 17:43:45
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-26 17:27:40
* @LastEditTime: 2025-09-27 16:09:23
* @FilePath: /lls_program/src/pages/Welcome/index.vue
* @Description: 欢迎页
-->
......@@ -204,24 +204,24 @@ useDidShow(async () => {
userInfo.value = data?.user?.nickname ? data.user : {
avatar_url: null,
nickname: null,
birthday: null,
birth_date: null,
wheelchair: null,
wheelchair_text: null,
phone: null,
};
// 计算用户年龄
if (userInfo.value.birth_date) {
const birthDate = new Date(userInfo.value.birth_date);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
// 如果还没到生日,年龄减1
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
userAge.value = age;
// 检查是否满60岁,可以创建家庭
canCreateFamily.value = age >= 60;
......@@ -229,7 +229,7 @@ useDidShow(async () => {
userAge.value = null;
canCreateFamily.value = false;
}
// 检查用户是否完善了个人信息
hasProfile.value = userInfo.value.nickname && userInfo.value.birth_date && userInfo.value.wheelchair_needed !== null;
}
......