Commit 00ae188b by yuananting

feat:试卷优化

parent 833adc93
......@@ -34,20 +34,27 @@ function AddExam(props: any) {
const [getData, setGetData] = useState(false);
const [preview, setPreview] = useState(false);
const [examTotal, setExamTotal] = useState(0);
const timer = useRef({});
const request = useRef(false);
const { match } = props;
const [examDuration, setExamDuration] = useState(undefined);
useEffect(() => {
if (props.type === 'edit' || props.type === 'copy') {
queryExamDetail()
switch (props.type) {
case "copy": // 考试列表-复制考试进入
case "edit": // 考试列表-编辑考试进入
queryExamDetail();
break;
case "organizeExam": // 试卷列表-组织考试进入
case "newPaperToAddExam": // 组卷页面-新建保存试卷并组织考试
case "editPaperToAddExam": // 组卷页面-编辑保存试卷并组织考试
setGetData(true);
setPaperInfo(props.paperInfo);
break;
}
}, [])
useEffect(() => {
console.log(paperInfo)
setPaperId(paperInfo.paperId)
setPassRate(paperInfo.passRate)
......@@ -172,8 +179,18 @@ function AddExam(props: any) {
Service.Hades(props.type === 'edit' ? 'public/hades/editExam' : "public/hades/createExam", param).then((res) => {
message.success(props.type === 'edit' ? '编辑成功' : '创建成功');
props.freshList()
props.history.goBack();
switch (props.type) {
case "organizeExam": // 试卷列表-组织考试进入
case "newPaperToAddExam": // 组卷保存组织考试
case "editPaperToAddExam":
window.RCHistory.push("/examination-manage-index")
break;
case "add":
case "edit": // 考试列表-新建或编辑
props.freshList()
props.history.goBack();
break;
}
})
}
......@@ -228,6 +245,9 @@ function AddExam(props: any) {
let title = '';
switch (props.type) {
case 'add':
case "organizeExam":
case "newPaperToAddExam":
case "editPaperToAddExam":
title = '新建考试';
break;
case 'edit':
......
......@@ -207,7 +207,6 @@ function ExamData(props: any) {
return <div className="rr">
<a
target="_blank"
download
id="load-play-back-excel"
style={{ position: "absolute", left: "-10000px" }}
......
......@@ -302,7 +302,6 @@ function ExaminationManager(props: any) {
function onChange(pagination: any, filters: any, sorter: any, extra: any) {
setfield(sorter.field);
setOrder(sorter.order)
console.log(sorter.field, sorter.order, (orderEnum as any)[sorter.field])
let _query: any = { ...queryRef.current };
_query.order = (orderEnum as any)[sorter.field][sorter.order] || 'EXAM_START_TIME_DESC'
setQuery(_query)
......@@ -421,7 +420,6 @@ function ExaminationManager(props: any) {
total={total}
onShowSizeChange={onShowSizeChange}
toPage={(page: any) => {
console.log(page)
let _query: any = { ...queryRef.current };
_query.current = page + 1;
setQuery(_query)
......@@ -445,8 +443,6 @@ function ExaminationManager(props: any) {
} else {
getList()
}
}} />;
}} />
<Route path={`${match.url}/edit/:id`} render={() => {
......
......@@ -182,7 +182,6 @@ function DataAnalysic(props: any) {
return <div className="rr">
<a
target="_blank"
download
id="load-play-back-excel"
style={{ position: "absolute", left: "-10000px" }}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-05-20 11:37:40
* @LastEditTime: 2021-05-30 21:29:46
* @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -20,11 +20,11 @@ import {
ConfigProvider,
Empty,
} from "antd";
import { DownOutlined } from '@ant-design/icons';
import { PageControl } from "@/components";
import "./PaperList.less";
import { Route, withRouter } from "react-router-dom";
import OperatePaper from "@/modules/teach-tool/paper-manage/OperatePaper";
import AddExam from "@/modules/teach-tool/examination-manager/AddExam";
import User from "@/common/js/user";
import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import Service from "@/common/js/service";
......@@ -53,6 +53,7 @@ class PaperList extends Component {
paperPreviewModal: null, // 试卷预览模态框
loading: false,
selectedPaperKeys: [],
paperInfo: {}, // 选择的某份试卷用于组织考试
};
}
......@@ -122,7 +123,6 @@ class PaperList extends Component {
// 查询试卷列表
queryPaperPageList = async () => {
const res = await AidToolService.queryPaperPageList(this.state.query);
Bus.trigger("queryCategoryTree", "remain");
const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total, loading: false });
};
......@@ -174,6 +174,20 @@ class PaperList extends Component {
}
};
organizeExam = (record) => {
const { match } = this.props;
this.setState(
{
paperInfo: record,
},
() => {
window.RCHistory.push({
pathname: `${match.url}/exam-operate-page`,
});
}
);
};
// 删除试卷
deletePaper = (record) => {
let params = {
......@@ -195,6 +209,7 @@ class PaperList extends Component {
}
this.setState({ query: _query }, () => {
this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
});
}
});
......@@ -380,6 +395,9 @@ class PaperList extends Component {
<Menu.Item key="edit">
<span onClick={() => this.editPaper(item)}>编辑</span>
</Menu.Item>
<Menu.Item key="organizeExam">
<span onClick={() => this.organizeExam(item)}>组织考试</span>
</Menu.Item>
<Menu.Item key="del">
<span onClick={() => this.confirmDeletePaper(item)}>删除</span>
</Menu.Item>
......@@ -426,6 +444,7 @@ class PaperList extends Component {
if (res.success) {
message.success('移动成功');
this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
this.clearSelect();
} else {
message.error('移动失败');
......@@ -494,6 +513,7 @@ class PaperList extends Component {
selectedPaperKeys,
openMoveModal,
paperData,
paperInfo,
} = this.state;
const { current, size, categoryId, paperName } = query;
const paperRowSelection = {
......@@ -594,7 +614,7 @@ class PaperList extends Component {
<Table
rowKey={(record) => record.paperId}
dataSource={dataSource}
size={this.props.type == "modal-select"?'small':'middle'}
size={this.props.type == "modal-select" ? "small" : "middle"}
rowKey={(item) => {
return item.paperId;
}}
......@@ -612,7 +632,7 @@ class PaperList extends Component {
current={current - 1}
pageSize={size}
total={total}
size={this.props.type == "modal-select"?'small':'middle'}
size={this.props.type == "modal-select" ? "small" : "middle"}
toPage={(page) => {
const _query = { ...query, current: page + 1 };
this.setState({ query: _query }, () =>
......@@ -643,6 +663,17 @@ class PaperList extends Component {
path={`${match.url}/paper-operate-page`}
component={OperatePaper}
/>
<Route
path={`${match.url}/exam-operate-page`}
render={() => {
return (
<AddExam
paperInfo={paperInfo}
type="organizeExam"
/>
);
}}
/>
</div>
);
}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-05-20 11:43:21
* @LastEditTime: 2021-05-30 18:17:05
* @Description: 助学工具-新建试卷-选择题目列表
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -16,6 +16,7 @@ import {
Select,
Tooltip,
message,
DatePicker,
} from "antd";
import { PageControl } from "@/components";
import "./SelectQuestionList.less";
......@@ -23,8 +24,10 @@ import User from "@/common/js/user";
import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import _ from "underscore";
import Bus from "@/core/bus";
import moment from 'moment';
const { Search } = Input;
const { RangePicker } = DatePicker;
const questionTypeEnum = {
SINGLE_CHOICE: "单选题",
......@@ -68,12 +71,15 @@ class SelectQuestionList extends Component {
categoryId: null, // 当前题库分类Id
questionName: null, // 题目名称
questionType: null, // 题目类型
updateDateStart: null,
updateDateEnd: null,
source: 0,
tenantId: User.getStoreId(),
userId: User.getStoreUserId(),
},
dataSource: [],
selectQuestionKeys: [],
expandFilter: false,
};
}
......@@ -98,6 +104,8 @@ class SelectQuestionList extends Component {
order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称
questionType: null, // 题目类型
updateDateStart: null,
updateDateEnd: null,
};
this.setState({ query: _query }, () => {
this.queryQuestionPageListWithContent();
......@@ -134,6 +142,8 @@ class SelectQuestionList extends Component {
order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称
questionType: null, // 题目类型
updateDateStart: null,
updateDateEnd: null,
};
this.setState({ query: _query }, () => {
this.queryQuestionPageListWithContent();
......@@ -215,11 +225,23 @@ class SelectQuestionList extends Component {
// 改变搜索条件
handleChangeQuery = (searchType, value) => {
const _query = this.state.query;
switch (searchType) {
case "questionName":
_query.questionName = value;
break;
case "updatedTime":
_query.updateDateStart = value && value[0]?.startOf('day').valueOf();
_query.updateDateEnd = value && value[1]?.endOf('day').valueOf();
break;
case "questionType":
_query.questionType = value;
break
}
this.setState(
{
query: {
...this.state.query,
[searchType]: value || null,
..._query,
current: 1,
},
},
......@@ -281,6 +303,7 @@ class SelectQuestionList extends Component {
total,
query,
selectQuestionKeys = [],
expandFilter,
} = this.state;
const { current, size, questionName, questionType } = query;
const rowSelection = {
......@@ -375,8 +398,24 @@ class SelectQuestionList extends Component {
&#xe61b;{" "}
</span>
</Tooltip>
<span style={{ cursor: 'pointer' }} className="fold-btn" onClick={() => {
this.setState({expandFilter:!expandFilter})
}}>{expandFilter ? <span><span>收起</span><span className="iconfont icon fold-icon" >&#xe82d; </span> </span> : <span>展开<span className="iconfont icon fold-icon" >&#xe835; </span></span>}</span>
</div>
</Row>
{expandFilter && <Row>
<div className="search-condition__item">
<span className="search-label">更新时间:</span>
<RangePicker
value={[
query.updateDateStart ? moment(Number(query.updateDateStart)) : null,
query.updateDateEnd ? moment(Number(query.updateDateEnd)) : null
]}
onChange={(value) => {
this.handleChangeQuery("updatedTime", value)
}} />
</div>
</Row>}
</div>
<div className="select-tip-box">
<div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment