|
|
|
@ -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(
|
|
|
|
|