hookehuyr

feat: 添加未加入家庭用户的跳转逻辑

在静默授权成功后检查用户是否已加入家庭,未加入则跳转至欢迎页面
...@@ -171,7 +171,7 @@ const defaultFamilyCover = 'https://cdn.ipadbiz.cn/lls_prog/images/default-famil ...@@ -171,7 +171,7 @@ const defaultFamilyCover = 'https://cdn.ipadbiz.cn/lls_prog/images/default-famil
171 const defaultAvatar = 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' 171 const defaultAvatar = 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
172 // 接口信息 172 // 接口信息
173 import { getFamilyDashboardAPI } from '@/api/family' 173 import { getFamilyDashboardAPI } from '@/api/family'
174 -import { silentAuth } from '@/utils/authRedirect' 174 +import { silentAuth, checkUserHasFamily } from '@/utils/authRedirect'
175 175
176 const todaySteps = ref(0); 176 const todaySteps = ref(0);
177 const isWeRunAuthorized = ref(false); 177 const isWeRunAuthorized = ref(false);
...@@ -359,6 +359,18 @@ useLoad(async () => { ...@@ -359,6 +359,18 @@ useLoad(async () => {
359 console.log('Dashboard onLoad - 静默授权成功:', result); 359 console.log('Dashboard onLoad - 静默授权成功:', result);
360 // 静默授权成功后立即刷新页面数据 360 // 静默授权成功后立即刷新页面数据
361 await refreshDashboardData(); 361 await refreshDashboardData();
362 +
363 + // 检查用户是否已加入家庭
364 + const hasFamily = await checkUserHasFamily()
365 +
366 + // 如果用户没有加入家庭,跳转到欢迎页面
367 + if (!hasFamily) {
368 + console.warn('用户未加入家庭,跳转到欢迎页面');
369 + await Taro.reLaunch({
370 + url: '/pages/Welcome/index'
371 + })
372 + return
373 + }
362 }, 374 },
363 (error) => { 375 (error) => {
364 console.error('Dashboard onLoad - 静默授权失败:', error); 376 console.error('Dashboard onLoad - 静默授权失败:', error);
......