diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index 41ca3d7..dba752f 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; import { useRequest, history } from 'umi'; import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form, Popconfirm } from 'antd'; +import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form, Popconfirm, Typography } from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import type { ActionType } from '@ant-design/pro-table'; import type { ProColumns } from '@ant-design/pro-table'; @@ -296,10 +296,9 @@ const ExaminationList: React.FC = () => { }} > - {record.b_use == 1 ? "已发布" : "未发布"} + {record.b_use == 1 ? 已发布 : 未发布} @@ -312,9 +311,6 @@ const ExaminationList: React.FC = () => { record.apply_time = [record.apply_start_time, record.apply_end_time] record.examination_time = [record.examination_end_time, record.examination_end_time] record.apply_time = [record.apply_start_time, record.apply_end_time] - - - setCurrentRow(record); }} > diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index 7b2b23c..27f10f2 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; import { useRequest, history } from 'umi'; import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd'; +import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Typography } from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; @@ -222,6 +222,7 @@ const ExaminationRules: React.FC = () => { }}> 删除 , + /* { @@ -229,8 +230,8 @@ const ExaminationRules: React.FC = () => { //setCurrentRow(record); }} > - 发布 - , + {record.b_use == 1 ? 已发布 : 未发布} + */, ] }, }, diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx index 58da570..95baa64 100644 --- a/admin/src/pages/examinationrules/attestation/step/index.tsx +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -20,7 +20,7 @@ import { saveRules, querySubjectList, queryRulesView, queryRulesList, queryRules import { queryQuestionType } from '@/pages/questionbank/service'; import ProTable, { ActionType, EditableProTable, ProColumns } from '@ant-design/pro-table'; import { TableListPagination } from '@/pages/ListTableList2/data'; -import { PlusOutlined } from '@ant-design/icons'; +import { DiffOutlined, PlusOutlined } from '@ant-design/icons'; import { TableListItem } from '../../components/QuestionSelector'; import ScoreSetter from '../../components/ScoreSetter'; import AutoSelector from '../components/AutoSelector'; @@ -62,8 +62,8 @@ export default () => { dataIndex: 'examination_time', valueType: 'text', sorter: false, - hideInTable: false, - hideInForm: false, + hideInTable: true, + hideInForm: true, hideInSearch: true, renderText: (val: string) => `${val}`, }, @@ -71,13 +71,13 @@ export default () => { title: '关联主题', dataIndex: 'subject_name', valueType: 'text', - hideInTable: false, - hideInForm: false, + hideInTable: true, + hideInForm: true, hideInSearch: true, }, { title: '题型设置', - dataIndex: 'subject_id', + dataIndex: 'question_type_count', valueType: 'text', hideInTable: true, hideInForm: false, @@ -93,9 +93,9 @@ export default () => { sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id }) } console.log(sinfo, 'sinfo'); - */ + */ return []; - }, + }, }, { title: '总分', @@ -104,7 +104,7 @@ export default () => { valueType: 'text', hideInSearch: true, hideInForm: false, - renderText: (val: string) => `${val}分`, + renderText: (val: string) => `${val || 0} 分`, }, { title: '通过线', @@ -113,12 +113,13 @@ export default () => { valueType: 'text', hideInSearch: true, hideInForm: false, - renderText: (val: string) => `${val}`, + renderText: (val: string) => `${val || '-'}`, }, { title: '操作', dataIndex: 'option', valueType: 'option', + width: 200, render: (_dom: any, record: React.SetStateAction) => { console.log(record, 'record') return [ @@ -305,32 +306,36 @@ export default () => { >
+ page headerTitle={false} actionRef={actionRef} rowKey="examination_id" options={false} search={false} - toolBarRender={() => [ - , - - ]} + toolBarRender={() => ( + + + + + )} request={async (value) => { + console.log('queryRulesPaper::') const _data = await queryRulesPaper( { rules_id: params?.id, @@ -340,7 +345,7 @@ export default () => { ); return { current: _data?.pageNumber, - data: _data?.table_List, + data: _data?.question_list, pageSize: _data?.pageSize, total: _data?.totalRow || 0, }; @@ -407,6 +412,7 @@ export default () => { console.log('paper', paper) // setUuidPaper(paper?.paper_uuid) // message.success('提交成功'); + actionRef.current?.reload() handleAutoModalVisible(false) return true; }} diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx index 40dc00f..28fce60 100644 --- a/admin/src/pages/examinationrules/normal/index.tsx +++ b/admin/src/pages/examinationrules/normal/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; import { useRequest, history } from 'umi'; import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd'; +import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Typography } from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; @@ -194,7 +194,7 @@ const ExaminationRules: React.FC = () => { setSelectedRows([]); actionRef.current?.reloadAndRest?.(); }}> - 删除 + 删除 , { actionRef.current?.reloadAndRest?.(); }} > - {record.b_use == 0 ? "未发布" : "已发布"} + {record.b_use == 1 ? 已发布 : 未发布} , ] }, diff --git a/admin/src/pages/examinationrules/service.ts b/admin/src/pages/examinationrules/service.ts index f485591..5e161fb 100644 --- a/admin/src/pages/examinationrules/service.ts +++ b/admin/src/pages/examinationrules/service.ts @@ -209,4 +209,4 @@ export async function autoPaperOfficial(data: Record, options?: Rec requestType: "form", ...(options || {}), }); -} +} \ No newline at end of file diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx index 8b00535..cb0c0b3 100644 --- a/admin/src/pages/questionbank/index.tsx +++ b/admin/src/pages/questionbank/index.tsx @@ -185,21 +185,31 @@ const QuestionBank = () => { hideInForm: false, hideInSearch: true, renderFormItem: (item, { defaultRender, ...rest }, form) => ( - + { + //console.log(`checked = ${e.target.checked}`); + }}> + + + A + + + B + + + C + + + D + + + ) /* formItemProps: { rules: [ { required: true, - message: '请填写试题解析', + message: '请填答案', }, ] },*/ @@ -231,7 +241,6 @@ const QuestionBank = () => { // rules={[{ required: true }]} value="锦书" // disabled - /> ), }, diff --git a/web/src/global.less b/web/src/global.less index 4c66ee0..41d5e8b 100644 --- a/web/src/global.less +++ b/web/src/global.less @@ -72,25 +72,31 @@ ol { filter: grayscale(100%) brightness(500%); } -.pdefault{ +.answerSheet{ + +} + +.answerSheet .pdefault{ margin: -1px; border: #cccccc 1px solid; border-radius: 5px; color: #999999; width: 40px; height: 40px; - background-color: #ffffff; + // background-color: #ffffff; text-align: center; display:flex; font-size: 18px; justify-content: center; align-items: center; } -.pact{ - border: #1895ff 1px solid; +.answerSheet .pact{ + border: #1895ff 2px solid!important; color: #1895ff; } -.pok{ - border: aquamarine 1px solid; - color: aquamarine; -} \ No newline at end of file + + +.answerSheet .pok{ + border: #1895ff 1px solid; + color: #1895ff;background-color: #e6f7ff; +} diff --git a/web/src/pages/mockExamination/paper/index.tsx b/web/src/pages/mockExamination/paper/index.tsx index 8d5008d..6366cfe 100644 --- a/web/src/pages/mockExamination/paper/index.tsx +++ b/web/src/pages/mockExamination/paper/index.tsx @@ -1,19 +1,22 @@ /** 资质考试 */ 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 { useParams, useRequest } from 'umi'; -import { useState } from 'react'; +import { useRef, useState } from 'react'; const { Text, Link } = Typography; import { getRulesPaper, getPaperQuestionList } from '../service'; import type { CardListItemDataType } from '../data'; import styles from './style.less'; import SubMenu from 'antd/lib/menu/SubMenu'; import ProCard from '@ant-design/pro-card'; +import { getDirection } from '../../../.umi/plugin-locale/localeExports'; const { Paragraph } = Typography; const CardList = () => { + const formRef = useRef(); + // 组卷详情查询 const [rulesPaperInfo, setRulesPaperInfo] = useState([]); // 试题列表 @@ -66,7 +69,7 @@ const CardList = () => { const paperList = result.question_list; const qList = params[0].question_type_count - const questionList = [] + const questionList: any[] = [] qList.map((e, i) => { if (e.count > 0) { questionList.push({ @@ -75,11 +78,11 @@ const CardList = () => { }) } }) - // 根据分类拆分试题 左侧答题卡 + // 根据分类拆分试题 左侧答题卡 state:0 未答题 1 : 已答题 paperList.map((e) => { questionList.map((item, index) => { 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 = [] for (let i = 0; i < questionList.length; i++) { - console.log(questionList[i], 'iiii') questionList[i].children.map((e, index) => { - console.log(e, "num"); questionInfo.push({ ...e, index: index }) }) } - - - + const nowQ = setLabVal(questionInfo[0]) setPaperInfo(questionInfo || []) - setQuestionNow(questionInfo[0] || []) + setQuestionNow(nowQ || []) 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 = (

@@ -161,9 +173,13 @@ const CardList = () => { + {console.log("当前题号:", questionNow, "试题顺序:", paperInfo, "二维数组:", questionTypeList)} @@ -172,7 +188,7 @@ const CardList = () => { questionTypeList && ( questionTypeList.map((e, i) => { - console.log(e.children, 'e.children') + return { id={item.id} > }} @@ -227,34 +258,99 @@ const CardList = () => { headerBordered > + {/* + + + + + { + + 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} /> + + + + + */} {questionNow?.question_stem} + {console.log(questionNow.answerId, 'answerId', questionNow.answerId)} - { return true }} value={0} size="large"> - - {questionNow.question_type === 0 ? - ({questionNow?.answers?.map((item, index) => { - return { - const qArr = [] - questionNow?.answers?.map(() => { - qArr.push("0") - }) - qArr[index] = item.is_true - const questionAnswer = qArr.join(",") - const paperInfoTemp = paperInfo - paperInfoTemp[questionNow.index].answerSelect = questionAnswer - setPaperInfo(paperInfoTemp || []) - console.log('0', paperInfoTemp, questionNow.index) - }} value={item.id} style={{ padding: 5, fontSize: 16 }}>{tiNum(index)}{item.answer} - })}) : questionNow.question_type === 1 ? questionNow?.answers?.map((item, index) => { - return {tiNum(index)}{item.answer} - }) : questionNow.question_type === 2 ? questionNow?.answers?.map((item, index) => { - return {tiNum(index)}{item.answer} - }) : ""} - - - + + {questionNow.question_type === 0 ? + + ( +

+ + + {questionNow?.answers?.map((item, index) => { + console.log(item, 'item') + return { + const qArr = [] + // 默认输出答案0,0,0,0 + questionNow?.answers?.map(() => { + qArr.push("0") + }) + // 修改用户答案 + qArr[index] = item.is_true + + 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} + })} + +
+ ) : questionNow.question_type === 1 ? questionNow?.answers?.map((item, index) => { + return {tiNum(index)}{item.answer} + }) : questionNow.question_type === 2 ? questionNow?.answers?.map((item, index) => { + return {tiNum(index)}{item.answer} + }) : ""} + + { return true }} value={0} size="large">