From 742ce5a7d83921d09a835287b48793b763b0a8b3 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Fri, 18 Mar 2022 14:45:24 +0800 Subject: [PATCH] bug --- .../pages/examination/certificate/index.tsx | 2 +- admin/src/pages/examination/option/index.tsx | 79 ++++++++++++++++++- web/src/pages/mockExamination/chapterList.tsx | 37 +++++---- web/src/pages/mockExamination/index.tsx | 53 +++++++++++-- web/src/pages/mockExamination/paper/index.tsx | 22 ++++-- 5 files changed, 162 insertions(+), 31 deletions(-) diff --git a/admin/src/pages/examination/certificate/index.tsx b/admin/src/pages/examination/certificate/index.tsx index 06a8f0d..e220516 100644 --- a/admin/src/pages/examination/certificate/index.tsx +++ b/admin/src/pages/examination/certificate/index.tsx @@ -221,7 +221,7 @@ const CourseList: React.FC = () => { }} // disabled={record.status_type === 4 ? false : true} > - 查看名单{record.status_type} + 查看名单 , @@ -240,7 +249,7 @@ const CardList = () => { ) }) - : <>暂无 + : <>暂无章节 } diff --git a/web/src/pages/mockExamination/index.tsx b/web/src/pages/mockExamination/index.tsx index 0441e1c..45ca959 100644 --- a/web/src/pages/mockExamination/index.tsx +++ b/web/src/pages/mockExamination/index.tsx @@ -1,12 +1,13 @@ import { PlusOutlined } from '@ant-design/icons'; -import { Button, Card, List, Progress, Typography, Image } from 'antd'; +import { Button, Card, List, Progress, Typography, Image, message } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; -import { history } from 'umi'; -import { getRulesList, getSubjectInfo } from './service'; +import { history, useRequest } from 'umi'; +import { getRulesList, getRulesPaper, getSubjectInfo } from './service'; import React, { useRef } from 'react'; import styles from './style.less'; import ProTable from '@ant-design/pro-table'; +import { Legend } from 'bizcharts'; const SubjectList = () => { @@ -40,7 +41,7 @@ const SubjectList = () => { render: (dom, entity) => { return (

-

{entity.subject_name}

+

{entity.rules_name}


考试时间:{entity.examination_time}分钟
满分:{entity.sum_score}分
@@ -80,7 +81,13 @@ const SubjectList = () => { type="primary" key="editable" onClick={() => { - history.push(`/mockExamination/index/paper/${record.id}/${record.examination_time}`); + + + runRulesPaper({ rules_id: record.id, time: record.examination_time }) + // history.push(`/mockExamination/index/paper/${record.id}/${record.examination_time}`); + + + }} > 开始考试 @@ -90,6 +97,42 @@ const SubjectList = () => { }, ]; const actionRef = useRef(); + + + + + + const { run: runRulesPaper } = useRequest(getRulesPaper, + { + manual: true, + formatResult: (result) => { + return result; + }, + onSuccess: (result, params) => { + let num = 0 + console.log(result, 'eee', params); + + if (result.success) { + if (result.question_list.length > 0) { + + + result.question_list[0].question_type_count.map((e) => { + num += e.count + }) + } + } + if (num > 0) { + + history.push(`/mockExamination/index/paper/${params[0].rules_id}/${params[0].time}`) + // console.log(num, 'eee', params); + } else { + + message.error("暂无试题。"); + } + + + } + }); return (
diff --git a/web/src/pages/mockExamination/paper/index.tsx b/web/src/pages/mockExamination/paper/index.tsx index c8dac28..e58a6c5 100644 --- a/web/src/pages/mockExamination/paper/index.tsx +++ b/web/src/pages/mockExamination/paper/index.tsx @@ -241,13 +241,6 @@ const CardList = () => { setNextBtnShow(questionNowNum == questionNum ? true : false) }, [questionNowNum, questionNum]) - const content = ( -
-

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

-
- ); // 提交试卷 @@ -396,8 +389,21 @@ const CardList = () => { return `${questionName} (共${num}题,每题${score}分)` } + + + + + + const content = ( +
+

+ {rulesPaperInfo.rules_name} +

+
+ ); + return ( - + {console.log(questionTypeList, 'questionTypeList')}