|
@@ -6,6 +6,7 @@ import { Navbar } from '@d8d/mini-shared-ui-components/components/navbar'
|
|
|
import { useAuth, useRequireAuth } from '../../hooks'
|
|
import { useAuth, useRequireAuth } from '../../hooks'
|
|
|
import { talentDashboardClient } from '../../api'
|
|
import { talentDashboardClient } from '../../api'
|
|
|
import type { InferResponseType } from 'hono'
|
|
import type { InferResponseType } from 'hono'
|
|
|
|
|
+import { generateMockAttendanceData, getCurrentYearMonth } from '../../utils/mockAttendanceData'
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 人才小程序首页/个人主页
|
|
* 人才小程序首页/个人主页
|
|
@@ -81,6 +82,12 @@ const Dashboard: React.FC = () => {
|
|
|
// 添加认证保护
|
|
// 添加认证保护
|
|
|
useRequireAuth()
|
|
useRequireAuth()
|
|
|
|
|
|
|
|
|
|
+ // 获取当前月份考勤统计数据
|
|
|
|
|
+ const { stats: attendanceStats } = (() => {
|
|
|
|
|
+ const { year, month } = getCurrentYearMonth()
|
|
|
|
|
+ return generateMockAttendanceData(year, month)
|
|
|
|
|
+ })()
|
|
|
|
|
+
|
|
|
// 模拟打卡数据
|
|
// 模拟打卡数据
|
|
|
const clockInData: ClockInData = {
|
|
const clockInData: ClockInData = {
|
|
|
status: '已打卡',
|
|
status: '已打卡',
|
|
@@ -220,11 +227,11 @@ const Dashboard: React.FC = () => {
|
|
|
{/* 3列统计数据 */}
|
|
{/* 3列统计数据 */}
|
|
|
<View className="flex justify-between mt-4">
|
|
<View className="flex justify-between mt-4">
|
|
|
<View className="flex flex-col items-center">
|
|
<View className="flex flex-col items-center">
|
|
|
- <Text className="text-white text-2xl font-bold">29</Text>
|
|
|
|
|
|
|
+ <Text className="text-white text-2xl font-bold">{attendanceStats.normalDays}</Text>
|
|
|
<Text className="text-white/80 text-xs">本月出勤</Text>
|
|
<Text className="text-white/80 text-xs">本月出勤</Text>
|
|
|
</View>
|
|
</View>
|
|
|
<View className="flex flex-col items-center">
|
|
<View className="flex flex-col items-center">
|
|
|
- <Text className="text-white text-2xl font-bold">0</Text>
|
|
|
|
|
|
|
+ <Text className="text-white text-2xl font-bold">{attendanceStats.lateCount + attendanceStats.earlyLeaveCount + attendanceStats.absentCount}</Text>
|
|
|
<Text className="text-white/80 text-xs">异常记录</Text>
|
|
<Text className="text-white/80 text-xs">异常记录</Text>
|
|
|
</View>
|
|
</View>
|
|
|
<View className="flex flex-col items-center">
|
|
<View className="flex flex-col items-center">
|