Browse Source

AI: 在考勤记录中添加人脸识别照片字段

D8D AI 1 year ago
parent
commit
31009e7b5d
2 changed files with 11 additions and 5 deletions
  1. 4 4
      src/api/deviceApi.js
  2. 7 1
      src/components/AttendanceSystem.jsx

+ 4 - 4
src/api/deviceApi.js

@@ -34,10 +34,10 @@ let mockData = [
 
 // 模拟考勤记录
 let mockAttendanceRecords = [
-  { personId: '1', name: '张三', timestamp: '2024-10-22T09:00:00Z' },
-  { personId: '2', name: '李四', timestamp: '2024-10-22T09:15:00Z' },
-  { personId: '1', name: '张三', timestamp: '2024-10-23T08:55:00Z' },
-  { personId: '2', name: '李四', timestamp: '2024-10-23T09:05:00Z' },
+  { personId: '1', name: '张三', timestamp: '2024-10-22T09:00:00Z', facePhoto: 'https://example.com/face1.jpg' },
+  { personId: '2', name: '李四', timestamp: '2024-10-22T09:15:00Z', facePhoto: 'https://example.com/face2.jpg' },
+  { personId: '1', name: '张三', timestamp: '2024-10-23T08:55:00Z', facePhoto: 'https://example.com/face3.jpg' },
+  { personId: '2', name: '李四', timestamp: '2024-10-23T09:05:00Z', facePhoto: 'https://example.com/face4.jpg' },
 ];
 
 export const deviceApi = {

+ 7 - 1
src/components/AttendanceSystem.jsx

@@ -1,5 +1,5 @@
 import React, { useState, useEffect } from 'react';
-import { Card, List, Typography, Spin, Table, DatePicker } from 'antd';
+import { Card, List, Typography, Spin, Table, DatePicker, Image } from 'antd';
 import { deviceApi } from '../api/deviceApi';
 import moment from 'moment';
 
@@ -60,6 +60,12 @@ const AttendanceSystem = () => {
       key: 'timestamp',
       render: (text) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
     },
+    {
+      title: '人脸识别照片',
+      dataIndex: 'facePhoto',
+      key: 'facePhoto',
+      render: (photo) => photo ? <Image src={photo} width={50} /> : '无照片',
+    },
   ];
 
   return (