7.13 人脸识别打开并增加控制接口 修改上传人脸照片提示文字

This commit is contained in:
jl-zhoujl2
2023-07-13 14:22:54 +08:00
parent dce6a1514c
commit 1fe71d9e4f
5 changed files with 65 additions and 48 deletions

View File

@ -269,7 +269,7 @@ const OutsourcingManage: React.FC<OutsourcingManageProps> = (props) => {
name="faceId"
style={{ display: 'inline-block', width: '80%' }}
rules={[{ required: true, message: "请上传照片" }]}
extra={<span style={{ color: '#b30000' }}>2413*579pxpsJPG格式200k以下</span>}
extra={<span style={{ color: '#b30000' }}>2psJPG格式200k以下</span>}
>
<ExpertPhotoUpload maxSize={200} uploadProps={{ accept: ".jpg,.jpeg" }} />
</Form.Item>

View File

@ -1624,7 +1624,7 @@ const JudgingPanel: React.FC<{}> = () => {
name="faceId"
style={{ display: 'inline-block', width: '80%' }}
rules={[{ required: reserveStatus, message: "请上传照片" }]}
extra={<span style={{ color: '#b30000' }}>2413*579pxpsJPG格式200k以下</span>}
extra={<span style={{ color: '#b30000' }}>2psJPG格式200k以下</span>}
>
<ExpertPhotoUpload maxSize={200} uploadProps={{ accept: ".jpg,.jpeg" }} />
</Form.Item>

View File

@ -1493,7 +1493,7 @@ const JudgingPanel: React.FC<{}> = (props: any) => {
name="faceId"
style={{ display: 'inline-block', width: '80%' }}
rules={[{ required: reserveStatus, message: "请上传照片" }]}
extra={<span style={{ color: '#b30000' }}>2413*579pxpsJPG格式200k以下</span>}
extra={<span style={{ color: '#b30000' }}>2psJPG格式200k以下</span>}
>
<ExpertPhotoUpload maxSize={200} uploadProps={{ accept: ".jpg,.jpeg" }} />
</Form.Item>

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef } from 'react';
import { Form, Button, Input, Row, Col, Modal, Spin, message, Tabs } from 'antd';
import { UserOutlined, LockOutlined, SafetyCertificateOutlined } from '@ant-design/icons';
import './style.less';
import { changePass } from './service';
import { changePass, showFaceTab } from './service';
import logo from '@/images/login/logoPic.png';
import { refreshTokenApi, ZjfakeAccountLogin, ZjfakeFaceLogin } from '@/services/login';
import { history } from 'umi';
@ -40,6 +40,7 @@ const Index: React.FC<{}> = () => {
const { TabPane } = Tabs;
const [submitLoading, setSubmitLoading] = useState<boolean>(false);
const [faceLoginDisable, setFaceLoginDisable] = useState<boolean>(false);
const [faceLoginShow, setFaceLoginShow] = useState<boolean>(false);
const lv = useRef<LivingNotIE>();
const [timerShow, setTimeShow] = useState<boolean>(false);
const [itemShow, setItemShow] = useState<boolean>(false);
@ -496,6 +497,11 @@ const Index: React.FC<{}> = () => {
}
return false;
}
//是否显示人脸登录
const showFaceLogin = async () => {
const res = await showFaceTab();
setFaceLoginShow(res?.data === 1);
}
useEffect(() => {
@ -505,6 +511,7 @@ const Index: React.FC<{}> = () => {
if (!allowedToFaceLogin()) {
setFaceLoginDisable(true);
}
showFaceLogin();
}, []);
useEffect(() => {
@ -592,49 +599,51 @@ const Index: React.FC<{}> = () => {
</Form.Item>
</Form>
</TabPane>
{/* <TabPane tab="人脸识别登录" key="2" disabled={faceLoginDisable}>
<Form
name="basic2"
className="form-box"
initialValues={{ remember: true }}
form={form2}
// onFinish={hanleFaceSubmit.bind(this, null)}
onFinish={!whetherIE.current?liveDetectStart:hanleFaceSubmit.bind(this, null)}
// onFinishFailed={onFinishFailed}
>
<Form.Item
label=""
name="userName"
rules={[{ required: true, message: '请输入用户名!' }]}
{faceLoginShow && <>
<TabPane tab="人脸识别登录" key="2" disabled={faceLoginDisable}>
<Form
name="basic2"
className="form-box"
initialValues={{ remember: true }}
form={form2}
// onFinish={hanleFaceSubmit.bind(this, null)}
onFinish={!whetherIE.current ? liveDetectStart : hanleFaceSubmit.bind(this, null)}
// onFinishFailed={onFinishFailed}
>
<Input
prefix={
<UserOutlined style={{ fontSize: '18px' }} className="site-form-item-icon" />
}
placeholder="请输入用户名"
/>
</Form.Item>
<Form.Item>
{!whetherIE.current ? (<video ref={video} width="382" height="200"></video>) : (<FrameFaceLogin faceCompareEvent2={IELiveDetectFinish2} faceCompareEvent={IELiveDetectFinish} faceDetectStatusEvent = {UpdateDetectStatus}/>)}
</Form.Item>
<Form.Item>
<Button type="primary" className="w100" loading={submitLoading} htmlType="submit">
{submitLoading ? actionText(action, Math.round(timer/1000)) : '登 录'}
</Button>
</Form.Item>
</Form>
</TabPane> */}
{/* 加载摄像头 */}
{/* <Form.Item hidden={!itemShow}>
<div>
<span style={{color:classColor(action)}}>{actionText(action)}</span>
<span hidden={!timerShow}>{Math.round(timer/1000)}</span>
</div>
</Form.Item> */}
{/* <video ref={video} width="382" height="200"></video> */}
{/* onClick={() => {hanleFaceSubmit(null, null);}} */}
<Form.Item
label=""
name="userName"
rules={[{ required: true, message: '请输入用户名!' }]}
>
<Input
prefix={
<UserOutlined style={{ fontSize: '18px' }} className="site-form-item-icon" />
}
placeholder="请输入用户名"
/>
</Form.Item>
<Form.Item>
{!whetherIE.current ? (<video ref={video} width="382" height="200"></video>) : (<FrameFaceLogin faceCompareEvent2={IELiveDetectFinish2} faceCompareEvent={IELiveDetectFinish} faceDetectStatusEvent={UpdateDetectStatus} />)}
</Form.Item>
<Form.Item>
<Button type="primary" className="w100" loading={submitLoading} htmlType="submit">
{submitLoading ? actionText(action, Math.round(timer / 1000)) : '登 录'}
</Button>
</Form.Item>
</Form>
</TabPane>
{/* 加载摄像头 */}
<Form.Item hidden={!itemShow}>
<div>
<span style={{ color: classColor(action) }}>{actionText(action)}</span>
<span hidden={!timerShow}>{Math.round(timer / 1000)}</span>
</div>
</Form.Item>
<video ref={video} width="382" height="200"></video>
{/* onClick={() => {hanleFaceSubmit(null, null);}} */}
</>}
</Tabs>
</div>
</div>

View File

@ -17,11 +17,19 @@ export async function changePass(params: any) {
*/
export async function rgbToBase64(params: any) {
const _body = JSON.stringify({//post请求参数
type: 'pixel',
type: 'pixel',
rgb: params.image
});
return request('/api/core-service-ebtp-userinfo/outer/v1/ebtp/face/rgbArray2Base64', {
method: 'post',
body:_body,
body: _body,
});
}
/**
* 是否显示人脸识别tab
* @param params
*/
export async function showFaceTab() {
return request('/api/biz-service-ebtp-extend//v1/BizFuncSwitchConfig/bizfuncswitchconfig/getFaceRecognitionFlag');
}