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