zhengpengju 3 years ago
commit c1637853e4

@ -215,6 +215,11 @@ const Login: React.FC = () => {
/>
</>
)}
<div style={{textAlign:'right',cursor:'pointer',color:'#1890FF',marginBottom:'1rem'}}
onClick={()=>{
window.open("http://10.10.14.199/dsideal_yy/html/pwdfind/pwdfind_fir.html?register_flag=11","_blaknk");
}}
></div>
</LoginForm>
</div>
<Footer />

@ -7,7 +7,7 @@ import { PageContainer } from '@ant-design/pro-layout';
import moment from 'moment';
import EditableLinkGroup from './components/EditableLinkGroup';
import styles from './style.less';
import {getExaminationById,getExaminationRuleById ,getPersonPaperId,getCurrentDate } from './service';
import {getExaminationById,getExaminationRuleById ,getPersonPaperId,getCurrentDate,savePersonAnswerTime,getPersonAnswerTime } from './service';
import cookie from 'react-cookies';
import OfflineData from './components/OfflineData';
@ -87,15 +87,34 @@ const Qualification = () => {
</div>
<div style={{textAlign:'center'}}>
<Button type={"primary"} onClick={async() => {
if(paperId===''){
message.warning('您已参加过考试,不能开始考试!');
}else {
// const time = await getCurrentDate();
// getTime(time);
const time=rule.examination_time*60;
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}`)
try {
const info=await savePersonAnswerTime({
examination_id:params.examination_id,
paper_id:paperId,
examination_time:rule.examination_time,
person_id:cookie.load('person_id')
})
console.log('startExam------',info)
// const time = await getCurrentDate();
// getTime(time);
const time=rule.examination_time*60;
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}`)
}catch (error) {
if(error.response){
message.error(error.response.info);
}
}
}
}
}

@ -44,6 +44,17 @@ export async function getExaminationPersonApplyInfo(params: {
});
}
//
export async function savePersonAnswerTime(params: {
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/examination/savePersonAnswerTime', {
params,
});
}

