|
|
@@ -40,15 +40,6 @@ const CHINESE_STATUS_TO_ENUM: Record<string, WorkStatus> = {
|
|
|
'未就业': WorkStatus.NOT_WORKING
|
|
|
}
|
|
|
|
|
|
-// WorkStatus枚举到中文状态的映射
|
|
|
-const _ENUM_TO_CHINESE_STATUS: Record<WorkStatus, string> = {
|
|
|
- [WorkStatus.WORKING]: '在职',
|
|
|
- [WorkStatus.PRE_WORKING]: '待入职',
|
|
|
- [WorkStatus.RESIGNED]: '离职',
|
|
|
- [WorkStatus.NOT_WORKING]: '未就业'
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
const TalentManagement: React.FC<TalentManagementProps> = () => {
|
|
|
const { user: _user } = useAuth()
|
|
|
const { isLoggedIn } = useRequireAuth()
|
|
|
@@ -121,15 +112,19 @@ const TalentManagement: React.FC<TalentManagementProps> = () => {
|
|
|
|
|
|
// 合并所有分页数据
|
|
|
const allTalents = data?.pages.flatMap(page => page.data) || []
|
|
|
- const totalCount = data?.pages[0]?.total || 0
|
|
|
+ // 安全访问 totalCount,处理 pages 为空的情况
|
|
|
+ const totalCount = data?.pages?.[0]?.total ?? 0
|
|
|
|
|
|
// 下拉刷新
|
|
|
const onRefresh = async () => {
|
|
|
setRefreshing(true)
|
|
|
try {
|
|
|
await refetch()
|
|
|
+ } catch (error) {
|
|
|
+ console.error('刷新失败:', error)
|
|
|
} finally {
|
|
|
- setTimeout(() => setRefreshing(false), 500)
|
|
|
+ // 等待一小段时间确保用户看到刷新动画
|
|
|
+ setTimeout(() => setRefreshing(false), 300)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -322,9 +317,9 @@ const TalentManagement: React.FC<TalentManagementProps> = () => {
|
|
|
) : allTalents.length > 0 ? (
|
|
|
// 人才列表
|
|
|
<View className="space-y-3">
|
|
|
- {allTalents.map((talent) => (
|
|
|
+ {allTalents.map((talent, index) => (
|
|
|
<View
|
|
|
- key={talent.personId}
|
|
|
+ key={`${talent.personId}-${index}`}
|
|
|
className="card bg-white p-4 flex items-center cursor-pointer active:bg-gray-50"
|
|
|
onClick={() => handleTalentClick(talent.personId)}
|
|
|
>
|