Commit 3cfa93ca by yuananting

feat:新建题目

parent f48a2dd4
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-23 18:28:50
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 19:50:28
* @LastEditTime: 2021-03-30 14:25:47
* @Description: 助学工具-课程分类
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -30,7 +30,7 @@ class CourseCategoryManage extends Component {
constructor(props) {
super(props);
this.state = {
NewEditCourseCategoryModal: null, //新增或编辑分类模态框
newEditCourseCategoryModal: null, //新增或编辑分类模态框
treeData: [],
originTreeData: [],
treeMap: {},
......@@ -302,12 +302,12 @@ class CourseCategoryManage extends Component {
close={() => {
this.queryCategoryTree("change", this.state.categoryName);
this.setState({
NewEditCourseCategoryModal: null,
newEditCourseCategoryModal: null,
});
}}
/>
);
this.setState({ NewEditCourseCategoryModal: m });
this.setState({ newEditCourseCategoryModal: m });
};
// 删除分类
......@@ -582,7 +582,7 @@ class CourseCategoryManage extends Component {
expandedKeys,
selectedKeys,
autoExpandParent,
NewEditCourseCategoryModal,
newEditCourseCategoryModal,
} = this.state;
return (
<div className="page course-category-manage">
......@@ -645,7 +645,7 @@ class CourseCategoryManage extends Component {
></DirectoryTree>
</div>
</div>
{NewEditCourseCategoryModal}
{newEditCourseCategoryModal}
</div>
);
}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 16:17:53
* @LastEditTime: 2021-03-30 16:40:58
* @Description: 助学工具-课程分类侧边栏
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -19,22 +19,28 @@ class CourseCategorySiderTree extends Component {
constructor(props) {
super(props);
this.state = {
selectedKeys: [getParameterByName("categoryId") || "null"],
treeData: this.props.treeData || [],
selectedKeys:
props.fromModule === "index"
? [getParameterByName("categoryId") || "null"]
: ["null"],
treeData: props.treeData || [],
autoExpandParent: false,
};
}
componentDidMount() {
this.queryCategoryTree("change");
this.props.getSelectedCategoryId([
getParameterByName("categoryId") || "null",
]);
this.props.getSelectedCategoryId(
this.props.fromModule === "index"
? [getParameterByName("categoryId") || "null"]
: ["null"]
);
}
shouldComponentUpdate(nextProps, nextState) {
const { currentTotal, updatedCategoryId } = nextProps;
if (
this.props.fromModule === "index" &&
this.props.currentTotal !== currentTotal &&
this.props.updatedCategoryId === updatedCategoryId
) {
......@@ -200,7 +206,7 @@ class CourseCategorySiderTree extends Component {
}}
enterButton={<span className="icon iconfont">&#xe832;</span>}
/>
{User.getUserRole() !== "CloudLecturer" && (
{this.props.fromModule==="index" && User.getUserRole() !== "CloudLecturer" && (
<div className="sider-btn">
<Button
onClick={() => {
......
......@@ -2,11 +2,10 @@
* @Author: yuananting
* @Date: 2021-03-27 14:55:14
* @LastEditors: yuananting
* @LastEditTime: 2021-03-27 15:21:06
* @LastEditTime: 2021-03-30 16:08:38
* @Description: 助学工具-试卷主页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { Component } from "react";
import "./ExaminationPaperIndex.less";
import CourseCategorySiderTree from "../components/CourseCategorySiderTree";
......@@ -15,13 +14,9 @@ import ExaminationPaperContent from "./components/ExaminationPaperContent";
class ExaminationPaperIndex extends Component {
constructor(props) {
super(props);
this.state = {
selectedCategoryId: "",
};
this.state = {};
}
componentDidMount() {}
getCategoryIdFromSider = (selectedCategoryId) => {
if (selectedCategoryId && selectedCategoryId.length > 0) {
this.setState({ selectedCategoryId: selectedCategoryId[0] });
......@@ -42,6 +37,7 @@ class ExaminationPaperIndex extends Component {
>
<div className="sider">
<CourseCategorySiderTree
fromModule="index"
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
currentTotal={this.state.currentTotal}
updatedCategoryId={this.state.updatedCategoryId}
......
/*
* @Author: yuananting
* @Date: 2021-02-21 18:27:43
* @LastEditors: yuananting
* @LastEditTime: 2021-03-27 15:18:26
* @Description: 助学工具-题库-试卷主页面样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
.examination-paper-index {
.examination-paper-index {
.content-body {
display: flex;
.site-layout-background {
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 13:52:01
* @LastEditors: yuananting
* @LastEditTime: 2021-03-27 17:22:05
* @LastEditTime: 2021-03-30 19:34:05
* @Description: 助学工具-新建试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -32,3 +32,9 @@
}
}
}
.aid-tool-list {
.ant-tooltip-inner {
max-width: 700px !important;
}
}
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 13:57:20
* @LastEditTime: 2021-03-30 19:32:28
* @Description: 助学工具-题库-题目管理主页面列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -12,7 +12,6 @@ import {
Dropdown,
Row,
Input,
Select,
Tooltip,
Menu,
Button,
......@@ -24,34 +23,9 @@ import "./ExaminationPaperContent.less";
import User from "@/common/js/user";
import QuestionBankService from "@/domains/question-bank-domain/QuestionBankService";
import _ from "underscore";
// import QuestionPreviewModal from "../modal/QuestionPreviewModal";
// import BatchImportQuestionModal from "../modal/BatchImportQuestionModal";
const { Search } = Input;
const questionTypeList = [
{
label: "单选题",
value: "SINGLE_CHOICE",
},
{
label: "多选题",
value: "MULTI_CHOICE",
},
{
label: "判断题",
value: "JUDGE",
},
{
label: "填空题",
value: "GAP_FILLING",
},
{
label: "不定项选择题",
value: "INDEFINITE_CHOICE",
},
];
class ExaminationPaperContent extends Component {
constructor(props) {
super(props);
......@@ -59,63 +33,54 @@ class ExaminationPaperContent extends Component {
query: {
current: 1,
size: 10,
order: "UPDATED_DESC", // 排序规则[ ACCURACY_DESC, ACCURACY_ASC, CREATED_DESC, CREATED_ASC, UPDATED_DESC, UPDATED_ASC ]
categoryId: null, // 当前题库分类Id
questionName: null, // 题目名称
questionType: null, // 题目类型
examinationPaperName: null, // 试卷名称
source: 0,
tenantId: User.getStoreId(),
userId: User.getStoreUserId(),
},
questionTypeList: [], // 题型列表
dataSource: [],
totalCount: 0,
QuestionPreviewModal: null, // 题目预览模态框
questionPreviewModal: null, // 题目预览模态框
};
}
componentDidMount() {
this.setState({
dataSource: [
{
examinationName: "一二三四五六七八九十",
passScore: 60,
totalScore: 100,
count: 12,
relatedCount: 12,
},
],
});
}
componentDidMount() {}
queryQuestionPageList = (remain) => {
shouldComponentUpdate(nextProps, nextState) {
let { selectedCategoryId } = nextProps;
const _query = this.state.query;
if (_query.categoryId === "0") _query.categoryId = null;
QuestionBankService.queryQuestionPageList(_query).then((res) => {
const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records });
this.setState({ total }, () =>
this.props.updatedSiderTree(total, this.props.selectedCategoryId)
);
});
};
if (this.props.selectedCategoryId !== selectedCategoryId) {
_query.categoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
_query.examinationPaperName = null;
_query.current = 1;
this.setState({ query: _query }, () => this.queryExaminationPaperList());
}
return true;
}
// 查询试卷列表
queryExaminationPaperList = () => {};
delCategoryConfirm(record) {
// 预览试卷
previewExaminationPaper = (record) => {};
// 复制试卷
copyExaminationPaper = (record) => {};
// 编辑试卷
editExaminationPaper = (record) => {};
// 删除试卷
delExaminationPaper(record) {
return Modal.confirm({
title: "提示",
content: "确定要删除此题目吗?",
content: "确定要删除此试卷吗?",
icon: (
<span className="icon iconfont default-confirm-icon">&#xe839; </span>
),
okText: "删除",
cancelText: "取消",
onOk: () => {
this.deleteQuestion(record);
},
});
}
deleteQuestion = (record) => {
let params = {
id: record.id,
source: 0,
......@@ -133,24 +98,22 @@ class ExaminationPaperContent extends Component {
_query.current = 1;
}
}
this.setState({ query: _query }, () => this.queryQuestionPageList());
this.setState({ query: _query }, () =>
this.queryQuestionPageList()
);
}
});
};
// 预览试卷
previewExaminationPaper = () => {};
// 编辑试卷
toEditExaminationPaper = () => {};
},
});
}
// 表头设置
parseColumns = () => {
const columns = [
{
title: "试卷",
key: "examinationName",
dataIndex: "examinationName",
key: "examinationPaperName",
dataIndex: "examinationPaperName",
ellipsis: {
showTitle: false,
},
......@@ -158,7 +121,6 @@ class ExaminationPaperContent extends Component {
var handleVal = val;
handleVal = handleVal.replace(/<(?!img|input).*?>/g, "");
handleVal = handleVal.replace(/<\s?input[^>]*>/gi, "_、");
handleVal = handleVal.replace(/<\s?img[^>]*>/gi, "【图片】");
handleVal = handleVal.replace(/\&nbsp\;/gi, " ");
return (
<Tooltip
......@@ -234,19 +196,21 @@ class ExaminationPaperContent extends Component {
return columns;
};
// 操作更多下拉项
initDropMenu = (item) => {
return (
<Menu>
<Menu.Item key="0">
<span>编辑</span>
<Menu.Item key="edit">
<span onClick={() => this.editExaminationPaper(item)}>编辑</span>
</Menu.Item>
<Menu.Item key="1">
<span>删除</span>
<Menu.Item key="del">
<span onClick={() => this.delExaminationPaper(item)}>删除</span>
</Menu.Item>
</Menu>
);
};
// 页展示数修改
onShowSizeChange = (current, size) => {
if (current == size) {
return;
......@@ -303,7 +267,7 @@ class ExaminationPaperContent extends Component {
type="primary"
onClick={() => {
window.RCHistory.push({
pathname: `/new-examination-paper`,
pathname: `/new-examination-paper?categoryId=${this.state.query.categoryId}`,
});
}}
>
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:26:28
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 13:39:28
* @LastEditTime: 2021-03-30 18:34:50
* @Description: 助学工具-题库-题目管理右侧内容样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -75,6 +75,28 @@
}
}
}
.select-tip-box {
background: #fff4dd;
border-radius: 4px;
padding: 6px 16px;
margin-right: 8px;
display: flex;
justify-content: space-between;
.tip-icon {
color: #ff9d14;
font-size: 14px;
margin-right: 4px;
}
.select-num {
color: #666666;
font-size: 14px;
}
.clear-btn {
color: #5289fa;
font-size: 14px;
cursor: pointer;
}
}
}
.tool-list {
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-29 10:52:26
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 14:09:08
* @LastEditTime: 2021-03-30 19:17:30
* @Description: 助学工具-新建试卷-选择题目弹窗
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -10,13 +10,13 @@ import React, { Component } from "react";
import { Modal } from "antd";
import CourseCategorySiderTree from "../../components/CourseCategorySiderTree";
import SelectQuestionContent from "../components/SelectQuestionContent";
import "./SelectQuestionModal.less"
import "./SelectQuestionModal.less";
class SelectQuestionModal extends Component {
listRef = React.createRef();
constructor(props) {
super(props);
this.state = {
updatedCategoryId: null,
selectedCategoryId: null,
};
}
......@@ -27,18 +27,18 @@ class SelectQuestionModal extends Component {
}
};
updatedSiderTreeFromList = (updatedCategoryId) => {
this.setState({ updatedCategoryId });
};
render() {
const { updatedCategoryId, selectedCategoryId } = this.state;
return (
<Modal
destroyOnClose={true}
title="选择题目"
visible={true}
width={1200}
// onOk={handleOk}
onOk={() =>
this.props.setSelectedQuestion(
this.listRef.current.state.selectQuestionKeys
)
}
onCancel={this.props.close}
className="select-question-modal"
>
......@@ -48,15 +48,16 @@ class SelectQuestionModal extends Component {
>
<div className="sider">
<CourseCategorySiderTree
fromModule="modal"
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
updatedCategoryId
/>
</div>
</div>
<div className="content">
<SelectQuestionContent
updatedSiderTree={this.updatedSiderTreeFromList.bind(this)}
selectedCategoryId
fromModule="modal"
ref={this.listRef}
selectedCategoryId={this.state.selectedCategoryId}
/>
</div>
</div>
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-21 17:51:01
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 16:11:41
* @LastEditTime: 2021-03-30 16:08:58
* @Description: 助学工具-题库-题库主页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -37,6 +37,7 @@ class QuestionBankIndex extends Component {
>
<div className="sider">
<CourseCategorySiderTree
fromModule="index"
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
currentTotal={this.state.currentTotal}
updatedCategoryId={this.state.updatedCategoryId}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-03-29 16:21:50
* @LastEditTime: 2021-03-30 19:33:39
* @Description: 助学工具-题库-列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -77,8 +77,8 @@ class QuestionManageContent extends Component {
userId: User.getStoreUserId(),
},
dataSource: [], // 题库列表
QuestionPreviewModal: null, // 题目预览模态框
BatchImportQuestionModal: null, // 批量导入模态框
questionPreviewModal: null, // 题目预览模态框
batchImportQuestionModal: null, // 批量导入模态框
};
}
......@@ -86,10 +86,7 @@ class QuestionManageContent extends Component {
let { selectedCategoryId } = nextProps;
const _query = this.state.query;
if (this.props.selectedCategoryId !== selectedCategoryId) {
if (selectedCategoryId === "null") {
selectedCategoryId = null;
}
_query.categoryId = selectedCategoryId;
_query.categoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
_query.questionName = null;
_query.questionType = null;
_query.current = 1;
......@@ -214,11 +211,10 @@ class QuestionManageContent extends Component {
var handleVal = val;
handleVal = handleVal.replace(/<(?!img|input).*?>/g, "");
handleVal = handleVal.replace(/<\s?input[^>]*>/gi, "_、");
handleVal = handleVal.replace(/<\s?img[^>]*>/gi, "【图片】");
handleVal = handleVal.replace(/\&nbsp\;/gi, " ");
return (
<Tooltip
overlayClassName="tool-list"
overlayClassName="aid-tool-list"
title={
<div style={{ maxWidth: 700, width: "auto" }}>{handleVal}</div>
}
......@@ -324,12 +320,12 @@ class QuestionManageContent extends Component {
id={id}
close={() => {
this.setState({
QuestionPreviewModal: null,
questionPreviewModal: null,
});
}}
/>
);
this.setState({ QuestionPreviewModal: m });
this.setState({ questionPreviewModal: m });
};
// 编辑题目
......@@ -393,14 +389,14 @@ class QuestionManageContent extends Component {
const m = (
<BatchImportQuestionModal
close={() => {
this.setState({ BatchImportQuestionModal: null }, () => {
this.setState({ batchImportQuestionModal: null }, () => {
this.queryQuestionPageList();
});
}}
categoryId={categoryId}
/>
);
this.setState({ BatchImportQuestionModal: m });
this.setState({ batchImportQuestionModal: m });
};
render() {
......@@ -408,8 +404,8 @@ class QuestionManageContent extends Component {
dataSource = [],
total,
query,
QuestionPreviewModal,
BatchImportQuestionModal,
questionPreviewModal,
batchImportQuestionModal,
} = this.state;
const { current, size, categoryId, questionName, questionType } = query;
return (
......@@ -514,8 +510,8 @@ class QuestionManageContent extends Component {
/>
</div>
)}
{QuestionPreviewModal}
{BatchImportQuestionModal}
{questionPreviewModal}
{batchImportQuestionModal}
</div>
</div>
);
......
......@@ -68,7 +68,7 @@
}
}
}
.tool-list {
.aid-tool-list {
.ant-tooltip-inner {
max-width: 700px !important;
}
......
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