|
|
@@ -15,6 +15,36 @@ import type { InferResponseType } from 'hono'
|
|
|
// 类型定义
|
|
|
type PersonalInfoResponse = InferResponseType<typeof talentDashboardClient.personal.info.$get, 200>
|
|
|
|
|
|
+/**
|
|
|
+ * 人才用户信息类型
|
|
|
+ * 基于 TalentMeResponseSchema 定义(从后端Schema推断)
|
|
|
+ */
|
|
|
+interface TalentUserInfo {
|
|
|
+ id: number
|
|
|
+ username: string
|
|
|
+ userType: string
|
|
|
+ personId: number | null
|
|
|
+ phone: string | null
|
|
|
+ nickname: string | null
|
|
|
+ name: string | null
|
|
|
+ avatarFileId: number | null
|
|
|
+ personInfo: {
|
|
|
+ id: number
|
|
|
+ name: string
|
|
|
+ gender: string
|
|
|
+ idCard: string
|
|
|
+ disabilityId: string
|
|
|
+ disabilityType: string
|
|
|
+ disabilityLevel: string
|
|
|
+ phone: string
|
|
|
+ province: string
|
|
|
+ city: string
|
|
|
+ district: string | null
|
|
|
+ detailedAddress: string | null
|
|
|
+ jobStatus: number
|
|
|
+ } | null
|
|
|
+}
|
|
|
+
|
|
|
// 模拟打卡数据(P2延期功能)
|
|
|
interface ClockInData {
|
|
|
status: '已打卡' | '未打卡'
|
|
|
@@ -42,7 +72,9 @@ const formatCurrentDate = (): string => {
|
|
|
}
|
|
|
|
|
|
const Dashboard: React.FC = () => {
|
|
|
- const { user, refreshUser } = useAuth()
|
|
|
+ const { user: userFromAuth, refreshUser } = useAuth()
|
|
|
+ // 类型转换:因为 InferResponseType 在某些情况下推断为 never
|
|
|
+ const user = userFromAuth as TalentUserInfo | null
|
|
|
const [_personalInfo, _setPersonalInfo] = React.useState<PersonalInfoResponse | null>(null)
|
|
|
const [_loading, _setLoading] = React.useState(true)
|
|
|
|