Commit da03cc27 by yuananting

fix:loading

parent 0c8b67b7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-22 10:59:43 * @Date: 2021-02-22 10:59:43
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-07 12:19:27 * @LastEditTime: 2021-04-10 10:59:32
* @Description: 助学工具-侧边课程分类树 * @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -131,7 +131,7 @@ class CourseCategorySiderTree extends Component { ...@@ -131,7 +131,7 @@ class CourseCategorySiderTree extends Component {
} else if (this.props.fromModule === "QUESTION_MODAL") { } else if (this.props.fromModule === "QUESTION_MODAL") {
Bus.trigger("queryQuestionModalList", selectedKeys[0]); Bus.trigger("queryQuestionModalList", selectedKeys[0]);
} else { } else {
Bus.trigger("queryPaperPageList", selectedKeys[0]); Bus.trigger("queryPaperPageList", selectedKeys[0], false);
} }
}); });
}; };
......
...@@ -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-04-08 10:03:45 * @LastEditTime: 2021-04-10 11:03:26
* @Description: 助学工具-题库-试卷列表数据 * @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -22,7 +22,7 @@ import { ...@@ -22,7 +22,7 @@ import {
} from "antd"; } from "antd";
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 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";
...@@ -48,23 +48,32 @@ class PaperList extends Component { ...@@ -48,23 +48,32 @@ class PaperList extends Component {
selectedRowKeys: [this.props.paperId], selectedRowKeys: [this.props.paperId],
dataSource: [], dataSource: [],
paperPreviewModal: null, // 试卷预览模态框 paperPreviewModal: null, // 试卷预览模态框
loading: false,
}; };
} }
componentDidMount() { componentDidMount() {
this.queryPaperPageList(); this.queryPaperPageList();
Bus.bind('queryPaperPageList', (selectedCategoryId) => { Bus.bind("queryPaperPageList", (selectedCategoryId, delay) => {
selectedCategoryId = selectedCategoryId === "null" ? null : selectedCategoryId; selectedCategoryId =
this.InitSearch(selectedCategoryId) selectedCategoryId === "null" ? null : selectedCategoryId;
}) this.setState({ loading: true });
if (delay) {
setTimeout(() => {
this.InitSearch(selectedCategoryId);
}, 5000);
} else {
this.InitSearch(selectedCategoryId);
}
});
} }
componentWillUnmount() { componentWillUnmount() {
Bus.unbind('queryPaperPageList', this.queryPaperPageList) Bus.unbind("queryPaperPageList", this.queryPaperPageList);
} }
// 初始化列表查询 // 初始化列表查询
InitSearch = (categoryId) => { InitSearch = (categoryId, delay) => {
const _query = { const _query = {
...this.state.query, ...this.state.query,
categoryId, categoryId,
...@@ -77,11 +86,10 @@ class PaperList extends Component { ...@@ -77,11 +86,10 @@ class PaperList extends Component {
}; };
// 查询试卷列表 // 查询试卷列表
queryPaperPageList = () => { queryPaperPageList = async () => {
AidToolService.queryPaperPageList(this.state.query).then((res) => { const res = await AidToolService.queryPaperPageList(this.state.query);
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total }); this.setState({ dataSource: records, total, loading: false });
});
}; };
// 预览试卷 // 预览试卷
...@@ -112,8 +120,6 @@ class PaperList extends Component { ...@@ -112,8 +120,6 @@ class PaperList extends Component {
// 编辑试卷 // 编辑试卷
editPaper = (record) => { editPaper = (record) => {
const { match } = this.props;
if (record.relatedExam === 0) { if (record.relatedExam === 0) {
const { categoryId } = this.state.query; const { categoryId } = this.state.query;
const { match } = this.props; const { match } = this.props;
...@@ -158,7 +164,7 @@ class PaperList extends Component { ...@@ -158,7 +164,7 @@ class PaperList extends Component {
}); });
} }
}); });
} };
// 删除试卷确认 // 删除试卷确认
confirmDeletePaper = (record) => { confirmDeletePaper = (record) => {
...@@ -249,45 +255,49 @@ class PaperList extends Component { ...@@ -249,45 +255,49 @@ class PaperList extends Component {
width: this.props.type !== "modal-select" ? "12%" : "20%", width: this.props.type !== "modal-select" ? "12%" : "20%",
align: "right", align: "right",
render: (val, record) => { render: (val, record) => {
return ( return this.props.type !== "modal-select" ? (
<span>{record.questionCnt}</span>
this.props.type !== "modal-select" ? ) : (
<span> <Tooltip
{record.questionCnt} overlayClassName="tool-list"
</span> : title={
<Tooltip <div>
overlayClassName="tool-list" <div className="item">
title={ 单选题:{record.singleChoiceCnt || 0}
<div>
<div className="item">单选题:{record.singleChoiceCnt || 0}</div>
<div className="item">多选题:{record.multiChoiceCnt || 0}</div>
<div className="item">判断题:{record.judgeCnt || 0}</div>
<div className="item">填空题:{record.gapFillingCnt || 0}</div>
<div className="item">不定项选择题:{record.indefiniteChoiceCnt || 0}</div>
</div> </div>
} <div className="item">
placement="top" 多选题:{record.multiChoiceCnt || 0}
overlayStyle={{ maxWidth: 700 }} </div>
> <div className="item">判断题:{record.judgeCnt || 0}</div>
<span> <div className="item">
{record.questionCnt} 填空题:{record.gapFillingCnt || 0}
</span> </div>
</Tooltip> <div className="item">
不定项选择题:{record.indefiniteChoiceCnt || 0}
</div>
</div>
}
placement="top"
overlayStyle={{ maxWidth: 700 }}
>
<span>{record.questionCnt}</span>
</Tooltip>
); );
}, },
}, },
]; ];
if (this.props.type !== "modal-select") { if (this.props.type !== "modal-select") {
const isPermiss = ["CloudManager", "StoreManager"].includes(User.getUserRole()); const isPermiss = ["CloudManager", "StoreManager"].includes(
User.getUserRole()
);
columns.push({ columns.push({
title: "关联考试数", title: "关联考试数",
key: "relatedExam", key: "relatedExam",
dataIndex: "relatedExam", dataIndex: "relatedExam",
width: this.props.type !== "modal-select" ? "16%" : "24%", width: this.props.type !== "modal-select" ? "16%" : "24%",
align: "right", align: "right",
}) });
columns.push({ columns.push({
title: "操作", title: "操作",
key: "operate", key: "operate",
...@@ -302,17 +312,25 @@ class PaperList extends Component { ...@@ -302,17 +312,25 @@ class PaperList extends Component {
> >
预览 预览
</div> </div>
{isPermiss && <span className="record-operate__item split"> | </span>} {isPermiss && (
{isPermiss && <div <span className="record-operate__item split"> | </span>
className="record-operate__item" )}
onClick={() => this.copyPaper(record)} {isPermiss && (
> <div
复制 className="record-operate__item"
</div>} onClick={() => this.copyPaper(record)}
{isPermiss && <span className="record-operate__item split"> | </span>} >
{isPermiss && <Dropdown overlay={this.initDropMenu(record)}> 复制
<div className="record-operate__item">更多</div> </div>
</Dropdown>} )}
{isPermiss && (
<span className="record-operate__item split"> | </span>
)}
{isPermiss && (
<Dropdown overlay={this.initDropMenu(record)}>
<div className="record-operate__item">更多</div>
</Dropdown>
)}
</div> </div>
); );
}, },
...@@ -359,6 +377,7 @@ class PaperList extends Component { ...@@ -359,6 +377,7 @@ class PaperList extends Component {
query, query,
paperPreviewModal, paperPreviewModal,
selectedRowKeys, selectedRowKeys,
loading,
} = this.state; } = this.state;
const { current, size, categoryId, paperName } = query; const { current, size, categoryId, paperName } = query;
const rowSelection = { const rowSelection = {
...@@ -366,7 +385,9 @@ class PaperList extends Component { ...@@ -366,7 +385,9 @@ class PaperList extends Component {
selectedRowKeys, selectedRowKeys,
onChange: this.onSelectChange, onChange: this.onSelectChange,
}; };
const isPermiss = ["CloudManager", "StoreManager"].includes(User.getUserRole()) const isPermiss = ["CloudManager", "StoreManager"].includes(
User.getUserRole()
);
const { match } = this.props; const { match } = this.props;
return ( return (
<div className={"paper-list " + this.props.type}> <div className={"paper-list " + this.props.type}>
...@@ -397,19 +418,18 @@ class PaperList extends Component { ...@@ -397,19 +418,18 @@ class PaperList extends Component {
</div> </div>
</Row> </Row>
</div> </div>
{this.props.type !== "modal-select" && isPermiss && {this.props.type !== "modal-select" && isPermiss && categoryId && (
categoryId && ( <Button
<Button type="primary"
type="primary" onClick={() => {
onClick={() => { window.RCHistory.push({
window.RCHistory.push({ pathname: `${match.url}/paper-operate-page?type=new&categoryId=${categoryId}`,
pathname: `${match.url}/paper-operate-page?type=new&categoryId=${categoryId}`, });
}); }}
}} >
> 新建试卷
新建试卷 </Button>
</Button> )}
)}
<div className="paper-list-content"> <div className="paper-list-content">
<ConfigProvider renderEmpty={this.customizeRenderEmpty}> <ConfigProvider renderEmpty={this.customizeRenderEmpty}>
...@@ -420,6 +440,7 @@ class PaperList extends Component { ...@@ -420,6 +440,7 @@ class PaperList extends Component {
columns={this.parseColumns()} columns={this.parseColumns()}
pagination={false} pagination={false}
bordered bordered
loading={loading}
onChange={this.handleChangeTable} onChange={this.handleChangeTable}
/> />
) : ( ) : (
...@@ -457,7 +478,10 @@ class PaperList extends Component { ...@@ -457,7 +478,10 @@ class PaperList extends Component {
)} )}
{paperPreviewModal} {paperPreviewModal}
</div> </div>
<Route path={`${match.url}/paper-operate-page`} component={OperatePaper} /> <Route
path={`${match.url}/paper-operate-page`}
component={OperatePaper}
/>
</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-04-09 17:21:36 * @LastEditTime: 2021-04-10 09:34:35
* @Description: 助学工具-新建试卷-选择题目列表 * @Description: 助学工具-新建试卷-选择题目列表
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -64,7 +64,7 @@ class SelectQuestionList extends Component { ...@@ -64,7 +64,7 @@ class SelectQuestionList extends Component {
query: { query: {
current: 1, current: 1,
size: 10, size: 10,
order: "ACCURACY_DESC", order: "UPDATED_DESC",
categoryId: null, // 当前题库分类Id categoryId: null, // 当前题库分类Id
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
...@@ -95,7 +95,7 @@ class SelectQuestionList extends Component { ...@@ -95,7 +95,7 @@ class SelectQuestionList extends Component {
...this.state.query, ...this.state.query,
categoryId, categoryId,
current: 1, current: 1,
order: "ACCURACY_DESC", // 排序规则 order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
}; };
...@@ -107,7 +107,7 @@ class SelectQuestionList extends Component { ...@@ -107,7 +107,7 @@ class SelectQuestionList extends Component {
// 排序 // 排序
handleChangeTable = (pagination, filters, sorter) => { handleChangeTable = (pagination, filters, sorter) => {
const { columnKey, order } = sorter; const { columnKey, order } = sorter;
let sort = null; let sort = "UPDATED_DESC";
if (order === "ascend") { if (order === "ascend") {
sort = "ACCURACY_ASC"; sort = "ACCURACY_ASC";
} }
...@@ -115,7 +115,7 @@ class SelectQuestionList extends Component { ...@@ -115,7 +115,7 @@ class SelectQuestionList extends Component {
sort = "ACCURACY_DESC"; sort = "ACCURACY_DESC";
} }
const _query = this.state.query; const _query = this.state.query;
_query.order = sort || "ACCURACY_DESC"; _query.order = sort;
_query.current = 1; _query.current = 1;
this.setState({ query: _query }, () => this.queryQuestionModalList()); this.setState({ query: _query }, () => this.queryQuestionModalList());
}; };
...@@ -132,7 +132,7 @@ class SelectQuestionList extends Component { ...@@ -132,7 +132,7 @@ class SelectQuestionList extends Component {
const _query = { const _query = {
...this.state.query, ...this.state.query,
current: 1, current: 1,
order: "ACCURACY_DESC", // 排序规则 order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
}; };
......
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