zhengpengju 3 years ago
commit e0a077a12b

@ -82,7 +82,7 @@ export default defineConfig({
{
name: '资质考试答题',
icon: 'dashboard',
path: '/dashboard/qualification/examAnswer/:examination_id/:examination_name/:time',
path: '/dashboard/qualification/examAnswer/:examination_id/:rule_id/:examination_name/:time',
component: './dashboard/qualification/examAnswer',
hideInMenu: true,
},

@ -82,9 +82,11 @@ const CardList = () => {
// 当前题号
const [questionNowNum, setQuestionNowNum] = useState(0)
const [questionNum, setQuestioNum] = useState(0)
// 试题分数
const [rulesPaperScore, setRulesPaperScore] = useState([]);
const [timeData, setTimeData] = useState(0);
const [num,setNum]=useState(0);
const [questionType,setQuestionType]=useState([]);
useEffect(() => {
let secondValue = params.time; // 秒 截至时间 - 服务器当前时间
@ -138,6 +140,26 @@ const CardList = () => {
}
});
const getRules = useRequest(() => {
return getRulesPaper({
rules_id: params.rule_id
});
},
{
formatResult: (result) => {
return result;
},
onSuccess: (result) => {
// console.log(result, 111111111111111);
if (result.success) {
setRulesPaperScore(result.question_type_score || [])
// setQuestionTypeList(result.question_list[0].question_type_count)
}
}
});
const { run } = useRequest(getPaperQuestionList,
{
refreshDeps: [rulesPaperInfo],
@ -172,7 +194,7 @@ const CardList = () => {
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) => {
@ -308,9 +330,58 @@ const CardList = () => {
}
}
// 题型回数字
const tiTypeNum = (a: number) => {
switch (a) {
case 0:
return "一、"
break;
case 1:
return "二、"
break;
case 2:
return "三、"
break;
default:
return ""
break;
}
}
// 根据题型返回题数、分数、总分
const showQuestionTypeSocore = (type) => {
let questionName = ""
let num = 0
let score = 0
// 当前分类下试题总数
if (questionType.length !== 0) {
questionType.map((e, i) => {
if (e.question_type === type) {
num = e.count
questionName = e.type_name
}
})
rulesPaperScore.map((e, i) => {
if (e.question_type === type) {
score = e.score
}
})
}
return `${questionName} (共${num}题,每题${score}分)`
}
return (
<PageContainer content={content} extraContent={false}>
<div style={{marginBottom:'2rem',background:'#fff',width:'100%',height:'5rem',lineHeight:'5rem',fontSize:'23px',fontWeight:'bold',textAlign:'center'}}>{params.examination_name}</div>
<Row>
<Col span={6} style={{ paddingRight: 24 }}>
<ProCard
@ -327,7 +398,7 @@ const CardList = () => {
return <List
key={i}
header={e.type_name}
header={tiTypeNum(e.question_type) +e.type_name}
footer={false}
bordered
dataSource={e.children}
@ -362,13 +433,17 @@ const CardList = () => {
)}
<div>
<div style={{ float: 'right', lineHeight: "28px" }}>
</div><div className='pdefault dt-demo' />
<div style={{ float: 'right', lineHeight: "28px" }}>
</div><div className='pok dt-demo' />
</div>
</ProCard>
</Col>
<Col span={13} style={{ background: '#ffffff', padding: 0 }}>
<ProCard
title={
questionNow.question_type === 0 ? "一、单选题" : questionNow.question_type === 1 ? "二、多选题" : questionNow.question_type === 2 ? "判断题" : ""
}
title={tiTypeNum(questionNow.question_type) + showQuestionTypeSocore(questionNow.question_type)}
extra={false}
split='vertical'
borderedshia1
@ -376,9 +451,9 @@ const CardList = () => {
>
<Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}>
<Typography style={{ marginBottom: 16, fontSize: 18 }}>
{questionNow?.question_stem}
{questionNow.index?questionNow.index[1]+1:''}.
{questionNow?.question_stem}
{/* {console.log(questionNow.answerId, 'answerId', questionNow.answerId)} */}
</Typography>
<Space direction="vertical" style={{ fontSize: 16 }}>
<Form

@ -94,7 +94,7 @@ const Qualification = () => {
// const time = await getCurrentDate();
// getTime(time);
const time=rule.examination_time*60;
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.examination_name}/${time}`)
history.push(`/dashboard/qualification/examAnswer/${params.examination_id}/${examinationInfo.rules_id}/${examinationInfo.examination_name}/${time}`)
}
}
}

Loading…
Cancel
Save