zhengpengju 3 years ago
commit 10505447e5

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

@ -1,7 +1,7 @@
/** 考试维护 */
import React, { useState, useRef } from 'react';
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 { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
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 { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import { ConsoleMessage } from 'puppeteer-core';
import ExaminationRules from '../../examinationrules/normal/index';
@ -124,6 +125,24 @@ const ExaminationList: React.FC = () => {
required: true,
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) => {
@ -141,6 +160,33 @@ const ExaminationList: React.FC = () => {
required: true,
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: '创建时间',
dataIndex: 'create_time',
valueType: 'dateTimeRange',
valueType: 'dateRange',
hideInTable: false,
hideInForm: true,
hideInSearch: false,
@ -169,6 +215,8 @@ const ExaminationList: React.FC = () => {
const { data: Items } = await querySubjectList({ page_size: 1000 });
// console.log(Items, ')))');
schemaForm.setFieldsValue({ rules_id: "" });
const sinfo = []
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++) {
rules.push({ label: Items[i].rules_name, value: Items[i].id })
}
schemaForm.setFieldsValue({ rules_id: "" });
return rules;
},
formItemProps: {
@ -256,6 +303,25 @@ const ExaminationList: React.FC = () => {
{
required: true,
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"
key="primary"
onClick={() => {
schemaForm.resetFields()
handleCreateModalVisible(true);
}}
>
<PlusOutlined />
@ -579,9 +647,11 @@ const ExaminationList: React.FC = () => {
<Modal
title="编辑"
width="60%"
visible={updateModalVisible}
destroyOnClose
onCancel={() => {
schemaForm.resetFields()
handleUpdateModalVisible(false);
}}
footer={null}
@ -590,10 +660,12 @@ const ExaminationList: React.FC = () => {
<BetaSchemaForm<DataItem>
layout="horizontal"
layoutType="Form"
form={schemaForm}
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values) => {
console.log('values', values);
schemaForm.validateFields()
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
//console.log('url', url)
const params = {
@ -615,6 +687,7 @@ const ExaminationList: React.FC = () => {
});
handleUpdateModalVisible(false); // 隐藏编辑窗口
actionRef.current?.reloadAndRest?.();
schemaForm.resetFields()
console.log(values);
}}
submitter={{

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

@ -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 (
<p>
<h3>{entity.subject_name}</h3>
<h3>{entity.rules_name}</h3>
<hr color='#f0f0f0' />
<div>{entity.examination_time}</div>
<div>{entity.sum_score}</div>
@ -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<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 (
<PageContainer content={false} extraContent={false}>
<div className={styles.cardList}>

@ -241,13 +241,6 @@ const CardList = () => {
setNextBtnShow(questionNowNum == questionNum ? true : false)
}, [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}分)`
}
const content = (
<div>
<p style={{ textAlign: "center", fontSize: 24 }}>
{rulesPaperInfo.rules_name}
</p>
</div >
);
return (
<PageContainer content={content} extraContent={false}>
<PageContainer content={content} extraContent={false} title={false}>
<Row>
{console.log(questionTypeList, 'questionTypeList')}

Loading…
Cancel
Save