hookehuyr

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

1 <!-- 1 <!--
2 * @Date: 2025-08-27 17:43:45 2 * @Date: 2025-08-27 17:43:45
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-26 17:27:40 4 + * @LastEditTime: 2025-09-27 16:09:23
5 * @FilePath: /lls_program/src/pages/Welcome/index.vue 5 * @FilePath: /lls_program/src/pages/Welcome/index.vue
6 * @Description: 欢迎页 6 * @Description: 欢迎页
7 --> 7 -->
...@@ -204,24 +204,24 @@ useDidShow(async () => { ...@@ -204,24 +204,24 @@ useDidShow(async () => {
204 userInfo.value = data?.user?.nickname ? data.user : { 204 userInfo.value = data?.user?.nickname ? data.user : {
205 avatar_url: null, 205 avatar_url: null,
206 nickname: null, 206 nickname: null,
207 - birthday: null, 207 + birth_date: null,
208 wheelchair: null, 208 wheelchair: null,
209 wheelchair_text: null, 209 wheelchair_text: null,
210 phone: null, 210 phone: null,
211 }; 211 };
212 - 212 +
213 // 计算用户年龄 213 // 计算用户年龄
214 if (userInfo.value.birth_date) { 214 if (userInfo.value.birth_date) {
215 const birthDate = new Date(userInfo.value.birth_date); 215 const birthDate = new Date(userInfo.value.birth_date);
216 const today = new Date(); 216 const today = new Date();
217 let age = today.getFullYear() - birthDate.getFullYear(); 217 let age = today.getFullYear() - birthDate.getFullYear();
218 const monthDiff = today.getMonth() - birthDate.getMonth(); 218 const monthDiff = today.getMonth() - birthDate.getMonth();
219 - 219 +
220 // 如果还没到生日,年龄减1 220 // 如果还没到生日,年龄减1
221 if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) { 221 if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
222 age--; 222 age--;
223 } 223 }
224 - 224 +
225 userAge.value = age; 225 userAge.value = age;
226 // 检查是否满60岁,可以创建家庭 226 // 检查是否满60岁,可以创建家庭
227 canCreateFamily.value = age >= 60; 227 canCreateFamily.value = age >= 60;
...@@ -229,7 +229,7 @@ useDidShow(async () => { ...@@ -229,7 +229,7 @@ useDidShow(async () => {
229 userAge.value = null; 229 userAge.value = null;
230 canCreateFamily.value = false; 230 canCreateFamily.value = false;
231 } 231 }
232 - 232 +
233 // 检查用户是否完善了个人信息 233 // 检查用户是否完善了个人信息
234 hasProfile.value = userInfo.value.nickname && userInfo.value.birth_date && userInfo.value.wheelchair_needed !== null; 234 hasProfile.value = userInfo.value.nickname && userInfo.value.birth_date && userInfo.value.wheelchair_needed !== null;
235 } 235 }
......