|
|
|
@ -60,10 +60,11 @@ const formatSeconds = (value) => {
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
const CardList = () => {
|
|
|
|
|
const params = useParams();
|
|
|
|
|
const formRef = useRef<ActionType>();
|
|
|
|
|
|
|
|
|
|
console.log('params0000000',params)
|
|
|
|
|
// 组卷详情查询
|
|
|
|
|
const [rulesPaperInfo, setRulesPaperInfo] = useState([]);
|
|
|
|
|
const [rulesPaperInfo, setRulesPaperInfo] = useState(params.paperId);
|
|
|
|
|
//规则
|
|
|
|
|
const [ruleId, setRuleId] = useState([]);
|
|
|
|
|
// 试题列表
|
|
|
|
@ -102,25 +103,25 @@ const CardList = () => {
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const params = useParams();
|
|
|
|
|
const { loading, data } = useRequest(() => {
|
|
|
|
|
return getPersonPaperId({
|
|
|
|
|
examination_id: params.examination_id,
|
|
|
|
|
person_id: cookie.load('person_id')
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
formatResult: (result) => {
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (result) => {
|
|
|
|
|
if (result.success) {
|
|
|
|
|
setRulesPaperInfo(result.paper_id)
|
|
|
|
|
run({ paper_id: result.paper_id })
|
|
|
|
|
// setQuestionTypeList(result.question_list[0].question_type_count)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// const { loading, data } = useRequest(() => {
|
|
|
|
|
// return getPersonPaperId({
|
|
|
|
|
// examination_id: params.examination_id,
|
|
|
|
|
// person_id: cookie.load('person_id')
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// formatResult: (result) => {
|
|
|
|
|
// return result;
|
|
|
|
|
// },
|
|
|
|
|
// onSuccess: (result) => {
|
|
|
|
|
// if (result.success) {
|
|
|
|
|
// setRulesPaperInfo(result.paper_id)
|
|
|
|
|
// run({ paper_id: result.paper_id })
|
|
|
|
|
// // setQuestionTypeList(result.question_list[0].question_type_count)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
const personInfo = useRequest(() => {
|
|
|
|
|
return getExaminationPersonApplyInfo({
|
|
|
|
@ -160,81 +161,160 @@ const CardList = () => {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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 arr = [[], [], []];
|
|
|
|
|
const question_type_count = [
|
|
|
|
|
{ count: 0, question_type: 0, type_name: '单选' },
|
|
|
|
|
{ count: 0, question_type: 1, type_name: '多选' },
|
|
|
|
|
{ count: 0, question_type: 2, type_name: '判断' },
|
|
|
|
|
];
|
|
|
|
|
if (result.question_list.length !== 0) {
|
|
|
|
|
setRuleId(result.question_list[0].rules_id)
|
|
|
|
|
result.question_list.forEach((item) => {
|
|
|
|
|
if (item.question_type === 0) {
|
|
|
|
|
arr[0].push(item)
|
|
|
|
|
} else if (item.question_type === 1) {
|
|
|
|
|
arr[1].push(item)
|
|
|
|
|
} else {
|
|
|
|
|
arr[2].push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const getQuestionList=useRequest(()=>{
|
|
|
|
|
return getPaperQuestionList({
|
|
|
|
|
paper_id:params.paperId
|
|
|
|
|
})
|
|
|
|
|
},{
|
|
|
|
|
// manual: true,
|
|
|
|
|
formatResult: (result) => {
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (result, params) => {
|
|
|
|
|
// setRulesPaperInfo(result || [])
|
|
|
|
|
if (result.success) {
|
|
|
|
|
// 试题列表
|
|
|
|
|
|
|
|
|
|
const paperList = result.question_list;
|
|
|
|
|
const arr = [[], [], []];
|
|
|
|
|
const question_type_count = [
|
|
|
|
|
{ count: 0, question_type: 0, type_name: '单选' },
|
|
|
|
|
{ count: 0, question_type: 1, type_name: '多选' },
|
|
|
|
|
{ count: 0, question_type: 2, type_name: '判断' },
|
|
|
|
|
];
|
|
|
|
|
if (result.question_list.length !== 0) {
|
|
|
|
|
setRuleId(result.question_list[0].rules_id)
|
|
|
|
|
result.question_list.forEach((item) => {
|
|
|
|
|
if (item.question_type === 0) {
|
|
|
|
|
arr[0].push(item)
|
|
|
|
|
} else if (item.question_type === 1) {
|
|
|
|
|
arr[1].push(item)
|
|
|
|
|
} else {
|
|
|
|
|
arr[2].push(item)
|
|
|
|
|
}
|
|
|
|
|
question_type_count[0].count = arr[0].length;
|
|
|
|
|
question_type_count[1].count = arr[1].length;
|
|
|
|
|
question_type_count[2].count = arr[2].length;
|
|
|
|
|
setQuestionType(question_type_count);
|
|
|
|
|
const qList = question_type_count
|
|
|
|
|
const questionList: any[] = []
|
|
|
|
|
qList.map((e, i) => {
|
|
|
|
|
if (e.count > 0) {
|
|
|
|
|
questionList.push({
|
|
|
|
|
children: [],
|
|
|
|
|
...e
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
question_type_count[0].count = arr[0].length;
|
|
|
|
|
question_type_count[1].count = arr[1].length;
|
|
|
|
|
question_type_count[2].count = arr[2].length;
|
|
|
|
|
setQuestionType(question_type_count);
|
|
|
|
|
const qList = question_type_count
|
|
|
|
|
const questionList: any[] = []
|
|
|
|
|
qList.map((e, i) => {
|
|
|
|
|
if (e.count > 0) {
|
|
|
|
|
questionList.push({
|
|
|
|
|
children: [],
|
|
|
|
|
...e
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据分类拆分试题 左侧答题卡 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: "", state: 0, answerId: "" })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// 根据分类拆分试题 左侧答题卡 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: "", state: 0, answerId: "" })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 根据答题卡生成考试顺序
|
|
|
|
|
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]
|
|
|
|
|
// 根据答题卡生成考试顺序
|
|
|
|
|
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]
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setPaperInfo(questionInfo || [])
|
|
|
|
|
setQuestionNow(questionInfo[0] || [])
|
|
|
|
|
setQuestionTypeList(questionList || [])
|
|
|
|
|
setPaperInfo(questionInfo || [])
|
|
|
|
|
setQuestionNow(questionInfo[0] || [])
|
|
|
|
|
setQuestionTypeList(questionList || [])
|
|
|
|
|
|
|
|
|
|
setQuestioNum(questionInfo.length)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
setQuestioNum(questionInfo.length)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 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 arr = [[], [], []];
|
|
|
|
|
// const question_type_count = [
|
|
|
|
|
// { count: 0, question_type: 0, type_name: '单选' },
|
|
|
|
|
// { count: 0, question_type: 1, type_name: '多选' },
|
|
|
|
|
// { count: 0, question_type: 2, type_name: '判断' },
|
|
|
|
|
// ];
|
|
|
|
|
// if (result.question_list.length !== 0) {
|
|
|
|
|
// setRuleId(result.question_list[0].rules_id)
|
|
|
|
|
// result.question_list.forEach((item) => {
|
|
|
|
|
// if (item.question_type === 0) {
|
|
|
|
|
// arr[0].push(item)
|
|
|
|
|
// } else if (item.question_type === 1) {
|
|
|
|
|
// arr[1].push(item)
|
|
|
|
|
// } else {
|
|
|
|
|
// arr[2].push(item)
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// question_type_count[0].count = arr[0].length;
|
|
|
|
|
// question_type_count[1].count = arr[1].length;
|
|
|
|
|
// question_type_count[2].count = arr[2].length;
|
|
|
|
|
// setQuestionType(question_type_count);
|
|
|
|
|
// const qList = question_type_count
|
|
|
|
|
// const questionList: any[] = []
|
|
|
|
|
// qList.map((e, i) => {
|
|
|
|
|
// if (e.count > 0) {
|
|
|
|
|
// questionList.push({
|
|
|
|
|
// children: [],
|
|
|
|
|
// ...e
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// // 根据分类拆分试题 左侧答题卡 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: "", state: 0, answerId: "" })
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// // 根据答题卡生成考试顺序
|
|
|
|
|
// 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]
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// setPaperInfo(questionInfo || [])
|
|
|
|
|
// setQuestionNow(questionInfo[0] || [])
|
|
|
|
|
// setQuestionTypeList(questionList || [])
|
|
|
|
|
//
|
|
|
|
|
// setQuestioNum(questionInfo.length)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|