zhengpengju 3 years ago
commit 10505447e5

@ -221,7 +221,7 @@ const CourseList: React.FC = () => {
}} }}
// disabled={record.status_type === 4 ? false : true} // disabled={record.status_type === 4 ? false : true}
> >
{record.status_type}
</Button>, </Button>,
<Button key="subscribeAlert" <Button key="subscribeAlert"
type="text" type="text"

@ -1,7 +1,7 @@
/** 考试维护 */ /** 考试维护 */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { useRequest, history } from 'umi'; import { useRequest, history } from 'umi';
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; import { ConsoleSqlOutlined, PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form, Popconfirm, Typography } from 'antd'; import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form, Popconfirm, Typography } from 'antd';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import type { ActionType } from '@ant-design/pro-table'; import type { ActionType } from '@ant-design/pro-table';
@ -17,6 +17,7 @@ import { querySubjectList, updateExamination, removeExamination, queryExaminatio
import type { TableListItem, TableListPagination } from './data'; import type { TableListItem, TableListPagination } from './data';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud'; import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import { ConsoleMessage } from 'puppeteer-core'; import { ConsoleMessage } from 'puppeteer-core';
import ExaminationRules from '../../examinationrules/normal/index';
@ -124,6 +125,24 @@ const ExaminationList: React.FC = () => {
required: true, required: true,
message: '请选择报名时间', message: '请选择报名时间',
}, },
{
validator: (rule, value) => {
console.log("报名时间:", rule, value)
// console.log(value[0] > value[1]);
const examinationTime = schemaForm.getFieldValue('examination_time')
if (examinationTime) {
if (value[0] > new Date(examinationTime[0])) {
return Promise.reject('报名开始时间不能晚于考试开始时间')
}
if (value[1] > new Date(examinationTime[0])) {
return Promise.reject('报名结束时间不能晚于考试开始时间')
}
}
return Promise.resolve()
// callback("时间不对");
}
}
] ]
}, },
render: (dom, entity) => { render: (dom, entity) => {
@ -141,6 +160,33 @@ const ExaminationList: React.FC = () => {
required: true, required: true,
message: '请选择考试时间', message: '请选择考试时间',
}, },
{
validator: (rule, value) => {
// console.log(value[0] > value[1]);
const applyTime = schemaForm.getFieldValue('apply_time')
const courseTime = schemaForm.getFieldValue('course_time')
if (applyTime) {
if (value[0] < new Date(applyTime[0])) {
return Promise.reject('考试开始时间不能晚于报名开始时间')
}
if (value[0] < new Date(applyTime[1])) {
return Promise.reject('考试开始时间不能晚于报名结束时间')
}
}
if (courseTime) {
if (value[0] < new Date(courseTime[0])) {
return Promise.reject('考试开始时间不能晚于课程主题开放开始时间')
}
}
return Promise.resolve()
// callback("时间不对");
}
}
] ]
}, },
@ -152,7 +198,7 @@ const ExaminationList: React.FC = () => {
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'create_time', dataIndex: 'create_time',
valueType: 'dateTimeRange', valueType: 'dateRange',
hideInTable: false, hideInTable: false,
hideInForm: true, hideInForm: true,
hideInSearch: false, hideInSearch: false,
@ -169,6 +215,8 @@ const ExaminationList: React.FC = () => {
const { data: Items } = await querySubjectList({ page_size: 1000 }); const { data: Items } = await querySubjectList({ page_size: 1000 });
// console.log(Items, ')))'); // console.log(Items, ')))');
schemaForm.setFieldsValue({ rules_id: "" });
const sinfo = [] const sinfo = []
for (let i = 0; i < Items.list.length; i++) { for (let i = 0; i < Items.list.length; i++) {
@ -203,7 +251,6 @@ const ExaminationList: React.FC = () => {
for (let i = 0; i < Items.length; i++) { for (let i = 0; i < Items.length; i++) {
rules.push({ label: Items[i].rules_name, value: Items[i].id }) rules.push({ label: Items[i].rules_name, value: Items[i].id })
} }
schemaForm.setFieldsValue({ rules_id: "" });
return rules; return rules;
}, },
formItemProps: { formItemProps: {
@ -256,6 +303,25 @@ const ExaminationList: React.FC = () => {
{ {
required: true, required: true,
message: '请选择主题开放时间', message: '请选择主题开放时间',
},
{
validator: (rule, value) => {
console.log("表单", value, schemaForm.getFieldsValue())
console.log("表单AA", currentRow);
// console.log(value[0] > value[1]);
const examinationTime = schemaForm.getFieldValue('examination_time')
// console.log("处理时间", examinationTime[0], new Date(examinationTime[0]));
if (examinationTime) {
if (value[0] > new Date(examinationTime[0])) {
return Promise.reject('课程主题开放开始不能晚于考试开始时间')
}
}
return Promise.resolve()
}
} }
] ]
}, },
@ -388,7 +454,9 @@ const ExaminationList: React.FC = () => {
type="primary" type="primary"
key="primary" key="primary"
onClick={() => { onClick={() => {
schemaForm.resetFields()
handleCreateModalVisible(true); handleCreateModalVisible(true);
}} }}
> >
<PlusOutlined /> <PlusOutlined />
@ -579,9 +647,11 @@ const ExaminationList: React.FC = () => {
<Modal <Modal
title="编辑" title="编辑"
width="60%" width="60%"
visible={updateModalVisible} visible={updateModalVisible}
destroyOnClose destroyOnClose
onCancel={() => { onCancel={() => {
schemaForm.resetFields()
handleUpdateModalVisible(false); handleUpdateModalVisible(false);
}} }}
footer={null} footer={null}
@ -590,10 +660,12 @@ const ExaminationList: React.FC = () => {
<BetaSchemaForm<DataItem> <BetaSchemaForm<DataItem>
layout="horizontal" layout="horizontal"
layoutType="Form" layoutType="Form"
form={schemaForm}
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }} wrapperCol={{ span: 12 }}
onFinish={async (values) => { onFinish={async (values) => {
console.log('values', values); console.log('values', values);
schemaForm.validateFields()
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
//console.log('url', url) //console.log('url', url)
const params = { const params = {
@ -615,6 +687,7 @@ const ExaminationList: React.FC = () => {
}); });
handleUpdateModalVisible(false); // 隐藏编辑窗口 handleUpdateModalVisible(false); // 隐藏编辑窗口
actionRef.current?.reloadAndRest?.(); actionRef.current?.reloadAndRest?.();
schemaForm.resetFields()
console.log(values); console.log(values);
}} }}
submitter={{ submitter={{

@ -11,14 +11,16 @@ const { Paragraph } = Typography;
import cookie from 'react-cookies'; import cookie from 'react-cookies';
// import { history } from "@@/core/history"; // import { history } from "@@/core/history";
let chapterCourse = []; // let chapterCourse = [];
let total_process = 0; const total_process = 0;
const CardList = () => { const CardList = () => {
const params = useParams(); const params = useParams();
const [selectedMenu, setSelectedMenu] = useState('') const [selectedMenu, setSelectedMenu] = useState('')
const [currentCourse, SetCurrentCourse] = useState() const [currentCourse, SetCurrentCourse] = useState()
const [courseQuestionProcess, setCourseQuestionProcess] = useState(0)
const [chapterCourse, setChapterCourse] = useState([])
/** 获取主题下课程 */ /** 获取主题下课程 */
const { data } = useRequest(() => { const { data } = useRequest(() => {
return viewMyLearningSubject({ return viewMyLearningSubject({
@ -54,9 +56,11 @@ const CardList = () => {
}, { }, {
manual: true, manual: true,
formatResult: (result) => { formatResult: (result) => {
if (result.list.length !== 0) { if (result.list.length !== 0) {
let total_finish_count = 0; let total_finish_count = 0;
let total_question_count = 0; let total_question_count = 0;
result.list.forEach((item) => { result.list.forEach((item) => {
total_finish_count += item.finish_count; total_finish_count += item.finish_count;
total_question_count += item.question_count; total_question_count += item.question_count;
@ -68,16 +72,23 @@ const CardList = () => {
item.process = 0; item.process = 0;
} }
}); });
console.log('result.list', result.list)
let total_process = 0
if (total_finish_count !== 0) { if (total_finish_count !== 0) {
const total_num = total_finish_count / total_question_count; const total_num = total_finish_count / total_question_count;
total_process = parseFloat(total_num).toFixed(2) total_process = parseFloat(total_num).toFixed(2)
setCourseQuestionProcess(total_process)
} else { } else {
total_process = 0; total_process = 0;
setCourseQuestionProcess(0)
} }
} else {
setCourseQuestionProcess(0)
} }
chapterCourse = result.list;
setChapterCourse(result.list)
// chapterCourse = result.list;
} }
}); });
@ -129,9 +140,7 @@ const CardList = () => {
<Button type="primary" <Button type="primary"
style={{ width: '10rem', height: '5rem' }} style={{ width: '10rem', height: '5rem' }}
onClick={async () => { onClick={async () => {
console.log('last_data', last_data)
const info = subject_data.subject_id + "," + cookie.load('person_id') const info = subject_data.subject_id + "," + cookie.load('person_id')
console.log(subject_data, 'subject_data')
const _data1 = await getErrorQuestionList({ const _data1 = await getErrorQuestionList({
@ -145,7 +154,6 @@ const CardList = () => {
}) })
} }
console.log(_data1, '_data1', num);
if (num > 0) { if (num > 0) {
history.push(`/mockExamination/chapterExamination/chapterList/chapterErrorListPaper/${info}`) history.push(`/mockExamination/chapterExamination/chapterList/chapterErrorListPaper/${info}`)
} else { } else {
@ -157,9 +165,9 @@ const CardList = () => {
</Card.Grid> </Card.Grid>
<Card.Grid hoverable={false} style={{ width: '50%', textAlign: 'center', boxShadow: 'none' }}> <Card.Grid hoverable={false} style={{ width: '50%', textAlign: 'center', boxShadow: 'none' }}>
<span style={{ display: 'inline-block', width: '100%' }}> <span style={{ display: 'inline-block', width: '100%' }}>
<Progress width={70} <Progress width={50}
type="circle" type="circle"
percent={parseInt(total_process * 100)} percent={parseInt(courseQuestionProcess * 100)}
format={(percent) => percent === 100 ? '100%' : `${percent}%`} format={(percent) => percent === 100 ? '100%' : `${percent}%`}
/> />
</span> </span>
@ -210,9 +218,10 @@ const CardList = () => {
</Menu> </Menu>
</Col> </Col>
<Col span={18} style={{ background: '#ffffff', padding: 24, minHeight: '20rem' }}> <Col span={18} style={{ background: '#ffffff', padding: 24, minHeight: '20rem' }}>
{console.log(chapterCourse, 'chapterCourse')}
{ {
chapterCourse !== undefined && chapterCourse !== '' ? chapterCourse.length > 0 ?
chapterCourse.map((item, index) => { chapterCourse?.map((item, index) => {
return ( return (
<div key={'chapterCourse' + index} > <div key={'chapterCourse' + index} >
<div style={{ marginBottom: '2rem', }}> <div style={{ marginBottom: '2rem', }}>
@ -228,7 +237,7 @@ const CardList = () => {
disabled={item.question_count > 0 ? false : true} disabled={item.question_count > 0 ? false : true}
onClick={() => { onClick={() => {
const info = cookie.load('identity_id') + ',' + item.chapter_id + ',' + item.course_id + ',' + item.finish_count + ',' + cookie.load('person_id') + ',' + item.subject_id; const info = cookie.load('identity_id') + ',' + item.chapter_id + ',' + item.course_id + ',' + item.finish_count + ',' + cookie.load('person_id') + ',' + item.subject_id;
console.log(info)
history.push(`/mockExamination/chapterExamination/chapterList/chapterListPaper/${info}`) history.push(`/mockExamination/chapterExamination/chapterList/chapterListPaper/${info}`)
}}></Button> }}></Button>
@ -240,7 +249,7 @@ const CardList = () => {
) )
}) })
: <></> : <></>
} }
</Col> </Col>
</Row> </Row>

@ -1,12 +1,13 @@
import { PlusOutlined } from '@ant-design/icons'; 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 { PageContainer } from '@ant-design/pro-layout';
import { history } from 'umi'; import { history, useRequest } from 'umi';
import { getRulesList, getSubjectInfo } from './service'; import { getRulesList, getRulesPaper, getSubjectInfo } from './service';
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import styles from './style.less'; import styles from './style.less';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { Legend } from 'bizcharts';
const SubjectList = () => { const SubjectList = () => {
@ -40,7 +41,7 @@ const SubjectList = () => {
render: (dom, entity) => { render: (dom, entity) => {
return ( return (
<p> <p>
<h3>{entity.subject_name}</h3> <h3>{entity.rules_name}</h3>
<hr color='#f0f0f0' /> <hr color='#f0f0f0' />
<div>{entity.examination_time}</div> <div>{entity.examination_time}</div>
<div>{entity.sum_score}</div> <div>{entity.sum_score}</div>
@ -80,7 +81,13 @@ const SubjectList = () => {
type="primary" type="primary"
key="editable" key="editable"
onClick={() => { 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<ActionType>(); const actionRef = useRef<ActionType>();
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 ( return (
<PageContainer content={false} extraContent={false}> <PageContainer content={false} extraContent={false}>
<div className={styles.cardList}> <div className={styles.cardList}>

@ -241,13 +241,6 @@ const CardList = () => {
setNextBtnShow(questionNowNum == questionNum ? true : false) setNextBtnShow(questionNowNum == questionNum ? true : false)
}, [questionNowNum, questionNum]) }, [questionNowNum, questionNum])
const content = (
<div className={styles.pageHeaderContent}>
<p>
{/* 试卷信息:{rulesPaperInfo?.question_list[0].rules_name} */}
</p>
</div>
);
// 提交试卷 // 提交试卷
@ -396,8 +389,21 @@ const CardList = () => {
return `${questionName} (共${num}题,每题${score}分)` return `${questionName} (共${num}题,每题${score}分)`
} }
const content = (
<div>
<p style={{ textAlign: "center", fontSize: 24 }}>
{rulesPaperInfo.rules_name}
</p>
</div >
);
return ( return (
<PageContainer content={content} extraContent={false}> <PageContainer content={content} extraContent={false} title={false}>
<Row> <Row>
{console.log(questionTypeList, 'questionTypeList')} {console.log(questionTypeList, 'questionTypeList')}

Loading…
Cancel
Save