资质考试

master
wangxi 3 years ago
parent dae2c0281d
commit 1c9b8f147f

@ -132,8 +132,8 @@ const CardList = () => {
// 试题列表
const paperList = result.question_list;
const arr = [[], [], []];
const question_type_count = [
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:'填空'},
@ -179,9 +179,7 @@ const CardList = () => {
const questionInfo = []
for (let i = 0; i < questionList.length; i++) {
questionList[i].children.map((e, index) => {
questionInfo.push({ ...e, index: [i, index] })
questionList[i].children[index].index = [i, index]
questionInfo.push({ ...e, index: index })
})
}
@ -386,10 +384,10 @@ const CardList = () => {
// 修改答题卡状态 写入答案以及修改答题状态
const qX = questionNow?.question_type;
const qI = questionNow?.index;
questionList[questionNow.index[0]].children[questionNow.index[1]].answerSelect = questionAnswer;
questionList[qX].children[qI].answerSelect = questionAnswer;
// 答题状态
questionList[questionNow.index[0]].children[questionNow.index[1]].state = 1
questionList[questionNow.index[0]].children[questionNow.index[1]].answerId = item.id
questionList[qX].children[qI].state = 1
questionList[qX].children[qI].answerId = item.id
// 提交答题卡
setQuestionTypeList(questionList)
@ -415,10 +413,10 @@ const CardList = () => {
// 修改答题卡状态 写入答案以及修改答题状态
const qX = questionNow?.question_type;
const qI = questionNow?.index;
questionList[questionNow.index[0]].children[questionNow.index[1]].answerSelect = questionAnswer;
questionList[qX].children[qI].answerSelect = questionAnswer;
// 答题状态
questionList[questionNow.index[0]].children[questionNow.index[1]].state = 1
questionList[questionNow.index[0]].children[questionNow.index[1]].answerId = e
questionList[qX].children[qI].state = 1
questionList[qX].children[qI].answerId = e
// 提交答题卡
setQuestionTypeList(questionList)
@ -453,10 +451,10 @@ const CardList = () => {
// 修改答题卡状态 写入答案以及修改答题状态
const qX = questionNow?.question_type;
const qI = questionNow?.index;
questionList[questionNow.index[0]].children[questionNow.index[1]].answerSelect = questionAnswer;
questionList[qX].children[qI].answerSelect = questionAnswer;
// 答题状态
questionList[questionNow.index[0]].children[questionNow.index[1]].state = 1
questionList[questionNow.index[0]].children[questionNow.index[1]].answerId = item.id
questionList[qX].children[qI].state = 1
questionList[qX].children[qI].answerId = item.id
// 提交答题卡
setQuestionTypeList(questionList)
@ -505,9 +503,9 @@ const CardList = () => {
const nextTemp = paperInfo[i - 1]
const questionList = questionTypeList
let nextData = {}
questionList[nextTemp.index[0]].children.map((item, index) => {
questionList[nextTemp.question_type].children.map((item, index) => {
if (item.id === nextTemp.id) {
nextData = item
nextData = { ...item, index: index }
}
})
setQuestionNow(nextData)
@ -530,9 +528,9 @@ const CardList = () => {
const nextTemp = paperInfo[i + 1]
const questionList = questionTypeList
let nextData = {}
questionList[nextTemp.index[0]].children.map((item, index) => {
questionList[nextTemp.question_type].children.map((item, index) => {
if (item.id === nextTemp.id) {
nextData = item
nextData = { ...item, index: index }
}
})
setQuestionNow(nextData)
@ -545,6 +543,18 @@ const CardList = () => {
<Button size="large" type="primary"
onClick={() => {
const questionFinishId = []
questionTypeList.map((e, i) => {
questionTypeList[i].children.map((e, index) => {
const answerId = e.answerId
answerId !== "" ? questionFinishId.push({
answer_id: (answerId instanceof Array) ? answerId.join(',') : answerId,
question_id: e.id,
question_type: e.question_type
}) : ""
})
})
const questionFinish = {
answers: JSON.stringify(questionFinishId),
examination_id:params.examination_id,

Loading…
Cancel
Save