|
|
@ -1,19 +1,22 @@
|
|
|
|
/** 资质考试 */
|
|
|
|
/** 资质考试 */
|
|
|
|
import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
|
import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
|
import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox } from 'antd';
|
|
|
|
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 { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
import { useParams, useRequest } from 'umi';
|
|
|
|
import { useParams, useRequest } from 'umi';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import { useRef, useState } from 'react';
|
|
|
|
const { Text, Link } = Typography;
|
|
|
|
const { Text, Link } = Typography;
|
|
|
|
import { getRulesPaper, getPaperQuestionList } from '../service';
|
|
|
|
import { getRulesPaper, getPaperQuestionList } from '../service';
|
|
|
|
import type { CardListItemDataType } from '../data';
|
|
|
|
import type { CardListItemDataType } from '../data';
|
|
|
|
import styles from './style.less';
|
|
|
|
import styles from './style.less';
|
|
|
|
import SubMenu from 'antd/lib/menu/SubMenu';
|
|
|
|
import SubMenu from 'antd/lib/menu/SubMenu';
|
|
|
|
import ProCard from '@ant-design/pro-card';
|
|
|
|
import ProCard from '@ant-design/pro-card';
|
|
|
|
|
|
|
|
import { getDirection } from '../../../.umi/plugin-locale/localeExports';
|
|
|
|
|
|
|
|
|
|
|
|
const { Paragraph } = Typography;
|
|
|
|
const { Paragraph } = Typography;
|
|
|
|
|
|
|
|
|
|
|
|
const CardList = () => {
|
|
|
|
const CardList = () => {
|
|
|
|
|
|
|
|
const formRef = useRef<ActionType>();
|
|
|
|
|
|
|
|
|
|
|
|
// 组卷详情查询
|
|
|
|
// 组卷详情查询
|
|
|
|
const [rulesPaperInfo, setRulesPaperInfo] = useState([]);
|
|
|
|
const [rulesPaperInfo, setRulesPaperInfo] = useState([]);
|
|
|
|
// 试题列表
|
|
|
|
// 试题列表
|
|
|
@ -66,7 +69,7 @@ const CardList = () => {
|
|
|
|
const paperList = result.question_list;
|
|
|
|
const paperList = result.question_list;
|
|
|
|
|
|
|
|
|
|
|
|
const qList = params[0].question_type_count
|
|
|
|
const qList = params[0].question_type_count
|
|
|
|
const questionList = []
|
|
|
|
const questionList: any[] = []
|
|
|
|
qList.map((e, i) => {
|
|
|
|
qList.map((e, i) => {
|
|
|
|
if (e.count > 0) {
|
|
|
|
if (e.count > 0) {
|
|
|
|
questionList.push({
|
|
|
|
questionList.push({
|
|
|
@ -75,11 +78,11 @@ const CardList = () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// 根据分类拆分试题 左侧答题卡
|
|
|
|
// 根据分类拆分试题 左侧答题卡 state:0 未答题 1 : 已答题
|
|
|
|
paperList.map((e) => {
|
|
|
|
paperList.map((e) => {
|
|
|
|
questionList.map((item, index) => {
|
|
|
|
questionList.map((item, index) => {
|
|
|
|
if (item.question_type == e.question_type) {
|
|
|
|
if (item.question_type == e.question_type) {
|
|
|
|
questionList[index].children.push({ ...e, question_type: item.question_type, answerSelect: "" })
|
|
|
|
questionList[index].children.push({ ...e, question_type: item.question_type, answerSelect: "", state: 0, answerId: "" })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -87,23 +90,32 @@ const CardList = () => {
|
|
|
|
// 根据答题卡生成考试顺序
|
|
|
|
// 根据答题卡生成考试顺序
|
|
|
|
const questionInfo = []
|
|
|
|
const questionInfo = []
|
|
|
|
for (let i = 0; i < questionList.length; i++) {
|
|
|
|
for (let i = 0; i < questionList.length; i++) {
|
|
|
|
console.log(questionList[i], 'iiii')
|
|
|
|
|
|
|
|
questionList[i].children.map((e, index) => {
|
|
|
|
questionList[i].children.map((e, index) => {
|
|
|
|
console.log(e, "num");
|
|
|
|
|
|
|
|
questionInfo.push({ ...e, index: index })
|
|
|
|
questionInfo.push({ ...e, index: index })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const nowQ = setLabVal(questionInfo[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setPaperInfo(questionInfo || [])
|
|
|
|
setPaperInfo(questionInfo || [])
|
|
|
|
setQuestionNow(questionInfo[0] || [])
|
|
|
|
setQuestionNow(nowQ || [])
|
|
|
|
setQuestionTypeList(questionList || [])
|
|
|
|
setQuestionTypeList(questionList || [])
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const setLabVal = (value: []) => {
|
|
|
|
|
|
|
|
const nowQ = value
|
|
|
|
|
|
|
|
console.log(nowQ, "888888");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nowQ.answers.map((e, i) => {
|
|
|
|
|
|
|
|
console.log(e, 'eeeeee');
|
|
|
|
|
|
|
|
nowQ.answers[i].label = e.answer
|
|
|
|
|
|
|
|
nowQ.answers[i].value = e.id
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return nowQ
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const content = (
|
|
|
|
const content = (
|
|
|
|
<div className={styles.pageHeaderContent}>
|
|
|
|
<div className={styles.pageHeaderContent}>
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
@ -161,9 +173,13 @@ const CardList = () => {
|
|
|
|
<PageContainer content={content} extraContent={false}>
|
|
|
|
<PageContainer content={content} extraContent={false}>
|
|
|
|
<Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={6} style={{ paddingRight: 24 }}>
|
|
|
|
<Col span={6} style={{ paddingRight: 24 }}>
|
|
|
|
|
|
|
|
<Button onClick={() => {
|
|
|
|
|
|
|
|
formRef?.current.setFieldsValue({ note: '11' });
|
|
|
|
|
|
|
|
}}>111111</Button>
|
|
|
|
<ProCard
|
|
|
|
<ProCard
|
|
|
|
title="题号列表"
|
|
|
|
title="题号列表"
|
|
|
|
bordered
|
|
|
|
bordered
|
|
|
|
|
|
|
|
className='answerSheet'
|
|
|
|
headStyle={{ padding: 24, border: '#d9d9d9 solid 1px' }}
|
|
|
|
headStyle={{ padding: 24, border: '#d9d9d9 solid 1px' }}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{console.log("当前题号:", questionNow, "试题顺序:", paperInfo, "二维数组:", questionTypeList)}
|
|
|
|
{console.log("当前题号:", questionNow, "试题顺序:", paperInfo, "二维数组:", questionTypeList)}
|
|
|
@ -172,7 +188,7 @@ const CardList = () => {
|
|
|
|
questionTypeList && (
|
|
|
|
questionTypeList && (
|
|
|
|
|
|
|
|
|
|
|
|
questionTypeList.map((e, i) => {
|
|
|
|
questionTypeList.map((e, i) => {
|
|
|
|
console.log(e.children, 'e.children')
|
|
|
|
|
|
|
|
return <List
|
|
|
|
return <List
|
|
|
|
key={i}
|
|
|
|
key={i}
|
|
|
|
header={e.type_name}
|
|
|
|
header={e.type_name}
|
|
|
@ -185,12 +201,27 @@ const CardList = () => {
|
|
|
|
id={item.id}
|
|
|
|
id={item.id}
|
|
|
|
> <Button
|
|
|
|
> <Button
|
|
|
|
className={
|
|
|
|
className={
|
|
|
|
`pdefault ${questionNow.id === item.id ? "pact" : ""} ${item.answertrue === item.answerSelect ? "pok" : ""}`
|
|
|
|
`pdefault ${item.state === 1 ? "pok" : ""} ${questionNow.id === item.id ? "pact" : ""}`
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onClick={() => {
|
|
|
|
onClick={() => {
|
|
|
|
|
|
|
|
// 查看解析关闭
|
|
|
|
setParsingShow(false)
|
|
|
|
setParsingShow(false)
|
|
|
|
setQuestionNow(item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paperInfo.map((e) => {
|
|
|
|
|
|
|
|
if (e.id === item.id) {
|
|
|
|
|
|
|
|
console.log(e.id, e.index, item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dQ = setLabVal(item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setQuestionNow({ ...dQ, index: e.index })
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(questionTypeList);
|
|
|
|
|
|
|
|
formRef?.current.setFieldsValue({ note: e.answerId });
|
|
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>{index}</Button> </List.Item>
|
|
|
|
>{index}</Button> </List.Item>
|
|
|
|
}}
|
|
|
|
}}
|
|
|
@ -227,34 +258,99 @@ const CardList = () => {
|
|
|
|
headerBordered
|
|
|
|
headerBordered
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}>
|
|
|
|
<Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}>
|
|
|
|
|
|
|
|
{/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Space direction="vertical">
|
|
|
|
|
|
|
|
<Radio.Group
|
|
|
|
|
|
|
|
options={questionNow.answers}
|
|
|
|
|
|
|
|
onChange={(item) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const qArr = []
|
|
|
|
|
|
|
|
// 默认输出答案0,0,0,0
|
|
|
|
|
|
|
|
questionNow?.answers?.map((e, i) => {
|
|
|
|
|
|
|
|
console.log(e, i, "ei");
|
|
|
|
|
|
|
|
item.target.value === e.id ? qArr.push("1") : qArr.push("0")
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(qArr, 'Arr')
|
|
|
|
|
|
|
|
const questionList = questionTypeList
|
|
|
|
|
|
|
|
const questionAnswer = qArr.join(",")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改答题卡状态 写入答案以及修改答题状态
|
|
|
|
|
|
|
|
const qX = questionNow?.question_type;
|
|
|
|
|
|
|
|
const qI = questionNow?.index;
|
|
|
|
|
|
|
|
questionList[qX].children[qI].answerSelect = questionAnswer;
|
|
|
|
|
|
|
|
// 答题状态
|
|
|
|
|
|
|
|
questionList[qX].children[qI].state = 1
|
|
|
|
|
|
|
|
questionList[qX].children[qI].answerId = item.target.value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(questionList, 'questionList11', questionAnswer)
|
|
|
|
|
|
|
|
// 提交答题卡
|
|
|
|
|
|
|
|
setQuestionTypeList(questionList)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log('0', questionList, questionNow, item, qX, qI, questionList[qX].children[qI].answerSelect, questionAnswer)
|
|
|
|
|
|
|
|
}} defaultValue={questionNow.answerId} />
|
|
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/}
|
|
|
|
|
|
|
|
|
|
|
|
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
|
|
|
|
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
|
|
|
|
{questionNow?.question_stem}
|
|
|
|
{questionNow?.question_stem}
|
|
|
|
|
|
|
|
{console.log(questionNow.answerId, 'answerId', questionNow.answerId)}
|
|
|
|
</Typography>
|
|
|
|
</Typography>
|
|
|
|
<Radio.Group onChange={() => { return true }} value={0} size="large">
|
|
|
|
<Space direction="vertical" style={{ fontSize: 16 }}>
|
|
|
|
<Space direction="vertical" style={{ fontSize: 16 }}>
|
|
|
|
{questionNow.question_type === 0 ?
|
|
|
|
{questionNow.question_type === 0 ?
|
|
|
|
|
|
|
|
(<Radio.Group><Space direction="vertical">{questionNow?.answers?.map((item, index) => {
|
|
|
|
(
|
|
|
|
return <Radio key={item.id} onChange={() => {
|
|
|
|
<Form
|
|
|
|
const qArr = []
|
|
|
|
ref={formRef} name="control-ref"
|
|
|
|
questionNow?.answers?.map(() => {
|
|
|
|
>
|
|
|
|
qArr.push("0")
|
|
|
|
<Form.Item name="note" label="Note" rules={[{ required: true }]}>
|
|
|
|
})
|
|
|
|
<Radio.Group
|
|
|
|
qArr[index] = item.is_true
|
|
|
|
|
|
|
|
const questionAnswer = qArr.join(",")
|
|
|
|
defaultValue={questionNow.answerId}>
|
|
|
|
const paperInfoTemp = paperInfo
|
|
|
|
<Space direction="vertical">{questionNow?.answers?.map((item, index) => {
|
|
|
|
paperInfoTemp[questionNow.index].answerSelect = questionAnswer
|
|
|
|
console.log(item, 'item')
|
|
|
|
setPaperInfo(paperInfoTemp || [])
|
|
|
|
return <Radio key={item.id}
|
|
|
|
console.log('0', paperInfoTemp, questionNow.index)
|
|
|
|
onChange={() => {
|
|
|
|
}} value={item.id} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Radio>
|
|
|
|
const qArr = []
|
|
|
|
})}</Space></Radio.Group>) : questionNow.question_type === 1 ? questionNow?.answers?.map((item, index) => {
|
|
|
|
// 默认输出答案0,0,0,0
|
|
|
|
return <Checkbox key={item.id} value={1} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Checkbox>
|
|
|
|
questionNow?.answers?.map(() => {
|
|
|
|
}) : questionNow.question_type === 2 ? questionNow?.answers?.map((item, index) => {
|
|
|
|
qArr.push("0")
|
|
|
|
return <Radio key={item.id} value={1} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Radio>
|
|
|
|
})
|
|
|
|
}) : ""}
|
|
|
|
// 修改用户答案
|
|
|
|
|
|
|
|
qArr[index] = item.is_true
|
|
|
|
</Space>
|
|
|
|
|
|
|
|
</Radio.Group>
|
|
|
|
const questionList = questionTypeList
|
|
|
|
|
|
|
|
const questionAnswer = qArr.join(",")
|
|
|
|
|
|
|
|
// 修改答题卡状态 写入答案以及修改答题状态
|
|
|
|
|
|
|
|
const qX = questionNow?.question_type;
|
|
|
|
|
|
|
|
const qI = questionNow?.index;
|
|
|
|
|
|
|
|
questionList[qX].children[qI].answerSelect = questionAnswer;
|
|
|
|
|
|
|
|
// 答题状态
|
|
|
|
|
|
|
|
questionList[qX].children[qI].state = 1
|
|
|
|
|
|
|
|
questionList[qX].children[qI].answerId = item.id
|
|
|
|
|
|
|
|
// 提交答题卡
|
|
|
|
|
|
|
|
setQuestionTypeList(questionList)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log('0', questionList, questionNow, item, qX, qI, questionList[qX].children[qI].answerSelect, questionAnswer)
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
value={item.id}
|
|
|
|
|
|
|
|
style={{ padding: 5, fontSize: 16 }}
|
|
|
|
|
|
|
|
>{tiNum(index)}{item.answer}</Radio>
|
|
|
|
|
|
|
|
})}</Space></Radio.Group>
|
|
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
) : questionNow.question_type === 1 ? questionNow?.answers?.map((item, index) => {
|
|
|
|
|
|
|
|
return <Checkbox key={item.id} value={1} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Checkbox>
|
|
|
|
|
|
|
|
}) : questionNow.question_type === 2 ? questionNow?.answers?.map((item, index) => {
|
|
|
|
|
|
|
|
return <Radio key={item.id} value={1} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer}</Radio>
|
|
|
|
|
|
|
|
}) : ""}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
|
|
|
|
|
|
<Radio.Group onChange={() => { return true }} value={0} size="large">
|
|
|
|
<Radio.Group onChange={() => { return true }} value={0} size="large">
|
|
|
|
<Space direction="vertical" style={{ fontSize: 16 }}>
|
|
|
|
<Space direction="vertical" style={{ fontSize: 16 }}>
|
|
|
|