|
|
@@ -22,7 +22,7 @@ const jobStatusMap: Record<number, string> = {
|
|
|
const UserInfoHeader: React.FC<UserInfoHeaderProps> = ({ personalInfo, loading }) => {
|
|
|
if (loading) {
|
|
|
return (
|
|
|
- <View className="bg-gradient-to-b from-blue-500 to-blue-700 p-5">
|
|
|
+ <View className="bg-gradient-to-b from-blue-500 to-blue-700 p-5 mb-3">
|
|
|
<View className="flex justify-between items-start">
|
|
|
<View className="flex items-center">
|
|
|
<View className="w-16 h-16 rounded-full border-2 border-white mr-4 bg-blue-400 flex items-center justify-center animate-pulse" />
|
|
|
@@ -36,22 +36,19 @@ const UserInfoHeader: React.FC<UserInfoHeaderProps> = ({ personalInfo, loading }
|
|
|
)
|
|
|
}
|
|
|
|
|
|
- if (!personalInfo) {
|
|
|
- return null
|
|
|
- }
|
|
|
-
|
|
|
- // 提取姓名首字作为头像占位符
|
|
|
- const nameInitial = personalInfo.name ? personalInfo.name.charAt(0) : '?'
|
|
|
+ // 提取姓名首字作为头像占位符 (即使personalInfo为null也渲染)
|
|
|
+ const nameInitial = personalInfo?.name ? personalInfo.name.charAt(0) : '?'
|
|
|
+ const displayName = personalInfo?.name || '未知用户'
|
|
|
|
|
|
// 组合用户状态: "残疾类型 · 等级 · 就业状态"
|
|
|
const userStatus = [
|
|
|
- personalInfo.disabilityType,
|
|
|
- personalInfo.disabilityLevel,
|
|
|
- jobStatusMap[personalInfo.jobStatus] || '未知'
|
|
|
- ].filter(Boolean).join(' · ')
|
|
|
+ personalInfo?.disabilityType,
|
|
|
+ personalInfo?.disabilityLevel,
|
|
|
+ personalInfo?.jobStatus !== undefined ? jobStatusMap[personalInfo.jobStatus] : undefined
|
|
|
+ ].filter(Boolean).join(' · ') || '状态未知'
|
|
|
|
|
|
return (
|
|
|
- <View className="bg-gradient-to-b from-blue-500 to-blue-700 p-5">
|
|
|
+ <View className="bg-gradient-to-b from-blue-500 to-blue-700 p-5 mb-3">
|
|
|
<View className="flex justify-between items-start">
|
|
|
{/* 左侧: 头像和用户信息 */}
|
|
|
<View className="flex items-center">
|
|
|
@@ -63,10 +60,10 @@ const UserInfoHeader: React.FC<UserInfoHeaderProps> = ({ personalInfo, loading }
|
|
|
{/* 用户信息 */}
|
|
|
<View>
|
|
|
<Text className="text-xl font-bold text-white block mb-1">
|
|
|
- {personalInfo.name || '未知用户'}
|
|
|
+ {displayName}
|
|
|
</Text>
|
|
|
<Text className="text-sm text-white opacity-80">
|
|
|
- {userStatus || '状态未知'}
|
|
|
+ {userStatus}
|
|
|
</Text>
|
|
|
</View>
|
|
|
</View>
|