Commit 00ae188b by yuananting

feat:试卷优化

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