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" name="faceId"
style={{ display: 'inline-block', width: '80%' }} style={{ display: 'inline-block', width: '80%' }}
rules={[{ required: true, message: "请上传照片" }]} 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" }} /> <ExpertPhotoUpload maxSize={200} uploadProps={{ accept: ".jpg,.jpeg" }} />
</Form.Item> </Form.Item>

View File

@ -1624,7 +1624,7 @@ const JudgingPanel: React.FC<{}> = () => {
name="faceId" name="faceId"
style={{ display: 'inline-block', width: '80%' }} style={{ display: 'inline-block', width: '80%' }}
rules={[{ required: reserveStatus, message: "请上传照片" }]} 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" }} /> <ExpertPhotoUpload maxSize={200} uploadProps={{ accept: ".jpg,.jpeg" }} />
</Form.Item> </Form.Item>

View File

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

View File

@ -22,6 +22,14 @@ export async function rgbToBase64(params: any) {
}); });
return request('/api/core-service-ebtp-userinfo/outer/v1/ebtp/face/rgbArray2Base64', { return request('/api/core-service-ebtp-userinfo/outer/v1/ebtp/face/rgbArray2Base64', {
method: 'post', method: 'post',
body:_body, body: _body,
}); });
} }
/**
* 是否显示人脸识别tab
* @param params
*/
export async function showFaceTab() {
return request('/api/biz-service-ebtp-extend//v1/BizFuncSwitchConfig/bizfuncswitchconfig/getFaceRecognitionFlag');
}