@ -1,6 +1,6 @@
import type { FC } from 'react';
import { useEffect } from 'react';
import { Avatar, Card, Col, List, Skeleton, Row, Statistic, Descriptions, Progress, Table, Button, Image } from 'antd';
import { useEffect,useState } from 'react';
import {message, Avatar, Card, Col, List, Skeleton, Row, Statistic, Descriptions, Progress, Table, Button, Image } from 'antd';
import { Line, Radar } from '@ant-design/charts';
import { Link, history, useRequest } from 'umi';
import { PageContainer } from '@ant-design/pro-layout';
@ -8,7 +8,7 @@ import moment from 'moment';
import EditableLinkGroup from './components/EditableLinkGroup';
import styles from './style.less';
import ProTable from '@ant-design/pro-table';
import { personLastLearning, personLearningDayStatistics, getPersonExaminationList, getExaminationList } from './service';
import {getPersonPaperId,getExaminationById, personLastLearning, personLearningDayStatistics, getPersonExaminationList, getExaminationList,getPersonAnswerTime } from './service';
import cookie from 'react-cookies';
import OfflineData from './components/OfflineData';
@ -51,59 +51,6 @@ const examinations = [
},
];
/** 考试字段 */
const examinationColumns = [
{
title: '考试项目',
dataIndex: 'examination_name',
key: 'name',
},
{
title: '报名时间',
dataIndex: 'appyTime',
key: 'appyTime',
render: (dom, entity) => {
return <div>{entity.apply_start_time}<br />{entity.apply_end_time}</div>
},
},
{
title: '考试时间',
dataIndex: 'examTime',
key: 'examTime',
render: (dom, entity) => {
return <div>{entity.examination_start_time}<br />{entity.examination_end_time}</div>
},
},
{
title: '操作',
dataIndex: 'option',
key: 'option',
render: (_, record, index, action) => {
// return record?.status === 0 ? <Button type="primary" onClick={() => { history.push('/registration' + record.examination_id) }}>去报名</Button> : <Button type="primary" onClick={() => { history.push('/examination/paper') }}> 参加考试</Button >
switch (record.status_type) {
case 0://待报名
return <Button disabled></Button>
break;
case 1://报名中
return <Button type={"primary"} disabled={record.is_apply} onClick={() => { history.push('/registration/' + record.examination_id) }}></Button>//判断
break;
case 2://待考试
return <Button disabled></Button>
break;
case 3://考试中
return <Button disabled={!record.is_apply} type={"primary"} onClick={() => { history.push('/dashboard/qualification/' + record.examination_id) }}></Button>
break;
case 4:
return "考试完成"
break;
default:
break;
}
},
},
];
/** 证书字段 */
const certificateColumns = [
@ -178,6 +125,132 @@ const certificates = [
];
const Workplace: FC = () => {
const [examInfo, setExamInfo] = useState({});
/** 考试字段 */
const examinationColumns = [
{
title: '考试项目',
dataIndex: 'examination_name',
key: 'name',
},
{
title: '报名时间',
dataIndex: 'appyTime',
key: 'appyTime',
render: (dom, entity) => {
return <div>{entity.apply_start_time}<br />{entity.apply_end_time}</div>
},
},
{
title: '考试时间',
dataIndex: 'examTime',
key: 'examTime',
render: (dom, entity) => {
return <div>{entity.examination_start_time}<br />{entity.examination_end_time}</div>
},
},
{
title: '操作',
dataIndex: 'option',
key: 'option',
render: (_, record, index, action) => {
// return record?.status === 0 ? <Button type="primary" onClick={() => { history.push('/registration' + record.examination_id) }}>去报名</Button> : <Button type="primary" onClick={() => { history.push('/examination/paper') }}> 参加考试</Button >
switch (record.status_type) {
case 0://待报名
return <Button disabled></Button>
break;
case 1://报名中
return <Button type={"primary"} disabled={record.is_apply} onClick={() => { history.push('/registration/' + record.examination_id) }}></Button>//判断
break;
case 2://待考试
return <Button disabled></Button>
break;
case 3://考试中
return <Button disabled={!record.is_apply}
type={"primary"}
onClick={async() => {
console.log(111111)
try {
const info=await getPersonAnswerTime({
examination_id:record.examination_id,
person_id:cookie.load('person_id')
});
setExamInfo(info.bean)
if(info.bean===''){
history.push('/dashboard/qualification/' + record.examination_id)
}else {
if(!info.bean.is_finish){
const time1 = info.bean.curr_time.replace(/\-/g, "/");
const time2 = info.bean.failure_time.replace(/\-/g, "/");
const startTime=new Date(time1).getTime()
const endTime=new Date(time2).getTime()
const time_diff=(endTime-startTime)/1000;
console.log('time_diff',time_diff)
getExamInfo(record.examination_id,time_diff)
}else {
getParperId(record.examination_id)
}
// history.push(`/dashboard/qualification/examAnswer/${record.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}`)
}
console.log('info',info)
}catch (error) {
if(error.response){
message.error(error.response.info);
}else {
}
}
}}>
</Button>
break;
case 4:
return "考试完成"
break;
default:
break;
}
},
},
];
const getExamInfo=async (id,time)=>{
try {
const info=await getExaminationById({examination_id:id});
console.log('info--------------------',info)
console.log('time',time)
history.push(`/dashboard/qualification/examAnswer/${id}/${info.bean.rules_id}/${info.bean.examination_name}/${time}`)
}catch (error) {
if(error.response){
message.error(error.response.info);
}
}
}
const getParperId=async (id)=>{
try {
const info=await getPersonPaperId({
examination_id:id,
person_id:cookie.load('person_id')
});
console.log('info--------------------',info)
if(info.paper_id===''){
message.warning('考试失败!')
}else {
history.push('/dashboard/qualification/' + id)
}
}catch (error) {
if(error.response){
message.error(error.response.info);
}
}
}
// 当前学习
const { loading: lastLearningLoading, data: lastLearningList = [] } = useRequest(

@ -4,8 +4,8 @@ import type { NoticeType, ActivitiesType, AnalysisData } from './data';
/**
* 6.4
* /dsideal_yy/ypt/careerTraining/report/personLearningDayStatistics
* @param params
* @returns
* @param params
* @returns
*/
export async function personLearningDayStatistics(params: {
page_size: number;
@ -18,8 +18,8 @@ export async function personLearningDayStatistics(params: {
/**
* 6.5
* /dsideal_yy/ypt/careerTraining/report/personLastLearning
* @param params
* @returns
* @param params
* @returns
*/
export async function personLastLearning(params: {
page_size: number;
@ -32,8 +32,8 @@ export async function personLastLearning(params: {
/**
* 01
* /dsideal_yy/zygh/training/examination/getExaminationList
* @param params
* @returns
* @param params
* @returns
*/
export async function getExaminationList(params: {
page_size: number;
@ -48,8 +48,8 @@ export async function getExaminationList(params: {
/**
* 01
* /dsideal_yy/zygh/training/examination/getPersonExaminationList
* @param params
* @returns
* @param params
* @returns
*/
export async function getPersonExaminationList(params: {
page_size: number;
@ -84,3 +84,37 @@ export async function fakeChartData(): Promise<{ data: AnalysisData }> {
// return request('/api/fake_workplace_chart_data');
return request('/api/fake_analysis_chart_data');
}
export async function getPersonAnswerTime(params: {
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy//zygh/training/examination/getPersonAnswerTime', {
params,
});
}
// 获取人员信息
export async function getExaminationById(params: {
examination_id: number;
}) {
return request(' /dsideal_yy/zygh/training/examination/getExaminationById', {
params,
});
}
//获取当前时间
export async function getCurrentDate(params: {
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/examination/getCurrentDate', {
params,
});
}
//13 开始考试前获取试卷id
export async function getPersonPaperId(params: {
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request(' /dsideal_yy/zygh/training/person/getPersonPaperId', {
params,
});
}

Loading…
Cancel
Save