考试画面修改

main
liuyiliang 3 months ago
parent 864e353a93
commit a8cf3d81ac
  1. 75
      packages/examination/src/views/exam-online/compoents/ExamDetailAnalysisPage.tsx
  2. 63
      packages/examination/src/views/exam-online/compoents/ExamListPage.tsx
  3. 3
      packages/examination/src/views/exam-online/exam-schedule.tsx
  4. 7
      packages/examination/src/views/statistical/serviceStatistics.tsx

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { Row, Col, Input, Select, Button, Table, Space, Cascader, Modal } from 'antd';
import {Row, Col, Input, Select, Button, Table, Space, Cascader, Modal, Form, TreeSelect} from 'antd';
import ReactECharts from 'echarts-for-react';
import {getExamDetailAnalysisPageList, getIndustryList, getScoreDistribution} from 'api/exam-online/index';
import { convertToCascaderData } from "./ExamEditPage";
@ -21,6 +21,7 @@ type ExamDataItem = {
};
const ExamDetailAnalysisPage: React.FC = () => {
let formRef = React.createRef<any>();
const [examName, setExamName] = useState('');
const [paperName, setPaperName] = useState('');
const [examArea, setExamArea] = useState('');
@ -63,7 +64,8 @@ const ExamDetailAnalysisPage: React.FC = () => {
setPaperName('');
setExamArea('');
setIndustry(null);
handleSearch();
const form = formRef.current;
form.resetFields();
};
const handleSearch = () => {
@ -170,41 +172,40 @@ const ExamDetailAnalysisPage: React.FC = () => {
<div>
<div className="header-filter">
<div className="list-filter" style={{display: 'flex', padding: 15}}>
<Row gutter={16}>
<Col span={5}>
<span style={{ marginRight: 8 }}>:</span>
<Input
placeholder="考试名称"
value={examName}
onChange={(e) => setExamName(e.target.value)}
style={{ width: 'calc(100% - 100px)' }} // 调整输入框宽度
/>
</Col>
<Col span={5}>
<span style={{ marginRight: 8 }}>:</span>
<Input
placeholder="试卷名称"
value={paperName}
onChange={(e) => setPaperName(e.target.value)}
style={{ width: 'calc(100% - 100px)' }} // 调整输入框宽度
/>
</Col>
<Col span={5}>
<span style={{ marginRight: 8 }}>:</span>
<Form
ref={formRef}
className="filter"
layout="inline"
name="basic"
style={{ paddingLeft: 20 }}>
<Form.Item
label="考试名称:"
name="examName">
<Input placeholder="考试名称" onChange={(e) => setExamName(e.target.value)}/>
</Form.Item>
<Form.Item
label="试卷名称:"
name="paperName">
<Input placeholder="试卷名称" onChange={(e) => setPaperName(e.target.value)}/>
</Form.Item>
<Form.Item
label="考试区域:"
name="examArea">
<Cascader
options={convertToCascaderData()}
placeholder="请选择考试区域"
placeholder="考试区域"
onChange={(values) => setExamArea(convertArrToRegion(values))}
style={{ width: 'calc(100% - 100px)' }} // 调整级联选择器宽度
style={{width: 195}}
/>
</Col>
<Col span={5}>
<span style={{ marginRight: 8 }}>:</span>
</Form.Item>
<Form.Item
label="监管行业:"
name="industry">
<Select
placeholder="监管行业"
value={industry}
onChange={(value) => setIndustry(value)}
style={{ width: 150 }} // 调整下拉框宽度
style={{width: 195}}
allowClear
>
{industryOptions.map((option) => (
@ -213,14 +214,16 @@ const ExamDetailAnalysisPage: React.FC = () => {
</Option>
))}
</Select>
</Col>
<Col span={4}>
<Space>
<Button onClick={handleReset}></Button>
</Form.Item>
<Form.Item>
<Button htmlType="button" onClick={handleReset}>
</Button>
</Form.Item>
<Form.Item>
<Button type="primary" onClick={handleSearch}></Button>
</Space>
</Col>
</Row>
</Form.Item>
</Form>
</div>
</div>
<Table

@ -111,6 +111,10 @@ const ExamListPage = ({ history }: { history: any }) => {
if (!res) {
return;
}
message.open({
type: 'success',
content: '操作成功',
});
research();
}).catch(() => { })
},
@ -132,9 +136,28 @@ const ExamListPage = ({ history }: { history: any }) => {
onOk: () => {
const hasWithdrawn = selectedExams.some(exam => exam.publishStatus === 0 || exam.publishStatus === 2);
if (hasWithdrawn) {
const confirm = window.confirm('选中数据当中有无法撤回的数据,是否继续');
if (!confirm) {
return;
let warn1Arr = selectedExams.filter(exam => exam.publishStatus === 0);
if (warn1Arr && warn1Arr.length) {
let warnMessage = [];
for (let index = 0; index < warn1Arr.length; index ++) {
warnMessage.push(warn1Arr[index].examName);
}
message.open({
type: 'warning',
content: '操作失败:' + warnMessage.join('、') + '禁止撤回',
});
}
let warn2Arr = selectedExams.filter(exam => exam.publishStatus === 2);
if (warn2Arr && warn2Arr.length) {
let warnMessage = [];
for (let index = 0; index < warn2Arr.length; index ++) {
warnMessage.push(warn2Arr[index].examName);
}
message.open({
type: 'warning',
content: '操作失败:' + warnMessage.join('、') + '数据已撤回',
});
}
}
@ -147,6 +170,10 @@ const ExamListPage = ({ history }: { history: any }) => {
if (!res) {
return;
}
message.open({
type: 'success',
content: '操作成功',
});
research();
}).catch(() => { })
}
@ -167,16 +194,24 @@ const ExamListPage = ({ history }: { history: any }) => {
title: '确认发布',
content: '你确定要发布这些选中的考试吗?',
onOk: () => {
const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1 || exam.publishStatus === 2);
const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1);
if (hasPublishedOrWithdrawn) {
const confirm = window.confirm('选中数据当中有无法发布的数据,是否继续');
if (!confirm) {
return;
let warn1Arr = selectedExams.filter(exam => exam.publishStatus === 1);
if (warn1Arr && warn1Arr.length) {
let warnMessage = [];
for (let index = 0; index < warn1Arr.length; index ++) {
warnMessage.push(warn1Arr[index].examName);
}
message.open({
type: 'warning',
content: '操作失败:' + warnMessage.join('、') + '数据已发布',
});
}
}
// 筛选出可以发布的数据
const validExams = selectedExams.filter(exam => exam.publishStatus === 0);
const validExams = selectedExams.filter(exam => exam.publishStatus === 0 || exam.publishStatus === 2);
const validIds = validExams.map(exam => String(exam.examId));
if (validIds.length > 0) {
@ -184,6 +219,10 @@ const ExamListPage = ({ history }: { history: any }) => {
if (!res) {
return;
}
message.open({
type: 'success',
content: '操作成功',
});
research();
}).catch(() => { })
}
@ -231,8 +270,9 @@ const ExamListPage = ({ history }: { history: any }) => {
const handleGenerateQrCode = (exam: any) => {
// 实现生成考试码逻辑
setExamId(exam.examId);
setQrCodeData(exam.examId);
setQrCodeData(exam.path ? exam.path : exam.examId);
setExamName(exam.examName);
debugger
if (exam.captcha) {
setCaptcha(exam.captcha);
} else {
@ -319,7 +359,7 @@ const ExamListPage = ({ history }: { history: any }) => {
// 判断是否全选
const isAllSelected = currentPageExamList.length > 0 && selectedRows.length === currentPageExamList.length;
const columns = [
const columns: any = [
{
title: (
<Checkbox
@ -329,6 +369,7 @@ const ExamListPage = ({ history }: { history: any }) => {
),
dataIndex: 'examId',
key: 'examId',
align: 'center',
render: (cellValue: number, record: Exam) => (
<Checkbox
checked={selectedRows.includes(record.examId)}
@ -420,7 +461,7 @@ const ExamListPage = ({ history }: { history: any }) => {
>
</a>)}
{record.publishStatus === 0 || record.publishStatus === 2 && (
{(record.publishStatus === 0 || record.publishStatus === 2) && (
<a onClick={() => handlePublishSingle(record.examId)}></a>
)}
{record.publishStatus === 1 && (

@ -14,13 +14,12 @@ class ExamSchedule extends Component<any, States> {
this.state = {
resData: undefined,
visible: false,
title: '新增公告',
title: '',
current: {}
}
}
componentDidMount() {
// this.getList()
}
render() {

@ -108,7 +108,12 @@ const App: React.FC = () => {
const query = { page: current, num: pageSize || 20 }
setTimeout(() => {
setQuery(query);
getListApi({}, query.page, query.num)
getListApi({
dateFilter: form.getFieldValue('dateFilter'),
startDate: form.getFieldValue('selectDateTime') ? formatDate(form.getFieldValue('selectDateTime')[0]) : null,
doneDate: form.getFieldValue('selectDateTime') ? formatDate(form.getFieldValue('selectDateTime')[1]) : null,
serviceStatus: form.getFieldValue('serviceStatus')
}, query.page, query.num)
}, 0)
}

Loading…
Cancel
Save