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" }}
......
/* /*
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-27 16:15:13 * @Date: 2021-03-27 16:15:13
* @LastEditors: zhangleyuan * @LastEditors: yuananting
* @LastEditTime: 2021-05-10 10:16:31 * @LastEditTime: 2021-05-30 21:22:25
* @Description: 助学工具-新建/复制/编辑试卷 * @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -29,6 +29,8 @@ import PaperPreviewModal from "./modal/PreviewPaperModal"; ...@@ -29,6 +29,8 @@ import PaperPreviewModal from "./modal/PreviewPaperModal";
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 Bus from "@/core/bus"; import Bus from "@/core/bus";
import { Route, withRouter } from "react-router-dom";
import AddExam from "@/modules/teach-tool/examination-manager/AddExam";
const questionTypeEnum = { const questionTypeEnum = {
SINGLE_CHOICE: "单选题", SINGLE_CHOICE: "单选题",
...@@ -127,11 +129,10 @@ class OperatePaper extends Component { ...@@ -127,11 +129,10 @@ class OperatePaper extends Component {
const { paperName, passRate } = result; const { paperName, passRate } = result;
this.setState( this.setState(
{ {
selectQuestionList: result.questionList.sort( selectQuestionList: result.questionList,
(a, b) => b.updateTime - a.updateTime
),
formData: { formData: {
...result, ...result,
paperId: getParameterByName("paperId"),
paperName: paperName:
currentOperate === "copy" ? paperName + "(复制)" : paperName, currentOperate === "copy" ? paperName + "(复制)" : paperName,
}, },
...@@ -222,11 +223,6 @@ class OperatePaper extends Component { ...@@ -222,11 +223,6 @@ class OperatePaper extends Component {
case "descend": case "descend":
currentQuestionList = sortedTableData.reverse(); currentQuestionList = sortedTableData.reverse();
break; break;
case "default":
currentQuestionList = _selectQuestionList.sort(
(a, b) => b.updateTime - a.updateTime
);
break;
default: default:
currentQuestionList = _selectQuestionList; currentQuestionList = _selectQuestionList;
break; break;
...@@ -261,7 +257,7 @@ class OperatePaper extends Component { ...@@ -261,7 +257,7 @@ class OperatePaper extends Component {
getSelectedQuestion={this.state.selectQuestionList} getSelectedQuestion={this.state.selectQuestionList}
setSelectedQuestion={(list) => { setSelectedQuestion={(list) => {
this.setState({ selectQuestionModal: null }, () => { this.setState({ selectQuestionModal: null }, () => {
this.setFormData(list.sort((a, b) => b.updateTime - a.updateTime)); this.setFormData(list);
}); });
}} }}
close={() => { close={() => {
...@@ -332,10 +328,11 @@ class OperatePaper extends Component { ...@@ -332,10 +328,11 @@ class OperatePaper extends Component {
}; };
// 保存试卷 // 保存试卷
savePaper = async () => { savePaper = (saveType) => {
this.setState({ check: true }); this.setState({ check: true });
const { selectQuestionList, formData, currentOperate } = this.state; const { selectQuestionList, formData, currentOperate } = this.state;
const categoryId = getParameterByName("categoryId"); const categoryId = getParameterByName("categoryId");
const { match } = this.props;
let questionList = []; let questionList = [];
if ( if (
!formData.passRate || !formData.passRate ||
...@@ -370,18 +367,26 @@ class OperatePaper extends Component { ...@@ -370,18 +367,26 @@ class OperatePaper extends Component {
AidToolService.createPaper(this.state.formData) AidToolService.createPaper(this.state.formData)
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
message.success( if (saveType === "saveToAddExam") {
currentOperate === "new" ? "新建成功" : "复制成功" this.setState({formData:{ ...formData, paperId: res.result}},() => {
); window.RCHistory.push({
window.RCHistory.push({ pathname: `${match.url}/exam-operate-page`,
pathname: `/paper-manage-index?categoryId=${categoryId}`, });
}); })
Bus.trigger( } else {
"queryPaperPageList", message.success(
categoryId, currentOperate === "new" ? "新建成功" : "复制成功"
selectQuestionList.length );
); window.RCHistory.push({
Bus.trigger("queryCategoryTree", "remain"); pathname: `/paper-manage-index?categoryId=${categoryId}`,
});
Bus.trigger(
"queryPaperPageList",
categoryId,
selectQuestionList.length
);
Bus.trigger("queryCategoryTree", "remain");
}
} }
}) })
.catch((e) => { .catch((e) => {
...@@ -402,15 +407,21 @@ class OperatePaper extends Component { ...@@ -402,15 +407,21 @@ class OperatePaper extends Component {
}) })
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
message.success("编辑成功"); if (saveType === "saveToAddExam") {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${categoryId}`, pathname: `${match.url}/exam-operate-page`,
}); });
Bus.trigger( } else {
"queryPaperPageList", message.success("编辑成功");
categoryId, window.RCHistory.push({
selectQuestionList.length pathname: `/paper-manage-index?categoryId=${categoryId}`,
); });
Bus.trigger(
"queryPaperPageList",
categoryId,
selectQuestionList.length
);
}
} }
}) })
.catch((e) => { .catch((e) => {
...@@ -469,7 +480,7 @@ class OperatePaper extends Component { ...@@ -469,7 +480,7 @@ class OperatePaper extends Component {
sortByQuestionType = (pagination, filters, sorter) => { sortByQuestionType = (pagination, filters, sorter) => {
const { columnKey, order } = sorter; const { columnKey, order } = sorter;
if (columnKey === "questionType") { if (columnKey === "questionType") {
this.setFormData(this.state.selectQuestionList, order || "default"); this.setFormData(this.state.selectQuestionList, order);
} }
}; };
...@@ -680,6 +691,7 @@ class OperatePaper extends Component { ...@@ -680,6 +691,7 @@ class OperatePaper extends Component {
formData, formData,
loading, loading,
check, check,
currentOperate,
} = this.state; } = this.state;
const { const {
singleChoiceCnt, singleChoiceCnt,
...@@ -698,123 +710,152 @@ class OperatePaper extends Component { ...@@ -698,123 +710,152 @@ class OperatePaper extends Component {
questionCnt, questionCnt,
totalScore, totalScore,
} = formData; } = formData;
const { match } = this.props;
return ( return (
<div className="page operate-paper-page"> <div>
<Breadcrumbs navList={currentNav} goBack={() => this.handleGoBack()} /> <div className="page operate-paper-page">
<Spin spinning={loading}> <Breadcrumbs
<div className="box"> navList={currentNav}
<div className="show-tips"> goBack={() => this.handleGoBack()}
<ShowTips message="请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利" /> />
</div> <Spin spinning={loading}>
<Form ref={this.formRef} style={{ marginTop: 24 }}> <div className="box">
<Form.Item <div className="show-tips">
name="paperName" <ShowTips message="请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利" />
label="试卷名称:" </div>
required <Form ref={this.formRef} style={{ marginTop: 24 }}>
validateStatus={this.validatePaperName(paperName) ? "error" : ""} <Form.Item
help={this.validatePaperName(paperName)} name="paperName"
> label="试卷名称:"
<Input required
value={paperName} validateStatus={
autoComplete="off" this.validatePaperName(paperName) ? "error" : ""
maxLength={40} }
style={{ width: 300 }} help={this.validatePaperName(paperName)}
placeholder="请输入试卷名称(40字以内)" >
onChange={(e) => { <Input
this.setState({ value={paperName}
formData: { autoComplete="off"
...formData, maxLength={40}
paperName: e.target.value.trim(), style={{ width: 300 }}
}, placeholder="请输入试卷名称(40字以内)"
}); onChange={(e) => {
}} this.setState({
/>
</Form.Item>
<Form.Item
name="passRate"
label="及格线:"
required
validateStatus={check && !passRate ? "error" : ""}
help={check && !passRate && "请输入及格线"}
>
<div>
<InputNumber
min={1}
max={100}
value={passRate}
onChange={(value) => {
this.setState(
{
formData: { formData: {
...formData, ...formData,
passRate: parseInt(value) || undefined, paperName: e.target.value.trim(),
}, },
}, });
() => this.setFormData(selectQuestionList) }}
); />
}} </Form.Item>
/>{" "}
%
<span className="score-info">
总分({Number(totalScore) || 0})*及格线(
{Number(passRate) || 0}
%)=及格分数(
{Number(passScore) || 0}
</span>
</div>
</Form.Item>
<Button <Form.Item
className="choose-btn" name="passRate"
type="primary" label="及格线:"
icon={<PlusOutlined />} required
onClick={this.chooseQuestion} validateStatus={check && !passRate ? "error" : ""}
> help={check && !passRate && "请输入及格线"}
自选题目 >
</Button> <div>
{questionCnt > 0 && ( <InputNumber
<div className="paper-info-tip" style={{ margin: "0 auto 12px" }}> min={1}
总计<span>{totalScore}</span>分,共<span>{questionCnt}</span> max={100}
题。{" "} value={passRate}
{singleChoiceCnt > 0 && onChange={(value) => {
`单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`} this.setState(
{multiChoiceCnt > 0 && {
`多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`} formData: {
{judgeCnt > 0 && `判断题${judgeCnt}题,共${judgeScore}分,`} ...formData,
{gapFillingCnt > 0 && passRate: parseInt(value) || undefined,
`填空题${gapFillingCnt}题,共${gapFillingScore}分,`} },
{indefiniteChoiceCnt > 0 && },
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`} () => this.setFormData(selectQuestionList)
</div> );
)} }}
/>{" "}
%
<span className="score-info">
总分({Number(totalScore) || 0})*及格线(
{Number(passRate) || 0}
%)=及格分数(
{Number(passScore) || 0}
</span>
</div>
</Form.Item>
<ConfigProvider renderEmpty={this.customizeRenderEmpty}> <Button
<Table className="choose-btn"
className="table-style" type="primary"
scroll={{ y: 350 }} icon={<PlusOutlined />}
columns={this.parseColumns()} onClick={this.chooseQuestion}
dataSource={selectQuestionList} >
pagination={false} 自选题目
onChange={this.sortByQuestionType} </Button>
/> {questionCnt > 0 && (
</ConfigProvider> <div
</Form> className="paper-info-tip"
</div> style={{ margin: "0 auto 12px" }}
<div className="footer"> >
<Button onClick={this.handleGoBack}>取消</Button> 总计<span>{totalScore}</span>分,共
<Button onClick={this.previewPaper}>预览</Button> <span>{questionCnt}</span>
<Button type="primary" onClick={this.savePaper}> 题。{" "}
保存 {singleChoiceCnt > 0 &&
</Button> `单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`}
{multiChoiceCnt > 0 &&
`多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`}
{judgeCnt > 0 && `判断题${judgeCnt}题,共${judgeScore}分,`}
{gapFillingCnt > 0 &&
`填空题${gapFillingCnt}题,共${gapFillingScore}分,`}
{indefiniteChoiceCnt > 0 &&
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`}
</div>
)}
<ConfigProvider renderEmpty={this.customizeRenderEmpty}>
<Table
className="table-style"
scroll={{ y: 350 }}
columns={this.parseColumns()}
dataSource={selectQuestionList}
pagination={false}
onChange={this.sortByQuestionType}
/>
</ConfigProvider>
</Form>
</div>
<div className="footer">
<Button onClick={this.handleGoBack}>取消</Button>
<Button onClick={this.previewPaper}>预览</Button>
<Button onClick={() => this.savePaper("saveToAddExam")}>
保存并组织考试
</Button>
<Button type="primary" onClick={() => this.savePaper()}>
保存
</Button>
</div>
</Spin>
{selectQuestionModal}
{paperPreviewModal}
</div> </div>
</Spin> <Route
{selectQuestionModal} path={`${match.url}/exam-operate-page`}
{paperPreviewModal} render={() => {
return (
<AddExam
paperInfo={formData}
type={
currentOperate === "edit"
? "editPaperToAddExam"
: "newPaperToAddExam"
}
/>
);
}}
/>
</div> </div>
); );
} }
} }
export default OperatePaper; export default withRouter(OperatePaper);
...@@ -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