diff --git a/src/components/Navbars/components/MobileDrawer/MobileDrawer.js b/src/components/Navbars/components/MobileDrawer/MobileDrawer.js index bc1218ed..d9f7a3e8 100644 --- a/src/components/Navbars/components/MobileDrawer/MobileDrawer.js +++ b/src/components/Navbars/components/MobileDrawer/MobileDrawer.js @@ -54,7 +54,7 @@ const MobileDrawer = memo(({ if (user.nickname) return user.nickname; if (user.username) return user.username; if (user.email) return user.email.split('@')[0]; - if (user.phone) return user.phone; + if (typeof user.phone === 'string' && user.phone) return user.phone; return '用户'; }; @@ -92,7 +92,7 @@ const MobileDrawer = memo(({ /> {getDisplayName()} - {user.phone && ( + {typeof user.phone === 'string' && user.phone && ( {user.phone} )} diff --git a/src/components/Navbars/components/Navigation/PersonalCenterMenu.js b/src/components/Navbars/components/Navigation/PersonalCenterMenu.js index 510f8281..167e4425 100644 --- a/src/components/Navbars/components/Navigation/PersonalCenterMenu.js +++ b/src/components/Navbars/components/Navigation/PersonalCenterMenu.js @@ -40,7 +40,7 @@ const PersonalCenterMenu = memo(({ user, handleLogout }) => { if (user.nickname) return user.nickname; if (user.username) return user.username; if (user.email) return user.email.split('@')[0]; - if (user.phone) return user.phone; + if (typeof user.phone === 'string' && user.phone) return user.phone; return '用户'; }; @@ -61,7 +61,7 @@ const PersonalCenterMenu = memo(({ user, handleLogout }) => { {/* 用户信息区 */} {getDisplayName()} - {user.phone && ( + {typeof user.phone === 'string' && user.phone && ( {user.phone} )} {user.has_wechat && ( diff --git a/src/components/Navbars/components/UserMenu/TabletUserMenu.js b/src/components/Navbars/components/UserMenu/TabletUserMenu.js index dc813313..ddb19987 100644 --- a/src/components/Navbars/components/UserMenu/TabletUserMenu.js +++ b/src/components/Navbars/components/UserMenu/TabletUserMenu.js @@ -46,7 +46,7 @@ const TabletUserMenu = memo(({ if (user.nickname) return user.nickname; if (user.username) return user.username; if (user.email) return user.email.split('@')[0]; - if (user.phone) return user.phone; + if (typeof user.phone === 'string' && user.phone) return user.phone; return '用户'; }; @@ -75,7 +75,7 @@ const TabletUserMenu = memo(({ {/* 用户信息区 */} {getDisplayName()} - {user.phone && ( + {typeof user.phone === 'string' && user.phone && ( {user.phone} )} {user.has_wechat && ( diff --git a/src/components/Navbars/components/UserMenu/UserAvatar.js b/src/components/Navbars/components/UserMenu/UserAvatar.js index 0ac08e3d..d1212203 100644 --- a/src/components/Navbars/components/UserMenu/UserAvatar.js +++ b/src/components/Navbars/components/UserMenu/UserAvatar.js @@ -29,7 +29,7 @@ const UserAvatar = forwardRef(({ if (user.nickname) return user.nickname; if (user.username) return user.username; if (user.email) return user.email.split('@')[0]; - if (user.phone) return user.phone; + if (typeof user.phone === 'string' && user.phone) return user.phone; return '用户'; };