|
|
|
@ -2,10 +2,10 @@
|
|
|
|
|
import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
|
|
import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox, Form } from 'antd';
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
|
import { useParams, useRequest,history } from 'umi';
|
|
|
|
|
import { useParams, useRequest, history } from 'umi';
|
|
|
|
|
import { useEffect, useRef, useState } from 'react';
|
|
|
|
|
const { Text, Link } = Typography;
|
|
|
|
|
import { getRulesPaper, getPaperQuestionList, finishExamination,getPersonPaperId } from './examAnser';
|
|
|
|
|
import { getRulesPaper, getPaperQuestionList, finishExamination, getPersonPaperId } from './examAnser';
|
|
|
|
|
import type { CardListItemDataType } from '../data';
|
|
|
|
|
import styles from './style.less';
|
|
|
|
|
import cookie from 'react-cookies';
|
|
|
|
@ -103,7 +103,7 @@ const CardList = () => {
|
|
|
|
|
const { loading, data } = useRequest(() => {
|
|
|
|
|
return getPersonPaperId({
|
|
|
|
|
examination_id: params.examination_id,
|
|
|
|
|
person_id:cookie.load('person_id')
|
|
|
|
|
person_id: cookie.load('person_id')
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -132,27 +132,27 @@ const CardList = () => {
|
|
|
|
|
// 试题列表
|
|
|
|
|
|
|
|
|
|
const paperList = result.question_list;
|
|
|
|
|
let arr=[[],[],[]];
|
|
|
|
|
let question_type_count=[
|
|
|
|
|
{count:0,question_type:0,type_name:'单选'},
|
|
|
|
|
{count:0,question_type:1,type_name:'多选'},
|
|
|
|
|
{count:0,question_type:2,type_name:'填空'},
|
|
|
|
|
const arr = [[], [], []];
|
|
|
|
|
const question_type_count = [
|
|
|
|
|
{ count: 0, question_type: 0, type_name: '单选' },
|
|
|
|
|
{ count: 0, question_type: 1, type_name: '多选' },
|
|
|
|
|
{ count: 0, question_type: 2, type_name: '填空' },
|
|
|
|
|
];
|
|
|
|
|
if(result.question_list.length!==0){
|
|
|
|
|
if (result.question_list.length !== 0) {
|
|
|
|
|
setRuleId(result.question_list[0].rules_id)
|
|
|
|
|
result.question_list.forEach((item)=>{
|
|
|
|
|
if(item.question_type===0){
|
|
|
|
|
result.question_list.forEach((item) => {
|
|
|
|
|
if (item.question_type === 0) {
|
|
|
|
|
arr[0].push(item)
|
|
|
|
|
}else if(item.question_type===1){
|
|
|
|
|
} else if (item.question_type === 1) {
|
|
|
|
|
arr[1].push(item)
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
arr[2].push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
question_type_count[0].count=arr[0].length;
|
|
|
|
|
question_type_count[1].count=arr[1].length;
|
|
|
|
|
question_type_count[2].count=arr[2].length;
|
|
|
|
|
question_type_count[0].count = arr[0].length;
|
|
|
|
|
question_type_count[1].count = arr[1].length;
|
|
|
|
|
question_type_count[2].count = arr[2].length;
|
|
|
|
|
|
|
|
|
|
const qList = question_type_count
|
|
|
|
|
const questionList: any[] = []
|
|
|
|
@ -179,7 +179,9 @@ const CardList = () => {
|
|
|
|
|
const questionInfo = []
|
|
|
|
|
for (let i = 0; i < questionList.length; i++) {
|
|
|
|
|
questionList[i].children.map((e, index) => {
|
|
|
|
|
questionInfo.push({ ...e, index: index })
|
|
|
|
|
questionInfo.push({ ...e, index: [i, index] })
|
|
|
|
|
questionList[i].children[index].index = [i, index]
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -203,9 +205,9 @@ const CardList = () => {
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (result, params) => {
|
|
|
|
|
if(result.success){
|
|
|
|
|
const time=new Date(timeData).getTime();
|
|
|
|
|
const timeDiff=params.duration/1000-time;
|
|
|
|
|
if (result.success) {
|
|
|
|
|
const time = new Date(timeData).getTime();
|
|
|
|
|
const timeDiff = params.duration / 1000 - time;
|
|
|
|
|
// console.log('timeDiff',timeDiff)
|
|
|
|
|
history.push(`/dashboard/qualification/result/${result.data.pass_score}/${result.data.score}/${result.data.sum_score}/${params.examination_id}/${params.examination_name}/${timeDiff}`);
|
|
|
|
|
}
|
|
|
|
@ -324,7 +326,7 @@ const CardList = () => {
|
|
|
|
|
paperInfo.map((e) => {
|
|
|
|
|
if (e.id === item.id) {
|
|
|
|
|
// 重写单选的label、value,index:保存当前试题的index。
|
|
|
|
|
setQuestionNow({ ...item, index: e.index })
|
|
|
|
|
setQuestionNow({ ...item })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -384,10 +386,10 @@ const CardList = () => {
|
|
|
|
|
// 修改答题卡状态 写入答案以及修改答题状态
|
|
|
|
|
const qX = questionNow?.question_type;
|
|
|
|
|
const qI = questionNow?.index;
|
|
|
|
|
questionList[qX].children[qI].answerSelect = questionAnswer;
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].answerSelect = questionAnswer;
|
|
|
|
|
// 答题状态
|
|
|
|
|
questionList[qX].children[qI].state = 1
|
|
|
|
|
questionList[qX].children[qI].answerId = item.id
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].state = 1
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].answerId = item.id
|
|
|
|
|
// 提交答题卡
|
|
|
|
|
setQuestionTypeList(questionList)
|
|
|
|
|
|
|
|
|
@ -413,10 +415,10 @@ const CardList = () => {
|
|
|
|
|
// 修改答题卡状态 写入答案以及修改答题状态
|
|
|
|
|
const qX = questionNow?.question_type;
|
|
|
|
|
const qI = questionNow?.index;
|
|
|
|
|
questionList[qX].children[qI].answerSelect = questionAnswer;
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].answerSelect = questionAnswer;
|
|
|
|
|
// 答题状态
|
|
|
|
|
questionList[qX].children[qI].state = 1
|
|
|
|
|
questionList[qX].children[qI].answerId = e
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].state = 1
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].answerId = e
|
|
|
|
|
// 提交答题卡
|
|
|
|
|
setQuestionTypeList(questionList)
|
|
|
|
|
|
|
|
|
@ -451,10 +453,10 @@ const CardList = () => {
|
|
|
|
|
// 修改答题卡状态 写入答案以及修改答题状态
|
|
|
|
|
const qX = questionNow?.question_type;
|
|
|
|
|
const qI = questionNow?.index;
|
|
|
|
|
questionList[qX].children[qI].answerSelect = questionAnswer;
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].answerSelect = questionAnswer;
|
|
|
|
|
// 答题状态
|
|
|
|
|
questionList[qX].children[qI].state = 1
|
|
|
|
|
questionList[qX].children[qI].answerId = item.id
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].state = 1
|
|
|
|
|
questionList[questionNow.index[0]].children[questionNow.index[1]].answerId = item.id
|
|
|
|
|
// 提交答题卡
|
|
|
|
|
setQuestionTypeList(questionList)
|
|
|
|
|
|
|
|
|
@ -503,9 +505,9 @@ const CardList = () => {
|
|
|
|
|
const nextTemp = paperInfo[i - 1]
|
|
|
|
|
const questionList = questionTypeList
|
|
|
|
|
let nextData = {}
|
|
|
|
|
questionList[nextTemp.question_type].children.map((item, index) => {
|
|
|
|
|
questionList[nextTemp.index[0]].children.map((item, index) => {
|
|
|
|
|
if (item.id === nextTemp.id) {
|
|
|
|
|
nextData = { ...item, index: index }
|
|
|
|
|
nextData = item
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
setQuestionNow(nextData)
|
|
|
|
@ -528,9 +530,9 @@ const CardList = () => {
|
|
|
|
|
const nextTemp = paperInfo[i + 1]
|
|
|
|
|
const questionList = questionTypeList
|
|
|
|
|
let nextData = {}
|
|
|
|
|
questionList[nextTemp.question_type].children.map((item, index) => {
|
|
|
|
|
questionList[nextTemp.index[0]].children.map((item, index) => {
|
|
|
|
|
if (item.id === nextTemp.id) {
|
|
|
|
|
nextData = { ...item, index: index }
|
|
|
|
|
nextData = item
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
setQuestionNow(nextData)
|
|
|
|
@ -557,7 +559,7 @@ const CardList = () => {
|
|
|
|
|
|
|
|
|
|
const questionFinish = {
|
|
|
|
|
answers: JSON.stringify(questionFinishId),
|
|
|
|
|
examination_id:params.examination_id,
|
|
|
|
|
examination_id: params.examination_id,
|
|
|
|
|
person_id: cookie.load('person_id'),
|
|
|
|
|
paper_id: rulesPaperInfo
|
|
|
|
|
}
|
|
|
|
|