Commit cc685626 by yuananting

fix:路由调整为2级,试卷样式调整

parent e70744c5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-23 18:28:50 * @Date: 2021-02-23 18:28:50
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-01 20:10:29 * @LastEditTime: 2021-04-07 10:09:18
* @Description: 助学工具-课程分类 * @Description: 助学工具-课程分类
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -40,7 +40,7 @@ class CourseCategoryManage extends Component { ...@@ -40,7 +40,7 @@ class CourseCategoryManage extends Component {
} }
componentDidMount() { componentDidMount() {
this.queryCategoryTree("search"); this.queryCategoryTree("init");
} }
getWholeTree = () => { getWholeTree = () => {
...@@ -112,7 +112,7 @@ class CourseCategoryManage extends Component { ...@@ -112,7 +112,7 @@ class CourseCategoryManage extends Component {
Object.keys(this.state.treeMap).forEach((item) => { Object.keys(this.state.treeMap).forEach((item) => {
nodeId.push(item); nodeId.push(item);
}); });
if (operateType === "search") { if (operateType === "init") {
this.setState({ expandedKeys: nodeId }); this.setState({ expandedKeys: nodeId });
} }
} }
...@@ -127,7 +127,7 @@ class CourseCategoryManage extends Component { ...@@ -127,7 +127,7 @@ class CourseCategoryManage extends Component {
}; };
categoryList.unshift(defaultNode); categoryList.unshift(defaultNode);
this.setState({ treeData: this.renderTreeNodes(categoryList, categoryName) }); this.setState({ treeData: this.renderTreeNodes(categoryList, categoryName) });
if (operateType === "search") { if (operateType === "init") {
this.setState({ expandedKeys: [] }); this.setState({ expandedKeys: [] });
} }
} }
...@@ -304,7 +304,7 @@ class CourseCategoryManage extends Component { ...@@ -304,7 +304,7 @@ class CourseCategoryManage extends Component {
title={title} title={title}
label={label} label={label}
close={() => { close={() => {
this.queryCategoryTree("change", this.state.categoryName); this.queryCategoryTree("remain", this.state.categoryName);
this.setState({ this.setState({
operateCourseCategoryModal: null, operateCourseCategoryModal: null,
}); });
...@@ -335,7 +335,7 @@ class CourseCategoryManage extends Component { ...@@ -335,7 +335,7 @@ class CourseCategoryManage extends Component {
AidToolService.delCategory(params).then((res) => { AidToolService.delCategory(params).then((res) => {
if (res.success) { if (res.success) {
message.success("删除分类成功"); message.success("删除分类成功");
this.queryCategoryTree("change", this.state.categoryName); this.queryCategoryTree("remain", this.state.categoryName);
} }
}); });
}, },
...@@ -552,7 +552,7 @@ class CourseCategoryManage extends Component { ...@@ -552,7 +552,7 @@ class CourseCategoryManage extends Component {
userId: User.getStoreUserId(), userId: User.getStoreUserId(),
}; };
AidToolService.editCategoryTree(params).then((res) => { AidToolService.editCategoryTree(params).then((res) => {
this.queryCategoryTree("change"); this.queryCategoryTree("remain");
}); });
}; };
...@@ -606,7 +606,7 @@ class CourseCategoryManage extends Component { ...@@ -606,7 +606,7 @@ class CourseCategoryManage extends Component {
<Search <Search
placeholder="请输入名称" placeholder="请输入名称"
style={{ width: "300px" }} style={{ width: "300px" }}
onSearch={(value) => this.queryCategoryTree("search", value)} onSearch={(value) => this.queryCategoryTree("init", value)}
className="search-input" className="search-input"
enterButton={<span className="icon iconfont">&#xe832;</span>} enterButton={<span className="icon iconfont">&#xe832;</span>}
/> />
......
.course-category-manage { .course-category-manage {
position: relative; position: relative;
.search-condition { .search-condition {
width: 30%;
margin-bottom: 16px; margin-bottom: 16px;
.search-label { .search-label {
vertical-align: middle; vertical-align: middle;
......
...@@ -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-01 14:15:23 * @LastEditTime: 2021-04-07 12:19:27
* @Description: 助学工具-侧边课程分类树 * @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -11,6 +11,7 @@ import { Input, Button, Tree } from "antd"; ...@@ -11,6 +11,7 @@ import { Input, Button, Tree } from "antd";
import "./CourseCategorySiderTree.less"; import "./CourseCategorySiderTree.less";
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";
const { Search } = Input; const { Search } = Input;
const { DirectoryTree } = Tree; const { DirectoryTree } = Tree;
...@@ -28,28 +29,16 @@ class CourseCategorySiderTree extends Component { ...@@ -28,28 +29,16 @@ class CourseCategorySiderTree extends Component {
} }
componentDidMount() { componentDidMount() {
this.queryCategoryTree("change"); this.queryCategoryTree("init");
this.props.getSelectedCategoryId( Bus.bind("queryCategoryTree", this.queryCategoryTree);
["QUESTION_INDEX", "PAPER_INDEX"].includes(this.props.fromModule)
? [getParameterByName("categoryId") || "null"]
: ["null"]
);
} }
shouldComponentUpdate(nextProps, nextState) { componentWillUnmount() {
const { currentTotal, updatedCategoryId } = nextProps; Bus.unbind("queryCategoryTree", this.queryCategoryTree);
if (
["QUESTION_INDEX", "PAPER_INDEX"].includes(this.props.fromModule) &&
this.props.currentTotal !== currentTotal &&
this.props.updatedCategoryId === updatedCategoryId
) {
this.queryCategoryTree("remain");
}
return true;
} }
// 查询分类树 // 查询分类树
queryCategoryTree = (type, categoryName) => { queryCategoryTree = (type = "init", categoryName) => {
let query = { let query = {
bizType: ["QUESTION_INDEX", "QUESTION_MODAL"].includes( bizType: ["QUESTION_INDEX", "QUESTION_MODAL"].includes(
this.props.fromModule this.props.fromModule
...@@ -75,7 +64,7 @@ class CourseCategorySiderTree extends Component { ...@@ -75,7 +64,7 @@ class CourseCategorySiderTree extends Component {
Object.keys(this.state.treeMap).forEach((item) => { Object.keys(this.state.treeMap).forEach((item) => {
nodeId.push(item); nodeId.push(item);
}); });
if (type === "change") { if (type === "init") {
this.setState({ expandedKeys: nodeId }); this.setState({ expandedKeys: nodeId });
} }
} else { } else {
...@@ -94,7 +83,7 @@ class CourseCategorySiderTree extends Component { ...@@ -94,7 +83,7 @@ class CourseCategorySiderTree extends Component {
Object.keys(this.state.treeMap).forEach((item) => { Object.keys(this.state.treeMap).forEach((item) => {
nodeId.push(item); nodeId.push(item);
}); });
if (type === "change") { if (type === "init") {
this.setState({ expandedKeys: nodeId }); this.setState({ expandedKeys: nodeId });
} }
} }
...@@ -111,7 +100,7 @@ class CourseCategorySiderTree extends Component { ...@@ -111,7 +100,7 @@ class CourseCategorySiderTree extends Component {
this.setState({ this.setState({
treeData: this.renderTreeNodes(categoryList, categoryName), treeData: this.renderTreeNodes(categoryList, categoryName),
}); });
if (type === "change") { if (type === "init") {
this.setState({ expandedKeys: [] }); this.setState({ expandedKeys: [] });
} }
} }
...@@ -136,8 +125,15 @@ class CourseCategorySiderTree extends Component { ...@@ -136,8 +125,15 @@ class CourseCategorySiderTree extends Component {
// 树状选中事件 // 树状选中事件
onSelect = (selectedKeys) => { onSelect = (selectedKeys) => {
this.setState({ selectedKeys }); this.setState({ selectedKeys }, () => {
this.props.getSelectedCategoryId(selectedKeys); if (this.props.fromModule === "QUESTION_INDEX") {
Bus.trigger("queryQuestionPageList", selectedKeys[0]);
} else if (this.props.fromModule === "QUESTION_MODAL") {
Bus.trigger("queryQuestionModalList", selectedKeys[0]);
} else {
Bus.trigger("queryPaperPageList", selectedKeys[0]);
}
});
}; };
// 树节点渲染-内容处理 // 树节点渲染-内容处理
...@@ -214,12 +210,13 @@ class CourseCategorySiderTree extends Component { ...@@ -214,12 +210,13 @@ class CourseCategorySiderTree extends Component {
className="sider-search" className="sider-search"
placeholder="搜索名称分类" placeholder="搜索名称分类"
onSearch={(value) => { onSearch={(value) => {
this.queryCategoryTree("change", value); this.queryCategoryTree("init", value);
}} }}
enterButton={<span className="icon iconfont">&#xe832;</span>} enterButton={<span className="icon iconfont">&#xe832;</span>}
/> />
{["QUESTION_INDEX", "PAPER_INDEX"].includes(this.props.fromModule) && {["QUESTION_INDEX", "PAPER_INDEX"].includes(this.props.fromModule) &&
User.getUserRole() !== "CloudLecturer" && (this.props.type !== 'modal-select') && ( User.getUserRole() !== "CloudLecturer" &&
this.props.type !== "modal-select" && (
<div className="sider-btn"> <div className="sider-btn">
<Button <Button
onClick={() => { onClick={() => {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-27 16:15:13 * @Date: 2021-03-27 16:15:13
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-06 14:03:49 * @LastEditTime: 2021-04-07 12:56:49
* @Description: 助学工具-新建/复制/编辑试卷 * @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -27,6 +27,7 @@ import SelectQuestionModal from "./modal/SelectQuestionModal"; ...@@ -27,6 +27,7 @@ import SelectQuestionModal from "./modal/SelectQuestionModal";
import PaperPreviewModal from "./modal/PreviewPaperModal"; 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";
const questionTypeEnum = { const questionTypeEnum = {
SINGLE_CHOICE: "单选题", SINGLE_CHOICE: "单选题",
...@@ -294,6 +295,7 @@ class OperatePaper extends Component { ...@@ -294,6 +295,7 @@ class OperatePaper extends Component {
try { try {
await this.formRef.current.validateFields(); await this.formRef.current.validateFields();
const { selectQuestionList, formData, currentOperate } = this.state; const { selectQuestionList, formData, currentOperate } = this.state;
const categoryId = getParameterByName("categoryId");
let questionList = []; let questionList = [];
selectQuestionList.forEach((item, index) => { selectQuestionList.forEach((item, index) => {
questionList.push({ questionList.push({
...@@ -320,10 +322,10 @@ class OperatePaper extends Component { ...@@ -320,10 +322,10 @@ class OperatePaper extends Component {
currentOperate === "new" ? "新建成功" : "复制成功" currentOperate === "new" ? "新建成功" : "复制成功"
); );
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${getParameterByName( pathname: `/paper-manage-index?categoryId=${categoryId}`,
"categoryId"
)}`,
}); });
Bus.trigger("queryPaperPageList", categoryId);
Bus.trigger("queryCategoryTree", "remain");
} }
}); });
} else if (currentOperate === "edit") { } else if (currentOperate === "edit") {
...@@ -338,6 +340,7 @@ class OperatePaper extends Component { ...@@ -338,6 +340,7 @@ class OperatePaper extends Component {
"categoryId" "categoryId"
)}`, )}`,
}); });
Bus.trigger("queryPaperPageList", categoryId);
} }
}); });
} }
...@@ -446,7 +449,7 @@ class OperatePaper extends Component { ...@@ -446,7 +449,7 @@ class OperatePaper extends Component {
value: "INDEFINITE_CHOICE", value: "INDEFINITE_CHOICE",
}, },
], ],
filterMultiple: false, filterMultiple: true,
onFilter: (value, record) => record.questionType.indexOf(value) === 0, onFilter: (value, record) => record.questionType.indexOf(value) === 0,
render: (val) => questionTypeEnum[val], render: (val) => questionTypeEnum[val],
}, },
...@@ -478,7 +481,10 @@ class OperatePaper extends Component { ...@@ -478,7 +481,10 @@ class OperatePaper extends Component {
{ {
title: ( title: (
<Tooltip title="多选题和填空题的漏选/半对得分不能高于题目本身分值"> <Tooltip title="多选题和填空题的漏选/半对得分不能高于题目本身分值">
分值 分值{" "}
<span className="icon iconfont" style={{ color: "#BFBFBF" , fontSize: 14 }}>
&#xe7c4;
</span>
</Tooltip> </Tooltip>
), ),
dataIndex: "score", dataIndex: "score",
...@@ -591,10 +597,6 @@ class OperatePaper extends Component { ...@@ -591,10 +597,6 @@ class OperatePaper extends Component {
}; };
render() { render() {
const formItemLayout = {
labelCol: { span: 2 },
wrapperCol: { span: 22 },
};
const { const {
selectQuestionModal, selectQuestionModal,
paperPreviewModal, paperPreviewModal,
...@@ -628,11 +630,7 @@ class OperatePaper extends Component { ...@@ -628,11 +630,7 @@ class OperatePaper extends Component {
<div className="show-tips"> <div className="show-tips">
<ShowTips message="请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企培保有依据国家规定及平台规则进行处理的权利" /> <ShowTips message="请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企培保有依据国家规定及平台规则进行处理的权利" />
</div> </div>
<Form <Form ref={this.formRef} style={{ marginTop: 24 }}>
ref={this.formRef}
{...formItemLayout}
style={{ marginTop: 32 }}
>
<Form.Item <Form.Item
name="paperName" name="paperName"
label="试卷名称:" label="试卷名称:"
...@@ -657,6 +655,7 @@ class OperatePaper extends Component { ...@@ -657,6 +655,7 @@ class OperatePaper extends Component {
value={paperName} value={paperName}
autoComplete="off" autoComplete="off"
maxLength={40} maxLength={40}
style={{ width: 300 }}
placeholder="请输入试卷名称(40字以内)" placeholder="请输入试卷名称(40字以内)"
onChange={(e) => { onChange={(e) => {
this.setState({ this.setState({
...@@ -705,33 +704,43 @@ class OperatePaper extends Component { ...@@ -705,33 +704,43 @@ class OperatePaper extends Component {
/> />
</Form.Item>{" "} </Form.Item>{" "}
% %
<span style={{ marginLeft: 20 }}> <span className="score-info">
总分({totalScore})*及格线({passRate || 0}%)=及格分数( 总分({totalScore})*及格线({passRate || 0}%)=及格分数(
{passScore} {passScore}
</span> </span>
</div> </div>
</Form.Item> </Form.Item>
<Button icon={<PlusOutlined />} onClick={this.chooseQuestion}> <Button
className="choose-btn"
type="primary"
icon={<PlusOutlined />}
onClick={this.chooseQuestion}
>
自选题目 自选题目
</Button> </Button>
<div style={{ margin: "10px 0 20px" }}> {questionCnt > 0 && (
总计{totalScore}分,共{questionCnt}题。{" "} <div className="paper-info-tip" style={{ margin: "0 auto 12px" }}>
{singleChoiceCnt > 0 && 总计<span>{totalScore}</span>分,共<span>{questionCnt}</span>
`单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`} 题。{" "}
{multiChoiceCnt > 0 && {singleChoiceCnt > 0 &&
`多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`} `单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`}
{judgeCnt > 0 && `判断题${judgeCnt}题,共${judgeScore}分,`} {multiChoiceCnt > 0 &&
{gapFillingCnt > 0 && `多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`}
`填空题${gapFillingCnt}题,共${gapFillingScore}分,`} {judgeCnt > 0 && `判断题${judgeCnt}题,共${judgeScore}分,`}
{indefiniteChoiceCnt > 0 && {gapFillingCnt > 0 &&
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`} `填空题${gapFillingCnt}题,共${gapFillingScore}分,`}
</div> {indefiniteChoiceCnt > 0 &&
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`}
</div>
)}
<ConfigProvider renderEmpty={this.customizeRenderEmpty}> <ConfigProvider renderEmpty={this.customizeRenderEmpty}>
<Table <Table
scroll={{ y: 350 }}
columns={this.parseColumns()} columns={this.parseColumns()}
dataSource={selectQuestionList} dataSource={selectQuestionList}
bordered
pagination={false} pagination={false}
/> />
</ConfigProvider> </ConfigProvider>
......
.operate-paper-page { .operate-paper-page {
position: relative !important;
.box { .box {
margin-bottom: 66px !important; margin-bottom: 66px !important;
.ant-tabs { .ant-tabs {
color: #666666; color: #666666;
} }
.score-info {
color: #999999;
margin-left: 12px;
}
.choose-btn {
margin-top: 8px;
margin-bottom: 12px;
}
.paper-info-tip {
height: 20px;
color: #999999;
line-height: 20px;
span {
color: #FFB714;
}
}
.record-operate { .record-operate {
display: flex; display: flex;
...@@ -18,7 +33,7 @@ ...@@ -18,7 +33,7 @@
} }
} }
&__ban { &__ban {
color: gray; color: #CCCCCC;
pointer-events: none; pointer-events: none;
} }
} }
......
...@@ -2,59 +2,44 @@ ...@@ -2,59 +2,44 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-27 14:55:14 * @Date: 2021-03-27 14:55:14
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-01 14:00:47 * @LastEditTime: 2021-04-07 10:25:44
* @Description: 助学工具-试卷主页面 * @Description: 助学工具-试卷主页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import "./PaperContent.less" import "./PaperContent.less";
import CourseCategorySiderTree from "../components/CourseCategorySiderTree"; import CourseCategorySiderTree from "../components/CourseCategorySiderTree";
import PaperList from "./components/PaperList"; import PaperList from "./components/PaperList";
class PaperContent extends Component { class PaperContent extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {}; this.state = {};
} }
getCategoryIdFromSider = (selectedCategoryId) => { render() {
if (selectedCategoryId && selectedCategoryId.length > 0) { return (
this.setState({ selectedCategoryId: selectedCategoryId[0] }); <div className="paper-content-page">
} <div
}; style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }}
>
updatedSiderTreeFromList = (currentTotal, updatedCategoryId) => { <div className="sider">
this.setState({ currentTotal, updatedCategoryId }); <CourseCategorySiderTree
}; type={this.props.type}
fromModule="PAPER_INDEX"
render() { />
return ( </div>
<div className='paper-content-page'> </div>
<div <div className="content">
style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }} <PaperList
> type={this.props.type}
<div className="sider"> paperId={this.props.paperId}
<CourseCategorySiderTree onSelect={this.props.onSelect}
type={this.props.type} />
fromModule="PAPER_INDEX" </div>
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)} </div>
currentTotal={this.state.currentTotal} );
updatedCategoryId={this.state.updatedCategoryId} }
/>
</div>
</div>
<div className="content">
<PaperList
paperId={this.props.paperId}
onSelect={this.props.onSelect}
type={this.props.type}
updatedSiderTree={this.updatedSiderTreeFromList.bind(this)}
selectedCategoryId={this.state.selectedCategoryId}
/>
</div>
</div>
);
}
} }
export default PaperContent; export default PaperContent;
...@@ -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-06 14:36:06 * @LastEditTime: 2021-04-07 15:30:00
* @Description: 助学工具-题库-试卷列表数据 * @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -26,6 +26,9 @@ import User from "@/common/js/user"; ...@@ -26,6 +26,9 @@ 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 PaperPreviewModal from "../modal/PreviewPaperModal"; import PaperPreviewModal from "../modal/PreviewPaperModal";
import { Route, withRouter } from 'react-router-dom';
import OperatePaper from "../OperatePaper";
import Bus from "@/core/bus";
const { Search } = Input; const { Search } = Input;
...@@ -48,27 +51,36 @@ class PaperList extends Component { ...@@ -48,27 +51,36 @@ class PaperList extends Component {
}; };
} }
shouldComponentUpdate(nextProps, nextState) { componentDidMount() {
let { selectedCategoryId } = nextProps; this.queryPaperPageList();
const _query = this.state.query; Bus.bind('queryPaperPageList', (selectedCategoryId) => {
if (this.props.selectedCategoryId !== selectedCategoryId) { selectedCategoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
_query.categoryId = this.InitSearch(selectedCategoryId)
selectedCategoryId === "null" ? null : selectedCategoryId; })
_query.paperName = null; }
_query.current = 1;
this.setState({ query: _query }, () => this.queryPaperPageList()); componentWillUnmount() {
} Bus.unbind('queryPaperPageList', this.queryPaperPageList)
return true;
} }
// 初始化列表查询
InitSearch = (categoryId) => {
const _query = {
...this.state.query,
categoryId,
current: 1,
paperName: null, // 试卷名称
};
this.setState({ query: _query }, () => {
this.queryPaperPageList();
});
};
// 查询试卷列表 // 查询试卷列表
queryPaperPageList = () => { queryPaperPageList = () => {
const _query = this.state.query; AidToolService.queryPaperPageList(this.state.query).then((res) => {
AidToolService.queryPaperPageList(_query).then((res) => {
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total }, () => this.setState({ dataSource: records, total });
this.props.updatedSiderTree(total, this.props.selectedCategoryId)
);
}); });
}; };
...@@ -92,8 +104,9 @@ class PaperList extends Component { ...@@ -92,8 +104,9 @@ class PaperList extends Component {
// 复制试卷 // 复制试卷
copyPaper = (record) => { copyPaper = (record) => {
const { categoryId } = this.state.query; const { categoryId } = this.state.query;
const { match } = this.props;
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-operate-page?type=copy&paperId=${record.paperId}&categoryId=${categoryId}`, pathname: `${match.url}/paper-operate-page?type=copy&paperId=${record.paperId}&categoryId=${categoryId}`,
}); });
}; };
...@@ -101,8 +114,9 @@ class PaperList extends Component { ...@@ -101,8 +114,9 @@ class PaperList extends Component {
editPaper = (record) => { editPaper = (record) => {
if (record.relatedExam === 0) { if (record.relatedExam === 0) {
const { categoryId } = this.state.query; const { categoryId } = this.state.query;
const { match } = this.props;
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-operate-page/operate?type=edit&paperId=${record.paperId}&categoryId=${categoryId}`, pathname: `${match.url}/paper-operate-page/operate?type=edit&paperId=${record.paperId}&categoryId=${categoryId}`,
}); });
} else { } else {
return Modal.info({ return Modal.info({
...@@ -137,7 +151,10 @@ class PaperList extends Component { ...@@ -137,7 +151,10 @@ class PaperList extends Component {
_query.current = 1; _query.current = 1;
} }
} }
this.setState({ query: _query }, () => this.queryPaperPageList()); this.setState({ query: _query }, () => {
this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
});
} }
}); });
} else { } else {
...@@ -172,9 +189,9 @@ class PaperList extends Component { ...@@ -172,9 +189,9 @@ class PaperList extends Component {
title: "试卷", title: "试卷",
key: "paperName", key: "paperName",
dataIndex: "paperName", dataIndex: "paperName",
// ellipsis: { ellipsis: {
// showTitle: false, showTitle: false,
// }, },
render: (val, record) => { render: (val, record) => {
var handleVal = val; var handleVal = val;
handleVal = handleVal.replace(/<(?!img|input).*?>/g, ""); handleVal = handleVal.replace(/<(?!img|input).*?>/g, "");
...@@ -198,7 +215,7 @@ class PaperList extends Component { ...@@ -198,7 +215,7 @@ class PaperList extends Component {
title: "及格分/总分", title: "及格分/总分",
key: "score", key: "score",
dataIndex: "score", dataIndex: "score",
width: this.props.type !== "modal-select" ? "16%" : "24%",
render: (val, record) => { render: (val, record) => {
return ( return (
<span> <span>
...@@ -211,11 +228,15 @@ class PaperList extends Component { ...@@ -211,11 +228,15 @@ class PaperList extends Component {
title: "题目数量", title: "题目数量",
key: "questionCnt", key: "questionCnt",
dataIndex: "questionCnt", dataIndex: "questionCnt",
width: this.props.type !== "modal-select" ? "12%" : "20%",
align: "right",
}, },
{ {
title: "关联考试数", title: "关联考试数",
key: "relatedExam", key: "relatedExam",
dataIndex: "relatedExam", dataIndex: "relatedExam",
width: this.props.type !== "modal-select" ? "16%" : "24%",
align: "right",
}, },
]; ];
...@@ -300,7 +321,7 @@ class PaperList extends Component { ...@@ -300,7 +321,7 @@ class PaperList extends Component {
onChange: this.onSelectChange, onChange: this.onSelectChange,
}; };
const isPermiss = ["CloudManager", "StoreManager"].includes(User.getUserRole()) const isPermiss = ["CloudManager", "StoreManager"].includes(User.getUserRole())
const { match } = this.props;
return ( return (
<div className={"paper-list " + this.props.type}> <div className={"paper-list " + this.props.type}>
<div className="paper-list-filter"> <div className="paper-list-filter">
...@@ -311,7 +332,7 @@ class PaperList extends Component { ...@@ -311,7 +332,7 @@ class PaperList extends Component {
<Search <Search
placeholder="搜索试卷名称" placeholder="搜索试卷名称"
value={paperName} value={paperName}
style={{ width: 200 }} style={{ width: 177 }}
onChange={(e) => { onChange={(e) => {
this.setState({ this.setState({
query: { query: {
...@@ -336,7 +357,7 @@ class PaperList extends Component { ...@@ -336,7 +357,7 @@ class PaperList extends Component {
type="primary" type="primary"
onClick={() => { onClick={() => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-operate-page?type=new&categoryId=${categoryId}`, pathname: `${match.url}/paper-operate-page?type=new&categoryId=${categoryId}`,
}); });
}} }}
> >
...@@ -390,9 +411,10 @@ class PaperList extends Component { ...@@ -390,9 +411,10 @@ class PaperList extends Component {
)} )}
{paperPreviewModal} {paperPreviewModal}
</div> </div>
<Route path={`${match.url}/paper-operate-page`} component={OperatePaper} />
</div> </div>
); );
} }
} }
export default PaperList; export default withRouter(PaperList);
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
flex-wrap: wrap; flex-wrap: wrap;
&__item { &__item {
width: 30%;
margin-right: 3%;
margin-bottom: 16px; margin-bottom: 16px;
.search-label { .search-label {
vertical-align: middle; vertical-align: middle;
......
...@@ -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-03-30 18:36:32 * @LastEditTime: 2021-04-07 15:17:55
* @Description: 助学工具-新建试卷-选择题目列表 * @Description: 助学工具-新建试卷-选择题目列表
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -22,6 +22,7 @@ import "./SelectQuestionList.less"; ...@@ -22,6 +22,7 @@ import "./SelectQuestionList.less";
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 _ from "underscore"; import _ from "underscore";
import Bus from "@/core/bus";
const { Search } = Input; const { Search } = Input;
...@@ -76,25 +77,35 @@ class SelectQuestionList extends Component { ...@@ -76,25 +77,35 @@ class SelectQuestionList extends Component {
}; };
} }
componentDidMount() {} componentDidMount() {
this.queryQuestionModalList()
Bus.bind('queryQuestionModalList', (selectedCategoryId) => {
selectedCategoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
this.InitSearch(selectedCategoryId)
})
}
shouldComponentUpdate(nextProps, nextState) { componentWillUnmount() {
let { selectedCategoryId } = nextProps; Bus.unbind('queryQuestionModalList', this.queryQuestionModalList)
const _query = this.state.query;
if (this.props.selectedCategoryId !== selectedCategoryId) {
_query.categoryId =
selectedCategoryId === "null" ? null : selectedCategoryId;
_query.questionName = null;
_query.questionType = null;
_query.current = 1;
this.setState({ query: _query }, () => this.queryQuestionPageList());
}
return true;
} }
queryQuestionPageList = () => { // 初始化列表查询
const _query = this.state.query; InitSearch = (categoryId) => {
AidToolService.queryQuestionPageList(_query).then((res) => { const _query = {
...this.state.query,
categoryId,
current: 1,
order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称
questionType: null, // 题目类型
};
this.setState({ query: _query }, () => {
this.queryQuestionModalList();
});
};
queryQuestionModalList = () => {
AidToolService.queryQuestionPageList(this.state.query).then((res) => {
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total }); this.setState({ dataSource: records, total });
}); });
...@@ -110,7 +121,7 @@ class SelectQuestionList extends Component { ...@@ -110,7 +121,7 @@ class SelectQuestionList extends Component {
questionType: null, // 题目类型 questionType: null, // 题目类型
}; };
this.setState({ query: _query }, () => { this.setState({ query: _query }, () => {
this.queryQuestionPageList(); this.queryQuestionModalList();
}); });
}; };
...@@ -184,7 +195,7 @@ class SelectQuestionList extends Component { ...@@ -184,7 +195,7 @@ class SelectQuestionList extends Component {
} }
let _query = this.state.query; let _query = this.state.query;
_query.size = size; _query.size = size;
this.setState({ query: _query }, () => this.queryQuestionPageList()); this.setState({ query: _query }, () => this.queryQuestionModalList());
}; };
// 改变搜索条件 // 改变搜索条件
...@@ -199,7 +210,7 @@ class SelectQuestionList extends Component { ...@@ -199,7 +210,7 @@ class SelectQuestionList extends Component {
}, },
() => { () => {
if (searchType === "questionName") return; if (searchType === "questionName") return;
this.queryQuestionPageList(); this.queryQuestionModalList();
} }
); );
}; };
...@@ -297,12 +308,12 @@ class SelectQuestionList extends Component { ...@@ -297,12 +308,12 @@ class SelectQuestionList extends Component {
<Search <Search
placeholder="搜索题目名称" placeholder="搜索题目名称"
value={questionName} value={questionName}
style={{ width: "calc(100% - 84px)" }} style={{ width: 178 }}
onChange={(e) => { onChange={(e) => {
this.handleChangeQuery("questionName", e.target.value); this.handleChangeQuery("questionName", e.target.value);
}} }}
onSearch={() => { onSearch={() => {
this.queryQuestionPageList(); this.queryQuestionModalList();
}} }}
enterButton={<span className="icon iconfont">&#xe832;</span>} enterButton={<span className="icon iconfont">&#xe832;</span>}
/> />
...@@ -313,7 +324,7 @@ class SelectQuestionList extends Component { ...@@ -313,7 +324,7 @@ class SelectQuestionList extends Component {
<Select <Select
placeholder="请选择题目类型" placeholder="请选择题目类型"
value={questionType} value={questionType}
style={{ width: "calc(100% - 70px)" }} style={{ width: 178 }}
showSearch showSearch
allowClear allowClear
enterButton={<span className="icon iconfont">&#xe832;</span>} enterButton={<span className="icon iconfont">&#xe832;</span>}
...@@ -355,14 +366,14 @@ class SelectQuestionList extends Component { ...@@ -355,14 +366,14 @@ class SelectQuestionList extends Component {
<div className="select-tip-box"> <div className="select-tip-box">
<div> <div>
<span className="icon iconfont tip-icon">&#xe61d;</span> <span className="icon iconfont tip-icon">&#xe61d;</span>
<span>已选{selectQuestionKeys.length}</span> <span style={{marginRight: 8}}>已选<span style={{color: "#FFB714"}}>{selectQuestionKeys.length}</span></span>
{selectQuestionKeys.length > 0 && ( {selectQuestionKeys.length > 0 && (
<span> <span>(
{singleCount > 0 && `单选题${singleCount}题`} {singleCount > 0 && `单选题${singleCount}题`}
{multiCount > 0 && `、多选题${multiCount}题`} {multiCount > 0 && `、多选题${multiCount}题`}
{judgeCount > 0 && `、判断题${judgeCount}题`} {judgeCount > 0 && `、判断题${judgeCount}题`}
{gapCount > 0 && `、填空题${gapCount}题`} {gapCount > 0 && `、填空题${gapCount}题`}
{indefiniteCount > 0 && `、不定项选择题${indefiniteCount}题`} {indefiniteCount > 0 && `、不定项选择题${indefiniteCount}题`})
</span> </span>
)} )}
</div> </div>
...@@ -389,7 +400,7 @@ class SelectQuestionList extends Component { ...@@ -389,7 +400,7 @@ class SelectQuestionList extends Component {
toPage={(page) => { toPage={(page) => {
const _query = { ...query, current: page + 1 }; const _query = { ...query, current: page + 1 };
this.setState({ query: _query }, () => this.setState({ query: _query }, () =>
this.queryQuestionPageList() this.queryQuestionModalList()
); );
}} }}
showSizeChanger={true} showSizeChanger={true}
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
flex-wrap: wrap; flex-wrap: wrap;
&__item { &__item {
width: 30%;
margin-right: 3%; margin-right: 3%;
margin-bottom: 16px; margin-bottom: 16px;
.search-label { .search-label {
...@@ -71,7 +70,6 @@ ...@@ -71,7 +70,6 @@
background: #fff4dd; background: #fff4dd;
border-radius: 4px; border-radius: 4px;
padding: 6px 16px; padding: 6px 16px;
margin-right: 8px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.tip-icon { .tip-icon {
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-27 11:15:03 * @Date: 2021-03-27 11:15:03
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-02 15:07:17 * @LastEditTime: 2021-04-07 15:09:31
* @Description: 助学工具-试卷-预览试卷 * @Description: 助学工具-试卷-预览试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import { Modal } from "antd"; import { Modal, ConfigProvider, Empty } from "antd";
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 "./PreviewPaperModal.less"; import "./PreviewPaperModal.less";
...@@ -56,7 +56,7 @@ class PreviewPaperModal extends Component { ...@@ -56,7 +56,7 @@ class PreviewPaperModal extends Component {
}); });
}; };
// 查看图片或视频 // 查看图片
handleScanFile = (scanFileType, scanFileAddress) => { handleScanFile = (scanFileType, scanFileAddress) => {
this.setState({ this.setState({
showScanFile: true, showScanFile: true,
...@@ -83,13 +83,14 @@ class PreviewPaperModal extends Component { ...@@ -83,13 +83,14 @@ class PreviewPaperModal extends Component {
disabled disabled
correctAnswerList="" correctAnswerList=""
id=${window.random_string(16)} id=${window.random_string(16)}
value="填空" value=" "
/>` />`
); );
content = content.replace(/value="填空"/g, "value=' '");
} }
let textDom = ( let textDom = (
<span <div
key={0} key={0}
className="input-box" className="input-box"
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
...@@ -99,12 +100,15 @@ class PreviewPaperModal extends Component { ...@@ -99,12 +100,15 @@ class PreviewPaperModal extends Component {
); );
return ( return (
<div className="stem-line__item"> <div className="stem-line-item">
<div className="text"> <div className="text">
<span>{questionIndex + 1}.</span> <div className="question-tip">
<span>{questionTypeList[questionType]}</span> <span className="question-sort">{questionIndex + 1}</span>
<span className="question-type-score">
({questionTypeList[questionType]} | {score}分)
</span>
</div>
{textDom} {textDom}
<span>{score}分)</span>
</div> </div>
{this.renderMediaContent(mediaContent)} {this.renderMediaContent(mediaContent)}
</div> </div>
...@@ -133,9 +137,9 @@ class PreviewPaperModal extends Component { ...@@ -133,9 +137,9 @@ class PreviewPaperModal extends Component {
/> />
); );
return ( return (
<div className="option-line__item"> <div className="option-line-item">
<div className="text"> <div className="text">
{NUM_TO_WORD_MAP[optionSort]}. {textDom} {NUM_TO_WORD_MAP[optionSort]}: {textDom}
</div> </div>
{mediaContent.length > 0 && this.renderMediaContent(mediaContent)} {mediaContent.length > 0 && this.renderMediaContent(mediaContent)}
</div> </div>
...@@ -147,29 +151,44 @@ class PreviewPaperModal extends Component { ...@@ -147,29 +151,44 @@ class PreviewPaperModal extends Component {
if (questionType === "GAP_FILLING") { if (questionType === "GAP_FILLING") {
{ {
return ( return (
<div className="answer-line__item"> <div className="answer-line-item">
<span>正确答案</span> <div style={{ marginBottom: 8 }}>正确答案: </div>
{_.map(gapFillingAnswerList, (gapItem, gapIndex) => { {_.map(gapFillingAnswerList, (gapItem, gapIndex) => {
const { correctAnswerList } = gapItem; const { correctAnswerList } = gapItem;
return ( return (
<div className="gap-list"> <div className="gap-list">
<span>【填空{gapIndex + 1}</span> <span>[填空{gapIndex + 1}] </span>
{_.map(correctAnswerList, (answerItem) => { {_.map(correctAnswerList, (answerItem, answerIndex) => {
return <span>{answerItem}</span>; return (
<span>
{answerItem}
{answerIndex < correctAnswerList.length - 1 && (
<span></span>
)}
</span>
);
})} })}
<span>; </span>
</div> </div>
); );
})} })}
</div> </div>
) );
} }
} else { } else {
const correctAnswerOption = _.filter(optionList, (item) => item.isCorrectAnswer === 1); const correctAnswerOption = _.filter(
const correctOptionSort = correctAnswerOption.map((item) => { return NUM_TO_WORD_MAP[item.optionSort] }); optionList,
(item) => item.isCorrectAnswer === 1
);
const correctOptionSort = correctAnswerOption.map((item) => {
return NUM_TO_WORD_MAP[item.optionSort];
});
return ( return (
<div className="answer-line__item"> <div className="answer-line-item">
<span>正确答案</span> <div style={{ marginBottom: 8 }}>正确答案: </div>
<span>{correctOptionSort.length > 0 && correctOptionSort.join("、")}</span> <span style={{ lineHeight: "20px", color: "#666666" }}>
{correctOptionSort.length > 0 && correctOptionSort.join("、")}
</span>
</div> </div>
); );
} }
...@@ -231,8 +250,21 @@ class PreviewPaperModal extends Component { ...@@ -231,8 +250,21 @@ class PreviewPaperModal extends Component {
); );
}; };
// 自定义空状态
customizeRenderEmpty = () => {
return (
<Empty
image="https://image.xiaomaiketang.com/xm/emptyTable.png"
imageStyle={{
height: 100,
}}
description={"暂无内容"}
></Empty>
);
};
render() { render() {
const { paperInfo } = this.state; const { paperInfo, showScanFile, scanFileType, scanFileAddress } = this.state;
const { paperName, questionList } = paperInfo; const { paperName, questionList } = paperInfo;
return ( return (
<div> <div>
...@@ -245,37 +277,52 @@ class PreviewPaperModal extends Component { ...@@ -245,37 +277,52 @@ class PreviewPaperModal extends Component {
footer={null} footer={null}
onCancel={this.props.close} onCancel={this.props.close}
> >
<h2 style={{ textAlign: "center" }}>{paperName}</h2> <div className="paper-title">{paperName}</div>
<div className="question-list-box"> {questionList && questionList.length > 0 ? (
{_.map(questionList, (questionItem, questionIndex) => { <div className="question-list-box">
const { {_.map(questionList, (questionItem, questionIndex) => {
questionStemList, const {
optionList, questionStemList,
gapFillingAnswerList, optionList,
questionType, gapFillingAnswerList,
score, questionType,
} = questionItem; score,
return ( } = questionItem;
<div className="question-info-item"> return (
{this.renderStem( <div className="question-info-item">
questionStemList, {this.renderStem(
questionType, questionStemList,
score, questionType,
questionIndex score,
)} questionIndex
{_.map(optionList, (optionItem, optionIndex) => { )}
return this.renderOption(optionItem, questionType); {_.map(optionList, (optionItem, optionIndex) => {
})} return this.renderOption(optionItem, questionType);
{this.renderAnswer( })}
optionList, {this.renderAnswer(
gapFillingAnswerList, optionList,
questionType gapFillingAnswerList,
)} questionType
</div> )}
); </div>
})} );
</div> })}
</div>
) : (
this.customizeRenderEmpty()
)}
</Modal> </Modal>
{showScanFile && (
<ScanFileModal
fileType={scanFileType}
item={{
ossAddress: scanFileAddress,
}}
close={() => {
this.setState({ showScanFile: false });
}}
/>
)}
</div> </div>
); );
} }
......
.paper-preview-modal { .paper-preview-modal {
.paper-title {
width: 400px;
font-size: 19px;
font-weight: 500;
color: #333333;
line-height: 26px;
margin: 0 auto 24px;
text-align: center;
}
.question-list-box { .question-list-box {
.question-info-item { .question-info-item {
margin-bottom: 16px; margin-bottom: 24px;
.stem-line { padding-bottom: 24px;
margin-bottom: 16px; border-bottom: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8; .stem-line-item {
padding-bottom: 16px; color: #666666;
&__item { margin-bottom: 20px;
font-size: 14px; .question-sort {
font-weight: 400; font-size: 16px;
font-weight: 500;
color: #333333;
margin-right: 4px;
}
.question-type-score {
color: #999999;
}
}
.option-line-item {
color: #666666;
margin-top: 12px;
line-height: 20px;
}
.answer-line-item {
color: #333333;
line-height: 20px;
margin-top: 20px;
.gap-list {
display: inline;
color: #666666; color: #666666;
margin-bottom: 16px; line-height: 20px;
} }
} }
} }
.text { .text {
margin-bottom: 8px; margin-bottom: 8px;
.input-box { .question-tip {
margin-bottom: 8px; margin-bottom: 8px;
}
.input-box {
color: #333333;
line-height: 20px;
* { * {
display: inline; display: inline;
} }
...@@ -40,6 +72,7 @@ ...@@ -40,6 +72,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-right: 12px; margin-right: 12px;
margin-top: 8px;
position: relative; position: relative;
display: inline-flex; display: inline-flex;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
...@@ -65,3 +98,9 @@ ...@@ -65,3 +98,9 @@
} }
} }
} }
.paper-preview-modal.ant-modal {
max-height: 60% !important;
}
.paper-preview-modal.ant-modal .ant-modal-content .ant-modal-body {
min-height: 145px !important;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-29 10:52:26 * @Date: 2021-03-29 10:52:26
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-02 19:41:26 * @LastEditTime: 2021-04-07 15:23:06
* @Description: 助学工具-试卷-新建选择题目弹窗 * @Description: 助学工具-试卷-新建选择题目弹窗
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -31,19 +31,14 @@ class SelectQuestionModal extends Component { ...@@ -31,19 +31,14 @@ class SelectQuestionModal extends Component {
); );
} }
getCategoryIdFromSider = (selectedCategoryId) => {
if (selectedCategoryId && selectedCategoryId.length > 0) {
this.setState({ selectedCategoryId: selectedCategoryId[0] });
}
};
render() { render() {
return ( return (
<Modal <Modal
className="select-question-modal"
destroyOnClose={true} destroyOnClose={true}
title="选择题目" title="选择题目"
visible={true} visible={true}
width={1200} width={1080}
onOk={() => { onOk={() => {
this.props.setSelectedQuestion( this.props.setSelectedQuestion(
this.listRef.current.state.selectQuestionKeys.map((item) => { this.listRef.current.state.selectQuestionKeys.map((item) => {
...@@ -62,24 +57,17 @@ class SelectQuestionModal extends Component { ...@@ -62,24 +57,17 @@ class SelectQuestionModal extends Component {
); );
}} }}
onCancel={this.props.close} onCancel={this.props.close}
className="select-question-modal"
> >
<div className="box content-body"> <div className="box content-body">
<div <div
style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }} style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }}
> >
<div className="sider"> <div className="sider">
<CourseCategorySiderTree <CourseCategorySiderTree fromModule="QUESTION_MODAL" />
fromModule="QUESTION_MODAL"
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
/>
</div> </div>
</div> </div>
<div className="content"> <div className="content">
<SelectQuestionList <SelectQuestionList ref={this.listRef} />
ref={this.listRef}
selectedCategoryId={this.state.selectedCategoryId}
/>
</div> </div>
</div> </div>
</Modal> </Modal>
......
.select-question-modal { .select-question-modal {
.content-body { .content-body {
display: flex; display: flex;
.site-layout-background {
background: #fff;
}
.sider { .sider {
min-width: 244px; min-width: 244px;
} }
...@@ -13,4 +10,10 @@ ...@@ -13,4 +10,10 @@
height: calc(100vh - 160px); height: calc(100vh - 160px);
} }
} }
.ant-table-column-sorters {
padding: 0;
}
}
.select-question-modal.ant-modal {
max-height: 70% !important;
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-21 17:51:01 * @Date: 2021-02-21 17:51:01
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-01 14:10:41 * @LastEditTime: 2021-04-07 10:45:07
* @Description: 助学工具-题库 * @Description: 助学工具-题库
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -17,16 +17,6 @@ class QuestionIndex extends Component { ...@@ -17,16 +17,6 @@ class QuestionIndex extends Component {
this.state = {}; this.state = {};
} }
getCategoryIdFromSider = (selectedCategoryId) => {
if (selectedCategoryId && selectedCategoryId.length > 0) {
this.setState({ selectedCategoryId: selectedCategoryId[0] });
}
};
updatedSiderTreeFromList = (currentTotal, updatedCategoryId) => {
this.setState({ currentTotal, updatedCategoryId });
};
render() { render() {
return ( return (
<div className="question-manage-index page"> <div className="question-manage-index page">
...@@ -36,19 +26,11 @@ class QuestionIndex extends Component { ...@@ -36,19 +26,11 @@ class QuestionIndex extends Component {
style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }} style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }}
> >
<div className="sider"> <div className="sider">
<CourseCategorySiderTree <CourseCategorySiderTree fromModule="QUESTION_INDEX" />
fromModule="QUESTION_INDEX"
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
currentTotal={this.state.currentTotal}
updatedCategoryId={this.state.updatedCategoryId}
/>
</div> </div>
</div> </div>
<div className="content"> <div className="content">
<QuestionList <QuestionList />
updatedSiderTree={this.updatedSiderTreeFromList.bind(this)}
selectedCategoryId={this.state.selectedCategoryId}
/>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 13:46:35 * @Date: 2021-02-25 13:46:35
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-29 20:24:01 * @LastEditTime: 2021-04-07 09:48:34
* @Description: 助学工具-题库-新建/编辑题目 * @Description: 助学工具-题库-新建/编辑题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -19,6 +19,7 @@ import { ...@@ -19,6 +19,7 @@ import {
} from "../components/model"; } from "../components/model";
import AidToolService from "@/domains/aid-tool-domain/AidToolService"; import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import User from "@/common/js/user"; import User from "@/common/js/user";
import Bus from '@/core/bus';
const { TabPane } = Tabs; const { TabPane } = Tabs;
class OperateQuestion extends Component { class OperateQuestion extends Component {
...@@ -248,6 +249,8 @@ class OperateQuestion extends Component { ...@@ -248,6 +249,8 @@ class OperateQuestion extends Component {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/question-manage-index?categoryId=${categoryId}`, pathname: `/question-manage-index?categoryId=${categoryId}`,
}); });
Bus.trigger("queryCategoryTree", "remain")
Bus.trigger("queryQuestionPageList", categoryId)
} }
} }
}); });
...@@ -269,6 +272,8 @@ class OperateQuestion extends Component { ...@@ -269,6 +272,8 @@ class OperateQuestion extends Component {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/question-manage-index?categoryId=${categoryId}`, pathname: `/question-manage-index?categoryId=${categoryId}`,
}); });
Bus.trigger("queryCategoryTree", "remain")
Bus.trigger("queryQuestionPageList", categoryId)
} }
} }
}); });
......
.operate-question-page { .operate-question-page {
position: relative !important;
.box { .box {
margin-bottom: 66px !important; margin-bottom: 66px !important;
.ant-tabs { .ant-tabs {
......
...@@ -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-06 13:43:08 * @LastEditTime: 2021-04-07 12:07:44
* @Description: 助学工具-题库-题目列表数据 * @Description: 助学工具-题库-题目列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -27,6 +27,9 @@ import AidToolService from "@/domains/aid-tool-domain/AidToolService"; ...@@ -27,6 +27,9 @@ import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import _ from "underscore"; import _ from "underscore";
import PreviewQuestionModal from "../modal/PreviewQuestionModal"; import PreviewQuestionModal from "../modal/PreviewQuestionModal";
import BatchImportQuestionModal from "../modal/BatchImportQuestionModal"; import BatchImportQuestionModal from "../modal/BatchImportQuestionModal";
import { Route, withRouter } from 'react-router-dom';
import OperateQuestion from "../OperateQuestion";
import Bus from "@/core/bus";
const { Search } = Input; const { Search } = Input;
...@@ -81,20 +84,33 @@ class QuestionList extends Component { ...@@ -81,20 +84,33 @@ class QuestionList extends Component {
batchImportQuestionModal: null, // 批量导入模态框 batchImportQuestionModal: null, // 批量导入模态框
}; };
} }
componentDidMount() {
this.queryQuestionPageList()
Bus.bind('queryQuestionPageList', (selectedCategoryId) => {
selectedCategoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
this.InitSearch(selectedCategoryId)
})
}
shouldComponentUpdate(nextProps, nextState) { componentWillUnmount() {
let { selectedCategoryId } = nextProps; Bus.unbind('queryQuestionPageList', this.queryQuestionPageList)
const _query = this.state.query;
if (this.props.selectedCategoryId !== selectedCategoryId) {
_query.categoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
_query.questionName = null;
_query.questionType = null;
_query.current = 1;
this.setState({ query: _query }, () => this.queryQuestionPageList());
}
return true;
} }
// 初始化列表查询
InitSearch = (categoryId) => {
const _query = {
...this.state.query,
categoryId,
current: 1,
order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称
questionType: null, // 题目类型
};
this.setState({ query: _query }, () => {
this.queryQuestionPageList();
});
};
// 改变搜索条件 // 改变搜索条件
handleChangeQuery = (searchType, value) => { handleChangeQuery = (searchType, value) => {
this.setState( this.setState(
...@@ -112,7 +128,7 @@ class QuestionList extends Component { ...@@ -112,7 +128,7 @@ class QuestionList extends Component {
); );
}; };
// 清空搜索条件 // 重置搜索条件
handleReset = () => { handleReset = () => {
const _query = { const _query = {
...this.state.query, ...this.state.query,
...@@ -128,12 +144,9 @@ class QuestionList extends Component { ...@@ -128,12 +144,9 @@ class QuestionList extends Component {
// 题库列表查询 // 题库列表查询
queryQuestionPageList = () => { queryQuestionPageList = () => {
const _query = this.state.query; AidToolService.queryQuestionPageList(this.state.query).then((res) => {
AidToolService.queryQuestionPageList(_query).then((res) => {
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total }, () => this.setState({ dataSource: records, total })
this.props.updatedSiderTree(total, this.props.selectedCategoryId)
);
}); });
}; };
...@@ -330,8 +343,9 @@ class QuestionList extends Component { ...@@ -330,8 +343,9 @@ class QuestionList extends Component {
// 编辑题目 // 编辑题目
editQuestion = (id, type) => { editQuestion = (id, type) => {
const { categoryId } = this.state.query; const { categoryId } = this.state.query;
const { match } = this.props;
window.RCHistory.push({ window.RCHistory.push({
pathname: `question-operate-page?id=${id}&type=${type}&categoryId=${categoryId}`, pathname: `${match.url}/question-operate-page?id=${id}&type=${type}&categoryId=${categoryId}`,
}); });
}; };
...@@ -370,15 +384,19 @@ class QuestionList extends Component { ...@@ -370,15 +384,19 @@ class QuestionList extends Component {
_query.current = 1; _query.current = 1;
} }
} }
this.setState({ query: _query }, () => this.queryQuestionPageList()); this.setState({ query: _query }, () => {
this.queryQuestionPageList();
Bus.trigger("queryCategoryTree", "remain");
});
} }
}); });
}; };
// 创建题目-跳转新建页 // 创建题目-跳转新建页
handleCreateQuestion = () => { handleCreateQuestion = () => {
const { match } = this.props;
window.RCHistory.push({ window.RCHistory.push({
pathname: `question-operate-page?categoryId=${this.state.query.categoryId}`, pathname: `${match.url}/question-operate-page?categoryId=${this.state.query.categoryId}`,
}); });
}; };
...@@ -390,6 +408,7 @@ class QuestionList extends Component { ...@@ -390,6 +408,7 @@ class QuestionList extends Component {
close={() => { close={() => {
this.setState({ batchImportQuestionModal: null }, () => { this.setState({ batchImportQuestionModal: null }, () => {
this.queryQuestionPageList(); this.queryQuestionPageList();
Bus.trigger("queryCategoryTree", "remain");
}); });
}} }}
categoryId={categoryId} categoryId={categoryId}
...@@ -407,6 +426,7 @@ class QuestionList extends Component { ...@@ -407,6 +426,7 @@ class QuestionList extends Component {
batchImportQuestionModal, batchImportQuestionModal,
} = this.state; } = this.state;
const { current, size, categoryId, questionName, questionType } = query; const { current, size, categoryId, questionName, questionType } = query;
const { match } = this.props;
return ( return (
<div className="question-list"> <div className="question-list">
<div className="question-list-filter"> <div className="question-list-filter">
...@@ -417,7 +437,7 @@ class QuestionList extends Component { ...@@ -417,7 +437,7 @@ class QuestionList extends Component {
<Search <Search
placeholder="搜索题目名称" placeholder="搜索题目名称"
value={questionName} value={questionName}
style={{ width: "calc(100% - 84px)" }} style={{ width: 178 }}
onChange={(e) => { onChange={(e) => {
this.handleChangeQuery("questionName", e.target.value); this.handleChangeQuery("questionName", e.target.value);
}} }}
...@@ -433,7 +453,7 @@ class QuestionList extends Component { ...@@ -433,7 +453,7 @@ class QuestionList extends Component {
<Select <Select
placeholder="请选择题目类型" placeholder="请选择题目类型"
value={questionType} value={questionType}
style={{ width: "calc(100% - 70px)" }} style={{ width: 178 }}
showSearch showSearch
allowClear allowClear
enterButton={<span className="icon iconfont">&#xe832;</span>} enterButton={<span className="icon iconfont">&#xe832;</span>}
...@@ -512,9 +532,10 @@ class QuestionList extends Component { ...@@ -512,9 +532,10 @@ class QuestionList extends Component {
{previewQuestionModal} {previewQuestionModal}
{batchImportQuestionModal} {batchImportQuestionModal}
</div> </div>
<Route path={`${match.url}/question-operate-page`} component={OperateQuestion} />
</div> </div>
); );
} }
} }
export default QuestionList; export default withRouter(QuestionList);
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
flex-wrap: wrap; flex-wrap: wrap;
&__item { &__item {
width: 30%;
margin-right: 3%; margin-right: 3%;
margin-bottom: 16px; margin-bottom: 16px;
.search-label { .search-label {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-04-29 10:26:32 * @Date: 2020-04-29 10:26:32
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-27 16:54:14 * @LastEditTime: 2021-04-07 10:13:06
* @Description: 内容线路由配置 * @Description: 内容线路由配置
*/ */
import Home from '@/modules/home/Home'; import Home from '@/modules/home/Home';
...@@ -104,21 +104,11 @@ const mainRoutes = [ ...@@ -104,21 +104,11 @@ const mainRoutes = [
name: '题库' name: '题库'
}, },
{ {
path: '/question-operate-page',
component:OperateQuestion,
name: '操作题目'
},
{
path: '/paper-manage-index', path: '/paper-manage-index',
component:PaperManageIndex, component:PaperManageIndex,
name: '试卷' name: '试卷'
}, },
{ {
path: '/paper-operate-page',
component:OperatePaper,
name: '操作试卷'
},
{
path: '/examination-manage-index', path: '/examination-manage-index',
component:ExaminationManagerIndex, component:ExaminationManagerIndex,
name: '考试' name: '考试'
......
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