测试bug修改

master
wangxi 3 years ago
parent 0c36bf854b
commit 3fa57485f4

@ -120,7 +120,7 @@ export default defineConfig({
path: '/course', path: '/course',
routes: [ routes: [
{ {
name: '主题', name: '课程学习',
icon: 'smile', icon: 'smile',
path: '/course/subject', path: '/course/subject',
component: './course/subject', component: './course/subject',

@ -124,3 +124,12 @@ export async function getPersonPaperId(params: {
params, params,
}); });
} }
//获取准考证号
export async function getExaminationPersonApplyInfo(params: {
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/person/getExaminationPersonApplyInfo', {
params,
});
}

@ -5,7 +5,7 @@ import { PageContainer } from '@ant-design/pro-layout';
import { useParams, useRequest, history } from 'umi'; import { useParams, useRequest, history } from 'umi';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
const { Text, Link } = Typography; const { Text, Link } = Typography;
import { getRulesPaper, getPaperQuestionList, finishExamination, getPersonPaperId } from './examAnser'; import { getRulesPaper, getPaperQuestionList, finishExamination, getPersonPaperId,getExaminationPersonApplyInfo } from './examAnser';
import type { CardListItemDataType } from '../data'; import type { CardListItemDataType } from '../data';
import styles from './style.less'; import styles from './style.less';
import cookie from 'react-cookies'; import cookie from 'react-cookies';
@ -75,7 +75,7 @@ const CardList = () => {
// 解析可见 // 解析可见
const [parsingShow, setParsingShow] = useState(false) const [parsingShow, setParsingShow] = useState(false)
const [testInfo, setTestInfo] = useState({})
const [lastBtnShow, setLastBtnShow] = useState(true) const [lastBtnShow, setLastBtnShow] = useState(true)
const [nextBtnShow, setNextBtnShow] = useState(false) const [nextBtnShow, setNextBtnShow] = useState(false)
@ -84,7 +84,7 @@ const CardList = () => {
const [questionNum, setQuestioNum] = useState(0) const [questionNum, setQuestioNum] = useState(0)
const [timeData, setTimeData] = useState(0); const [timeData, setTimeData] = useState(0);
const [num,setNum]=useState(0);
useEffect(() => { useEffect(() => {
let secondValue = params.time; // 秒 截至时间 - 服务器当前时间 let secondValue = params.time; // 秒 截至时间 - 服务器当前时间
@ -120,6 +120,24 @@ const CardList = () => {
} }
}); });
const personInfo = useRequest(() => {
return getExaminationPersonApplyInfo({
examination_id: params.examination_id,
person_id: cookie.load('person_id')
});
},
{
formatResult: (result) => {
return result;
},
onSuccess: (result) => {
if (result.success) {
console.log('result准考证',result);
setTestInfo(result.bean);
}
}
});
const { run } = useRequest(getPaperQuestionList, const { run } = useRequest(getPaperQuestionList,
{ {
refreshDeps: [rulesPaperInfo], refreshDeps: [rulesPaperInfo],
@ -137,7 +155,7 @@ const CardList = () => {
const question_type_count = [ const question_type_count = [
{ count: 0, question_type: 0, type_name: '单选' }, { count: 0, question_type: 0, type_name: '单选' },
{ count: 0, question_type: 1, type_name: '多选' }, { count: 0, question_type: 1, type_name: '多选' },
{ count: 0, question_type: 2, type_name: '填空' }, { count: 0, question_type: 2, type_name: '判断' },
]; ];
if (result.question_list.length !== 0) { if (result.question_list.length !== 0) {
setRuleId(result.question_list[0].rules_id) setRuleId(result.question_list[0].rules_id)
@ -211,7 +229,7 @@ const CardList = () => {
// const timeDiff = params.duration / 1000 - time; // const timeDiff = params.duration / 1000 - time;
const timeDiff=params.time-time; const timeDiff=params.time-time;
console.log('timeDiff',timeDiff) // console.log('timeDiff',timeDiff)
history.push(`/dashboard/qualification/result/${result.data.pass_score}/${result.data.score}/${result.data.sum_score}/${params.examination_id}/${params.examination_name}/${timeDiff}`); history.push(`/dashboard/qualification/result/${result.data.pass_score}/${result.data.score}/${result.data.sum_score}/${params.examination_id}/${params.examination_name}/${timeDiff}`);
} }
} }
@ -221,7 +239,6 @@ const CardList = () => {
useEffect(() => { useEffect(() => {
// 已选择题目回显 // 已选择题目回显
formRef?.current?.setFieldsValue({ note: questionNow.answerId }); formRef?.current?.setFieldsValue({ note: questionNow.answerId });
@ -315,6 +332,7 @@ const CardList = () => {
bordered bordered
dataSource={e.children} dataSource={e.children}
renderItem={(item, index) => { renderItem={(item, index) => {
setNum(index+1);
// console.log(item, 'list') // console.log(item, 'list')
return <List.Item return <List.Item
id={item.id} id={item.id}
@ -349,16 +367,17 @@ const CardList = () => {
<Col span={13} style={{ background: '#ffffff', padding: 0 }}> <Col span={13} style={{ background: '#ffffff', padding: 0 }}>
<ProCard <ProCard
title={ title={
questionNow.question_type === 0 ? "一、单选" : questionNow.question_type === 1 ? "二、多选题" : questionNow.question_type === 2 ? "判断题" : "" questionNow.question_type === 0 ? "一、单选" : questionNow.question_type === 1 ? "二、多选题" : questionNow.question_type === 2 ? "判断题" : ""
} }
extra={false} extra={false}
split='vertical' split='vertical'
bordered borderedshia1
headerBordered headerBordered
> >
<Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}> <Space direction="vertical" style={{ width: '100%', padding: '24px 48px' }}>
<Typography style={{ marginBottom: 16, fontSize: 18 }}> <Typography style={{ marginBottom: 16, fontSize: 18 }}>
{questionNow?.question_stem} {num}. {questionNow?.question_stem}
{/* {console.log(questionNow.answerId, 'answerId', questionNow.answerId)} */} {/* {console.log(questionNow.answerId, 'answerId', questionNow.answerId)} */}
</Typography> </Typography>
<Space direction="vertical" style={{ fontSize: 16 }}> <Space direction="vertical" style={{ fontSize: 16 }}>
@ -366,15 +385,12 @@ const CardList = () => {
ref={formRef} name="control-ref" ref={formRef} name="control-ref"
> >
{/*{console.log('questionNow',questionNow)}*/} {/*{console.log('questionNow',questionNow)}*/}
<Form.Item name="note" label="Note" rules={[{ required: true }]}> <Form.Item name="note">
{questionNow.question_type === 0 ? {questionNow.question_type === 0 ?
( (
<Radio.Group> <Radio.Group>
<Space direction="vertical">{questionNow?.answers?.map((item, index) => { <Space direction="vertical">{questionNow?.answers?.map((item, index) => {
s
return <Radio key={item.id} return <Radio key={item.id}
onChange={() => { onChange={() => {
const qArr = [] const qArr = []
@ -492,6 +508,10 @@ s
<Col span={5} style={{ paddingLeft: 24 }}> <Col span={5} style={{ paddingLeft: 24 }}>
<div style={{ background: '#ffffff', padding: 24 }}> <div style={{ background: '#ffffff', padding: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}> <Space direction="vertical" style={{ width: '100%' }}>
<strong></strong>
<Typography>{testInfo?.person_name}</Typography>
<strong></strong>
<Typography>{testInfo?.admission_number}</Typography>
<strong></strong> <strong></strong>
<Typography>{formatSeconds(timeData)}</Typography> <Typography>{formatSeconds(timeData)}</Typography>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} /> <Divider style={{ margin: '6px 0', opacity: 0.5 }} />

@ -7,7 +7,7 @@ import { PageContainer } from '@ant-design/pro-layout';
import moment from 'moment'; import moment from 'moment';
import EditableLinkGroup from './components/EditableLinkGroup'; import EditableLinkGroup from './components/EditableLinkGroup';
import styles from './style.less'; import styles from './style.less';
import {getExaminationById,getPersonPaperId } from './service'; import {getExaminationPersonApplyInfo,getPersonPaperId } from './service';
import cookie from 'react-cookies'; import cookie from 'react-cookies';
import OfflineData from './components/OfflineData'; import OfflineData from './components/OfflineData';
@ -62,6 +62,7 @@ const Result = () => {
const [rule, setRule] = useState({}); const [rule, setRule] = useState({});
const [buttonText, setButtonText] = useState('返回'); const [buttonText, setButtonText] = useState('返回');
const [passInfo, setPassInfo] = useState(false); const [passInfo, setPassInfo] = useState(false);
const [testInfo, setTestInfo] = useState({})
const params = useParams(); const params = useParams();
//获取考试详情 //获取考试详情
// const a=2; // const a=2;
@ -81,6 +82,24 @@ const Result = () => {
getPass() getPass()
}, []); }, []);
const personInfo = useRequest(() => {
return getExaminationPersonApplyInfo({
examination_id: params.examination_id,
person_id: cookie.load('person_id')
});
},
{
formatResult: (result) => {
return result;
},
onSuccess: (result) => {
if (result.success) {
console.log('result准考证',result);
setTestInfo(result.bean);
}
}
});
const { data: chapterCourse, run } = useRequest(() => { const { data: chapterCourse, run } = useRequest(() => {
return getPersonPaperId({ return getPersonPaperId({
examination_id:params.examination_id, examination_id:params.examination_id,
@ -103,6 +122,16 @@ const Result = () => {
<div className="qualification" style={{height:window.innerHeight-300,background:'#fff',width:'100%',padding:20}}> <div className="qualification" style={{height:window.innerHeight-300,background:'#fff',width:'100%',padding:20}}>
<div ><span className="title" onClick={()=>{history.push('/dashboard/workplace')}}></span> / / {params.examination_name}</div> <div ><span className="title" onClick={()=>{history.push('/dashboard/workplace')}}></span> / / {params.examination_name}</div>
<div className={"top"}>{params.examination_name}</div> <div className={"top"}>{params.examination_name}</div>
<div style={{position:'absolute',right:'2rem',top:'3.5rem',lineHeight:'2rem'}}>
<div>
<span></span>
<span>{testInfo?.person_name}</span>
</div>
<div>
<span></span>
<span>{testInfo?.admission_number}</span>
</div>
</div>
<div style={{width:'12rem',margin:'0 auto'}}> <div style={{width:'12rem',margin:'0 auto'}}>
<div className='condition' > <div className='condition' >
<div className='condition-title' ></div> <div className='condition-title' ></div>

@ -35,6 +35,16 @@ export async function getCurrentDate(params: {
}); });
} }
//获取准考证号
export async function getExaminationPersonApplyInfo(params: {
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/person/getExaminationPersonApplyInfo', {
params,
});
}

@ -10,7 +10,7 @@ const { Step } = Steps;
const extra = ( const extra = (
<Fragment> <Fragment>
<Button type="primary" onClick={()=>{ <Button type="primary" onClick={()=>{
history.push('/dashboard/workplaces') history.push('/dashboard/workplace')
}}></Button> }}></Button>
</Fragment> </Fragment>
); );

Loading…
Cancel
Save