style: 修复关注按钮展示问题

This commit is contained in:
2025-11-30 21:27:36 +08:00
parent 98b4b820a0
commit cbf1013d92
4 changed files with 10 additions and 8 deletions

View File

@@ -45,12 +45,12 @@ const navigateToLogin = (currentPath?: string) => {
// 检查登录状态,如果未登录则跳转到登录页
export const requireLogin = (): boolean => {
const isLoggedIn = check_login_status();
if (!isLoggedIn) {
navigateToLogin();
return false;
}
return true;
};
@@ -62,25 +62,25 @@ export const requireLoginWithPhone = (): boolean => {
navigateToLogin();
return false;
}
// 检查是否有手机号
// 优先从 store 中获取用户信息
const userInfo = useUser.getState().user;
let phone = (userInfo as any)?.phone;
// 如果 store 中没有,尝试从本地存储获取
if (!phone || phone.trim() === '') {
const localUserInfo = get_user_info();
phone = localUserInfo?.phone;
}
// 如果用户信息中没有手机号,或者手机号为空
if (!phone || phone.trim() === '') {
console.log('用户未绑定手机号,跳转到登录页绑定');
navigateToLogin();
return false;
}
return true;
};