From 1db877b62b9048eac583a3d5cdd7eb8edcba7fc2 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Thu, 3 Mar 2022 16:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=A0=E8=8A=82=E6=B5=8B=E9=AA=8C=E3=80=81?= =?UTF-8?q?=E9=94=99=E9=A2=98=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/config/config.ts | 16 +- web/src/global.less | 4 + .../mockExamination/chapterErrorListPaper.tsx | 531 ++++++++++++++++++ .../mockExamination/chapterExamination.tsx | 2 +- web/src/pages/mockExamination/chapterList.tsx | 67 ++- .../mockExamination/chapterListPaper.tsx | 490 ++++++++++++++++ web/src/pages/mockExamination/index.tsx | 2 +- web/src/pages/mockExamination/paper/index.tsx | 2 +- web/src/pages/mockExamination/service.ts | 62 ++ web/src/pages/mockExamination/style.less | 51 ++ 10 files changed, 1191 insertions(+), 36 deletions(-) create mode 100644 web/src/pages/mockExamination/chapterErrorListPaper.tsx create mode 100644 web/src/pages/mockExamination/chapterListPaper.tsx diff --git a/web/config/config.ts b/web/config/config.ts index e36bce2..2e78b03 100644 --- a/web/config/config.ts +++ b/web/config/config.ts @@ -133,10 +133,22 @@ export default defineConfig({ }, { name: '章节模拟练习-章节列表', - path: '/mockExamination/chapterList/:data_id/:data_type/:subject_id', + path: '/mockExamination/chapterExamination/chapterList/:data_id/:data_type/:subject_id', component: './mockExamination/chapterList', hideInMenu: true, }, + { + name: '章节模拟练习-开始答题', + path: '/mockExamination/chapterExamination/chapterList/chapterListPaper/:info', + component: './mockExamination/chapterListPaper', + hideInMenu: true, + }, + { + name: '章节模拟练习-错题本', + path: '/mockExamination/chapterExamination/chapterList/chapterErrorListPaper/:info', + component: './mockExamination/chapterErrorListPaper', + hideInMenu: true, + }, { name: '综合模拟考试', icon: 'smile', @@ -146,7 +158,7 @@ export default defineConfig({ { name: '综合模拟考试答题', icon: 'smile', - path: '/mockExamination/paper/:rules_id', + path: '/mockExamination/index/paper/:rules_id', component: './mockExamination/paper', hideInMenu: true, }, diff --git a/web/src/global.less b/web/src/global.less index 41d5e8b..2732423 100644 --- a/web/src/global.less +++ b/web/src/global.less @@ -100,3 +100,7 @@ ol { border: #1895ff 1px solid; color: #1895ff;background-color: #e6f7ff; } +.answerSheet .perror{ + border: #ff1837 1px solid; + color: #ff1818;background-color: #ffe6ea; +} diff --git a/web/src/pages/mockExamination/chapterErrorListPaper.tsx b/web/src/pages/mockExamination/chapterErrorListPaper.tsx new file mode 100644 index 0000000..1686288 --- /dev/null +++ b/web/src/pages/mockExamination/chapterErrorListPaper.tsx @@ -0,0 +1,531 @@ +/** 资质考试 */ +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 { useEffect, useRef, useState } from 'react'; +const { Text, Link } = Typography; +import { getErrorQuestionList, getPaperQuestionList, finishExamination, savePersonAnswer } from './service'; +import type { CardListItemDataType } from '../data'; +import styles from './style.less'; +import cookie from 'react-cookies'; + +import ProCard from '@ant-design/pro-card'; + + + + +const CardList = () => { + const formRef = useRef(); + const params = useParams(); + // 组卷详情查询 + const [rulesPaperInfo, setRulesPaperInfo] = useState([]); + // 试题列表 + const [paperInfo, setPaperInfo] = useState([]); + //答题卡列表 + const [questionTypeList, setQuestionTypeList] = useState([]) + // 当前答题id + const [questionNow, setQuestionNow] = useState({}) + // 解析可见 + const [parsingShow, setParsingShow] = useState(false) + + + const [lastBtnShow, setLastBtnShow] = useState(true) + const [nextBtnShow, setNextBtnShow] = useState(false) + + // 当前题号 + const [questionNowNum, setQuestionNowNum] = useState(0) + const [questionNum, setQuestioNum] = useState(0) + + + + const info = params.info.split(','); + + + + const { loading, data } = useRequest(() => { + return getErrorQuestionList({ + subject_id: info[0], + person_id: info[1], + }); + }, + { + formatResult: (result) => { + return result; + }, + onSuccess: (result) => { + const questionList = result.list; + // const finish_list = result.finish_list; + setRulesPaperInfo(result) + + + // 根据答题卡生成考试顺序 + const questionSort = [] + questionList.map((item, index) => { + questionList[index].question_list.map((e, i) => { + questionList[index].question_list[i].index = i + questionList[index].question_list[i].state = "" + + // finish_list.map((f_item, f_index) => { + + // if (f_item.question_id == e.id) { + // questionList[index].question_list[i].answerId = f_item.teacher_answer + // questionList[index].question_list[i].state = f_item.is_error + // return; + // } + // }) + questionSort.push({ ...e, index: i }) + + }) + } + ) + // console.log(questionSort, '试题顺序', questionList, "已答", finish_list) + setPaperInfo(questionSort) + setQuestionTypeList(questionList || []) + setQuestionNow(questionSort[0] || []) + setQuestioNum(questionSort.length) + + // if (result.success) { + // setRulesPaperInfo(result.question_list[0] || []) + // run({ paper_id: result.question_list[0].paper_id, question_type_count: result.question_list[0].question_type_count }) + // // setQuestionTypeList(result.question_list[0].question_type_count) + // } + } + }); + + const { run } = useRequest(getPaperQuestionList, + { + refreshDeps: [rulesPaperInfo], + manual: true, + formatResult: (result) => { + return result; + }, + onSuccess: (result, params) => { + // setRulesPaperInfo(result || []) + if (result.success) { + // 试题列表 + const paperList = result.question_list; + + const qList = params[0].question_type_count + const questionList: any[] = [] + qList.map((e, i) => { + if (e.count > 0) { + questionList.push({ + question_list: [], + ...e + }) + } + }) + + + // 根据分类拆分试题 左侧答题卡 state:0 未答题 1 : 已答题 + paperList.map((e) => { + questionList.map((item, index) => { + if (item.question_type == e.question_type) { + questionList[index].question_list.push({ ...e, question_type: item.question_type, answerSelect: "", state: 0, answerId: "" }) + } + }) + }) + + // 根据答题卡生成考试顺序 + const questionInfo = [] + for (let i = 0; i < questionList.length; i++) { + questionList[i].question_list.map((e, index) => { + questionInfo.push({ ...e, index: index }) + }) + } + + + setPaperInfo(questionInfo || []) + setQuestionNow(questionInfo[0] || []) + // setQuestionTypeList(questionList || []) + + } + } + }); + + + + + + useEffect(() => { + + // 已选择题目回显 + formRef?.current?.setFieldsValue({ note: questionNow.answerId }); + + paperInfo.map((item, index) => { + + if (item.question_id === questionNow.question_id) { + setQuestionNowNum(index + 1) + } + }) + }, [questionNow]); + + useEffect(() => { + setLastBtnShow(questionNowNum == 1 ? true : false) + setNextBtnShow(questionNowNum == questionNum ? true : false) + + }, [questionNowNum]) + + const content = ( +
+

+ {/* 试卷信息:{rulesPaperInfo?.question_list[0].rules_name} */} +

+
+ ); + + + const numbers = []; + for (let i = 0; i < 50; i++) { + numbers.push({ id: `${i}` }) + } + const tiNum = (a: number) => { + switch (a) { + case 0: + return "A:" + break; + case 1: + return "B:" + break; + case 2: + return "C:" + break; + case 3: + return "D:" + break; + case 4: + return "E:" + break; + case 5: + return "F:" + break; + case 6: + return "G:" + break; + case 7: + return "H:" + break; + case 8: + return "I:" + break; + case 9: + return "J:" + break; + default: + return "" + break; + } + + } + return ( + + + {/* {console.log("试题列表:", paperInfo, "答题卡:", questionTypeList, "当前试题", questionNow)} */} + + {/* {console.log(questionTypeList, 'uestionTypeList')} */} + + + { + + questionTypeList && ( + + questionTypeList.map((e, i) => { + + return { + return + }} + style={{ background: '#ffffff', margin: '-25px -24px 24px -24px' }} + /> + } + ) + + + )} + + + + + + + {questionNow?.question_stem} + + + +
+ + + {questionNow.question_type === 0 ? + + ( + + + {questionNow?.answers?.map((item, index) => { + + // console.log("答题item", item, "questionNowid", questionNow) + 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(",") + + // runSavePersonAnswer({ + // answer_ids: e.target.value, + // question_id: questionNow.question_id, + // record_id: rulesPaperInfo.record_id + // }) + // console.log("答题:", questionAnswer, qArr, questionNow) + // 修改答题卡状态 写入答案以及修改答题状态 + const qX = questionNow?.question_type; + const qI = questionNow?.index; + questionList[qX].question_list[qI].answerSelect = questionAnswer; + if (questionAnswer === questionNow.answertrue) { + questionList[qX].question_list[qI].state = 0 + } else { + questionList[qX].question_list[qI].state = 1 + } + // 答题状态 + questionList[qX].question_list[qI].answerId = item.id + // 提交答题卡 + setQuestionTypeList(questionList) + }} + value={item.id} + style={{ padding: 5, fontSize: 16 }} + >{tiNum(index)}{item.answer} + + + })} + ) : questionNow.question_type === 1 ? { + // 答案 0101 + const qArr = [] + // 默认输出答案0,0,0,0 + questionNow?.answers?.map((item) => { + if (e.indexOf(item.id) > -1) { + qArr.push("1") + } else { + qArr.push("0") + } + }) + + + + + + const questionList = questionTypeList + const questionAnswer = qArr.join(",") + + // runSavePersonAnswer({ + // answer_ids: e.join(','), + // question_id: questionNow.question_id, + // record_id: rulesPaperInfo.record_id + // }) + + + + // 修改答题卡状态 写入答案以及修改答题状态 + const qX = questionNow?.question_type; + const qI = questionNow?.index; + questionList[qX].question_list[qI].answerSelect = questionAnswer; + // 答题状态 + questionList[qX].question_list[qI].answerId = e + + if (questionAnswer === questionNow.answertrue) { + questionList[qX].question_list[qI].state = 0 + } else { + questionList[qX].question_list[qI].state = 1 + } + + + // 提交答题卡 + setQuestionTypeList(questionList) + + }}> + {questionNow?.answers?.map((item, index) => { + + + return {tiNum(index)}{item.answer} + + })} + : questionNow.question_type === 2 ? ( + + + {questionNow?.answers?.map((item, index) => { + + 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(",") + + + // runSavePersonAnswer({ + // answer_ids: e.target.value, + // question_id: questionNow.question_id, + // record_id: rulesPaperInfo.record_id + // }) + // console.log("答题:", questionAnswer, qArr, questionNow) + // 修改答题卡状态 写入答案以及修改答题状态 + const qX = questionNow?.question_type; + const qI = questionNow?.index; + questionList[qX].question_list[qI].answerSelect = questionAnswer; + if (questionAnswer === questionNow.answertrue) { + questionList[qX].question_list[qI].state = 0 + } else { + questionList[qX].question_list[qI].state = 1 + } + // 答题状态 + questionList[qX].question_list[qI].answerId = item.id + // 提交答题卡 + setQuestionTypeList(questionList) + }} + value={item.id} + style={{ padding: 5, fontSize: 16 }} + >{tiNum(index)}{item.answer} + + })} + ) : "" + } + +
+
+ + { return true }} value={0} size="large"> + + +
+ + + + + + +
+ + 剩余时间 + 6分14秒 + + 答题序号 + {questionNowNum}/{questionNum} + + + + + + +
+ + + + ); +}; + +export default CardList; diff --git a/web/src/pages/mockExamination/chapterExamination.tsx b/web/src/pages/mockExamination/chapterExamination.tsx index 38898c7..1e3907e 100644 --- a/web/src/pages/mockExamination/chapterExamination.tsx +++ b/web/src/pages/mockExamination/chapterExamination.tsx @@ -60,7 +60,7 @@ const SubjectList = () => { diff --git a/web/src/pages/mockExamination/chapterList.tsx b/web/src/pages/mockExamination/chapterList.tsx index 05c1743..f196315 100644 --- a/web/src/pages/mockExamination/chapterList.tsx +++ b/web/src/pages/mockExamination/chapterList.tsx @@ -2,17 +2,17 @@ import { AlignLeftOutlined, LaptopOutlined, NotificationOutlined, PlusOutlined, import { useEffect, useState } from 'react'; import { Button, Card, Col, Layout, List, Menu, Progress, Row, Typography } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; -import { useParams, useRequest } from 'umi'; +import { useParams, useRequest, history } from 'umi'; import { viewMyLearningSubject, getCourseExaminationProgressList } from './service'; import type { CardListItemDataType } from './data.d'; import styles from './style.less'; import SubMenu from 'antd/lib/menu/SubMenu'; const { Paragraph } = Typography; import cookie from 'react-cookies'; -import { history } from "@@/core/history"; +// import { history } from "@@/core/history"; -let chapterCourse=[]; -let total_process=0; +let chapterCourse = []; +let total_process = 0; const CardList = () => { const params = useParams(); @@ -46,31 +46,32 @@ const CardList = () => { // r_list[0].chapter_id }); - },{ + }, { + manual: true, formatResult: (result) => { - if(result.list.length!==0){ - let total_finish_count=0; - let total_question_count=0; - result.list.forEach((item)=>{ - total_finish_count+=item.finish_count; - total_question_count+=item.question_count; - if(item.finish_count!==0){ - let num=0; - num=result.finish_count/result.question_count; - item.process=num.toFixed(4) - }else { - item.process=0; + if (result.list.length !== 0) { + let total_finish_count = 0; + let total_question_count = 0; + result.list.forEach((item) => { + total_finish_count += item.finish_count; + total_question_count += item.question_count; + if (item.finish_count !== 0) { + let num = 0; + num = result.finish_count / result.question_count; + item.process = num.toFixed(4) + } else { + item.process = 0; } }); - if(total_finish_count!==0){ - let total_num=total_finish_count/total_question_count; - total_process=total_num.toFixed(4) + if (total_finish_count !== 0) { + const total_num = total_finish_count / total_question_count; + total_process = total_num.toFixed(4) - }else { - total_process=0; + } else { + total_process = 0; } } - chapterCourse=result.list; + chapterCourse = result.list; } }); @@ -113,15 +114,18 @@ const CardList = () => { {subject_data ? subject_data.subject_describe : '--'} - 章节模拟考试进度: + 章节模拟考试进度: @@ -170,7 +174,7 @@ const CardList = () => { return (
-
第{index+1}讲
+
第{index + 1}讲
{item?.course_name}
{item?.finish_count}题/{item?.question_count}题
@@ -178,9 +182,10 @@ const CardList = () => {
diff --git a/web/src/pages/mockExamination/chapterListPaper.tsx b/web/src/pages/mockExamination/chapterListPaper.tsx new file mode 100644 index 0000000..f455cad --- /dev/null +++ b/web/src/pages/mockExamination/chapterListPaper.tsx @@ -0,0 +1,490 @@ +/** 资质考试 */ +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 { useEffect, useRef, useState } from 'react'; +const { Text, Link } = Typography; +import { getCourseQuestionList, getPaperQuestionList, finishExamination, savePersonAnswer } from './service'; +import type { CardListItemDataType } from '../data'; +import styles from './style.less'; +import cookie from 'react-cookies'; + +import ProCard from '@ant-design/pro-card'; + + + + +const CardList = () => { + const formRef = useRef(); + + // 组卷详情查询 + const [rulesPaperInfo, setRulesPaperInfo] = useState([]); + // 试题列表 + const [paperInfo, setPaperInfo] = useState([]); + //答题卡列表 + const [questionTypeList, setQuestionTypeList] = useState([]) + // 当前答题id + const [questionNow, setQuestionNow] = useState({}) + // 解析可见 + const [parsingShow, setParsingShow] = useState(false) + + + const [lastBtnShow, setLastBtnShow] = useState(true) + const [nextBtnShow, setNextBtnShow] = useState(false) + + // 当前题号 + const [questionNowNum, setQuestionNowNum] = useState(0) + const [questionNum, setQuestioNum] = useState(0) + + + + + const params = useParams(); + const info = params.info.split(','); + + + + const { loading, data } = useRequest(() => { + return getCourseQuestionList({ + bureau_id: info[0], + chapter_id: info[1], + course_id: info[2], + finish_count: info[3], + person_id: info[4], + subject_id: info[5], + }); + }, + { + formatResult: (result) => { + return result; + }, + onSuccess: (result) => { + const questionList = result.list; + const finish_list = result.finish_list; + setRulesPaperInfo(result) + + + // 根据答题卡生成考试顺序 + const questionSort = [] + questionList.map((item, index) => { + questionList[index].question_list.map((e, i) => { + questionList[index].question_list[i].index = i + finish_list.map((f_item, f_index) => { + + if (f_item.question_id == e.id) { + questionList[index].question_list[i].answerId = f_item.teacher_answer + questionList[index].question_list[i].state = f_item.is_error + return; + } + }) + questionSort.push({ ...e, index: i }) + + }) + } + ) + // console.log(questionSort, '试题顺序', questionList, "已答", finish_list) + setPaperInfo(questionSort) + setQuestionTypeList(questionList || []) + setQuestionNow(questionSort[0] || []) + setQuestioNum(questionSort.length) + + + } + }); + + + // 保存答案 + const { run: runSavePersonAnswer } = useRequest(savePersonAnswer, + { + refreshDeps: [rulesPaperInfo], + manual: true, + formatResult: (result) => { + return result; + }, + onSuccess: (result, params) => { + console.log(result, 'questionFinish server', params) + } + }); + + + + + + useEffect(() => { + + // 已选择题目回显 + formRef?.current?.setFieldsValue({ note: questionNow.answerId }); + + paperInfo.map((item, index) => { + if (item.id === questionNow.id) { + setQuestionNowNum(index + 1) + } + }) + }, [questionNow]); + + useEffect(() => { + setLastBtnShow(questionNowNum == 1 ? true : false) + setNextBtnShow(questionNowNum == questionNum ? true : false) + + }, [questionNowNum]) + + const content = ( +
+

+ {/* 试卷信息:{rulesPaperInfo?.question_list[0].rules_name} */} +

+
+ ); + + + const numbers = []; + for (let i = 0; i < 50; i++) { + numbers.push({ id: `${i}` }) + } + const tiNum = (a: number) => { + switch (a) { + case 0: + return "A:" + break; + case 1: + return "B:" + break; + case 2: + return "C:" + break; + case 3: + return "D:" + break; + case 4: + return "E:" + break; + case 5: + return "F:" + break; + case 6: + return "G:" + break; + case 7: + return "H:" + break; + case 8: + return "I:" + break; + case 9: + return "J:" + break; + default: + return "" + break; + } + + } + return ( + + + {/* {console.log("试题列表:", paperInfo, "答题卡:", questionTypeList, "当前试题", questionNow)} */} + + {/* {console.log(questionTypeList, 'uestionTypeList')} */} + + + { + + questionTypeList && ( + + questionTypeList.map((e, i) => { + + return { + return + }} + style={{ background: '#ffffff', margin: '-25px -24px 24px -24px' }} + /> + } + ) + + + )} + + + + + + + {questionNow?.question_stem} + + + +
+ + + {questionNow.question_type === 0 ? + + ( + + + {questionNow?.answers?.map((item, index) => { + // console.log("答题item", item, "questionNowid", questionNow) + 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(",") + + runSavePersonAnswer({ + answer_ids: e.target.value, + question_id: questionNow.id, + record_id: rulesPaperInfo.record_id + }) + // console.log("答题:", questionAnswer, qArr, questionNow) + // 修改答题卡状态 写入答案以及修改答题状态 + const qX = questionNow?.question_type; + const qI = questionNow?.index; + questionList[qX].question_list[qI].answerSelect = questionAnswer; + if (questionAnswer === questionNow.answertrue) { + questionList[qX].question_list[qI].state = 0 + } else { + questionList[qX].question_list[qI].state = 1 + } + // 答题状态 + questionList[qX].question_list[qI].answerId = item.id + // 提交答题卡 + setQuestionTypeList(questionList) + }} + value={item.id} + style={{ padding: 5, fontSize: 16 }} + >{tiNum(index)}{item.answer} + + + })} + ) : questionNow.question_type === 1 ? { + // 答案 0101 + const qArr = [] + // 默认输出答案0,0,0,0 + questionNow?.answers?.map((item) => { + if (e.indexOf(item.id) > -1) { + qArr.push("1") + } else { + qArr.push("0") + } + }) + + + + + + const questionList = questionTypeList + const questionAnswer = qArr.join(",") + + runSavePersonAnswer({ + answer_ids: e.join(','), + question_id: questionNow.id, + record_id: rulesPaperInfo.record_id + }) + + + + // 修改答题卡状态 写入答案以及修改答题状态 + const qX = questionNow?.question_type; + const qI = questionNow?.index; + questionList[qX].question_list[qI].answerSelect = questionAnswer; + // 答题状态 + questionList[qX].question_list[qI].answerId = e + + if (questionAnswer === questionNow.answertrue) { + questionList[qX].question_list[qI].state = 0 + } else { + questionList[qX].question_list[qI].state = 1 + } + + + // 提交答题卡 + setQuestionTypeList(questionList) + + }}> + {questionNow?.answers?.map((item, index) => { + + return {tiNum(index)}{item.answer} + + })} + : questionNow.question_type === 2 ? ( + + + {questionNow?.answers?.map((item, index) => { + + 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(",") + + + runSavePersonAnswer({ + answer_ids: e.target.value, + question_id: questionNow.id, + record_id: rulesPaperInfo.record_id + }) + // console.log("答题:", questionAnswer, qArr, questionNow) + // 修改答题卡状态 写入答案以及修改答题状态 + const qX = questionNow?.question_type; + const qI = questionNow?.index; + questionList[qX].question_list[qI].answerSelect = questionAnswer; + if (questionAnswer === questionNow.answertrue) { + questionList[qX].question_list[qI].state = 0 + } else { + questionList[qX].question_list[qI].state = 1 + } + // 答题状态 + questionList[qX].question_list[qI].answerId = item.id + // 提交答题卡 + setQuestionTypeList(questionList) + }} + value={item.id} + style={{ padding: 5, fontSize: 16 }} + >{tiNum(index)}{item.answer} + + })} + ) : "" + } + +
+
+ + { return true }} value={0} size="large"> + + +
+ + + + + + +
+ + 剩余时间 + 6分14秒 + + 答题序号 + {questionNowNum}/{questionNum} + + + + + + +
+ + + + ); +}; + +export default CardList; diff --git a/web/src/pages/mockExamination/index.tsx b/web/src/pages/mockExamination/index.tsx index 490a0fb..c263716 100644 --- a/web/src/pages/mockExamination/index.tsx +++ b/web/src/pages/mockExamination/index.tsx @@ -45,7 +45,7 @@ const columns: ProColumns[] = [ { - history.push(`/mockExamination/paper/${record.id}`); + history.push(`/mockExamination/index/paper/${record.id}`); }} > 开始考试 diff --git a/web/src/pages/mockExamination/paper/index.tsx b/web/src/pages/mockExamination/paper/index.tsx index 4f21c44..b3ab565 100644 --- a/web/src/pages/mockExamination/paper/index.tsx +++ b/web/src/pages/mockExamination/paper/index.tsx @@ -133,7 +133,7 @@ const CardList = () => { useEffect(() => { // 已选择题目回显 formRef?.current?.setFieldsValue({ note: questionNow.answerId }); - + console.log(questionTypeList, 'questionTypeList') paperInfo.map((item, index) => { if (item.id === questionNow.id) { setQuestionNowNum(index + 1) diff --git a/web/src/pages/mockExamination/service.ts b/web/src/pages/mockExamination/service.ts index 2d745ad..841b75a 100644 --- a/web/src/pages/mockExamination/service.ts +++ b/web/src/pages/mockExamination/service.ts @@ -1,6 +1,20 @@ import { request } from 'umi'; import type { CardListItemDataType } from './data.d'; +/** + * 获取服务器时间 + * /dsideal_yy/zygh/training/examination/getCurrentDate + * @param params + * @returns + */ +export async function getCurrentDate(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/examination/getCurrentDate', { + params, + }); +} /** * 【6.5】(教师首页)当前学习主题课程信息 * /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject @@ -61,6 +75,24 @@ export async function finishExamination( }, }); } +/** + * 章节测验 03 保存试题答案 + * /dsideal_yy/zygh/training/person/finishExamination + * @param params + * @returns + */ + +export async function savePersonAnswer( + params: ParamsType, +): Promise<{ data: { list: BasicListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/mock/savePersonAnswer', { + method: 'POST', + requestType: 'form', + data: { + ...params, + }, + }); +} @@ -82,6 +114,36 @@ export async function getPaperQuestionList(params: { }); } +/** + * 章节 02 开始考试->试题列表 + * /dsideal_yy/zygh/training/mock/getCourseQuestionList + * @param params + * @returns + */ +export async function getCourseQuestionList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/mock/getCourseQuestionList', { + params, + }); +} + +/** + * 章节 02 开始考试->试题列表 + * /dsideal_yy/zygh/training/mock/getErrorQuestionList + * @param params + * @returns + */ +export async function getErrorQuestionList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/mock/getErrorQuestionList', { + params, + }); +} + export async function viewMyLearningSubject(params: { identity_id: number; person_id: number; diff --git a/web/src/pages/mockExamination/style.less b/web/src/pages/mockExamination/style.less index 7489aae..c3f9b9a 100644 --- a/web/src/pages/mockExamination/style.less +++ b/web/src/pages/mockExamination/style.less @@ -1,6 +1,56 @@ @import '~antd/es/style/themes/default.less'; @import './utils/utils.less'; +:global { + .ant-list .ant-list-item-content-single { + max-width: 100%; + } + .ant-list-items{ + display: block; + padding: 10px; + } + .ant-list-bordered .ant-list-item{ + display: inline-block; + width: 50px; + height: 50px; + padding: 5px; + margin: 0; + .ant-typography:hover{ + cursor: pointer; + } + .ant-typography{ + color:#999999; + border: #CCCCCC 1px solid; + border-radius: 5px; + font-weight: bolder; + background-color: #f0f0f0; + display: inline-block; + width: 100%; + height: 100%; + font-size: 18px; + text-align: center; + vertical-align: middle; + span{ + text-align: center; + display: block; + font-size: 18px; + line-height: 18px; + padding: 8px 8px; + } + + mark{ + margin: -1px; + border: #1890ff 1px solid; + border-radius: 5px; + color: #1890ff; + display: block; + width: 40px; + height: 40px; + background-color: #e6f7ff; + } + } + } +} .cardList { .card { :global { @@ -34,6 +84,7 @@ box-shadow:none; height:100%; } + } } :global {