Commit 93766da8 by yuananting

feat:题库模板结构修改

parent 1d242593
......@@ -2,14 +2,14 @@
* @Author: yuananting
* @Date: 2021-02-23 18:28:50
* @LastEditors: yuananting
* @LastEditTime: 2021-03-24 17:18:20
* @Description: 助学工具-题库-主页面分类管理
* @LastEditTime: 2021-03-27 13:49:14
* @Description: 助学工具-题库-课程分类管理
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { Component } from "react";
import Breadcrumbs from "@/components/Breadcrumbs";
import "./QuestionCategoryManage.less";
import NewEditQuestionBankCategory from "./modal/NewEditQuestionBankCategory";
import "./CourseCategoryManage.less";
import NewEditCourseCategoryModal from "../modal/NewEditCourseCategoryModal";
import QuestionBankService from "@/domains/question-bank-domain/QuestionBankService";
import User from "@/common/js/user";
import {
......@@ -26,11 +26,11 @@ import ShowTips from "@/components/ShowTips";
const { DirectoryTree } = Tree;
const { Search } = Input;
const { confirm } = Modal;
class QuestionCategoryManage extends Component {
class CourseCategoryManage extends Component {
constructor(props) {
super(props);
this.state = {
NewEditQuestionBankCategory: null, //新增或编辑分类模态框
NewEditCourseCategoryModal: null, //新增或编辑分类模态框
treeData: [],
treeMap: {},
selectedKeys: ["0"],
......@@ -134,7 +134,7 @@ class QuestionCategoryManage extends Component {
};
// 新增或编辑分类
newEditQuestionCategory = (categoryType, addLevelType, type, node) => {
newEditCourseCategory = (categoryType, addLevelType, type, node) => {
let title = "";
let label = "";
switch (categoryType) {
......@@ -156,7 +156,7 @@ class QuestionCategoryManage extends Component {
break;
}
const m = (
<NewEditQuestionBankCategory
<NewEditCourseCategoryModal
node={node}
addLevelType={addLevelType}
type={type}
......@@ -166,12 +166,12 @@ class QuestionCategoryManage extends Component {
close={() => {
this.queryCategoryTree("change");
this.setState({
NewEditQuestionBankCategory: null,
NewEditCourseCategoryModal: null,
});
}}
/>
);
this.setState({ NewEditQuestionBankCategory: m });
this.setState({ NewEditCourseCategoryModal: m });
};
initDropMenu = (item) => {
......@@ -184,7 +184,7 @@ class QuestionCategoryManage extends Component {
item.categoryLevel === 0
? "editEqualLevelCategory"
: "editChildLevelCategory";
this.newEditQuestionCategory(categoryType, "equal", "edit", item);
this.newEditCourseCategory(categoryType, "equal", "edit", item);
}}
>
重命名
......@@ -456,7 +456,7 @@ class QuestionCategoryManage extends Component {
message.info("最多只能添加30个分类");
return;
}
this.newEditQuestionCategory(
this.newEditCourseCategory(
"newEqualLevelCategory",
"equal",
"new",
......@@ -479,7 +479,7 @@ class QuestionCategoryManage extends Component {
message.info("最多只能添加30个子分类");
return;
}
this.newEditQuestionCategory(
this.newEditCourseCategory(
"newChildLevelCategory",
"child",
"new",
......@@ -581,7 +581,7 @@ class QuestionCategoryManage extends Component {
autoExpandParent,
} = this.state;
return (
<div className="page question-category-manage">
<div className="page course-category-manage">
{getParameterByName("from") === "aid" ? (
<Breadcrumbs
navList="课程分类"
......@@ -612,7 +612,7 @@ class QuestionCategoryManage extends Component {
message.info("最多只能添加30个分类");
return;
}
this.newEditQuestionCategory(
this.newEditCourseCategory(
"newEqualLevelCategory",
"equal",
"new"
......@@ -641,10 +641,10 @@ class QuestionCategoryManage extends Component {
></DirectoryTree>
</div>
</div>
{this.state.NewEditQuestionBankCategory}
{this.state.NewEditCourseCategoryModal}
</div>
);
}
}
export default QuestionCategoryManage;
export default CourseCategoryManage;
......@@ -2,11 +2,11 @@
* @Author: yuananting
* @Date: 2021-02-23 19:41:42
* @LastEditors: yuananting
* @LastEditTime: 2021-03-24 17:16:43
* @Description: 助学工具-题库-题目分类管理样式
* @LastEditTime: 2021-03-27 13:49:00
* @Description: 助学工具-题库-课程分类管理样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
.question-category-manage {
.course-category-manage {
position: relative;
.search-condition {
width: 30%;
......
......@@ -2,20 +2,20 @@
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @LastEditors: yuananting
* @LastEditTime: 2021-03-24 14:50:08
* @Description: 助学工具-题库-题库主页面侧边栏
* @LastEditTime: 2021-03-27 13:51:43
* @Description: 助学工具-题库-课程分类侧边栏
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { Component } from "react";
import { Input, Button, Tree } from "antd";
import "./QuestionBankSider.less";
import "./CourseCategorySiderTree.less";
import User from "@/common/js/user";
import QuestionBankService from "@/domains/question-bank-domain/QuestionBankService";
const { Search } = Input;
const { DirectoryTree } = Tree;
class QuestionBankSider extends Component {
class CourseCategorySiderTree extends Component {
constructor(props) {
super(props);
const categoryId = getParameterByName("categoryId");
......@@ -26,8 +26,6 @@ class QuestionBankSider extends Component {
: [categoryId]
: ["0"],
searchValue: null,
NewEditQuestionBankCategory: null, //新增或编辑分类模态框
ImportCourseCategory: null, // 引用课程分类模态框
treeData: this.props.treeData || [],
autoExpandParent: false,
};
......@@ -195,7 +193,7 @@ class QuestionBankSider extends Component {
autoExpandParent,
} = this.state;
return (
<div className="question-bank-sider">
<div className="category-tree-sider">
<div className="sider-title">题目分类</div>
<Search
className="sider-search"
......@@ -210,7 +208,7 @@ class QuestionBankSider extends Component {
<Button
onClick={() => {
window.RCHistory.push({
pathname: "/question-category-manage?from=aid",
pathname: "/course-category-manage?from=aid",
});
}}
>
......@@ -229,11 +227,9 @@ class QuestionBankSider extends Component {
treeData={treeData}
/>
</div>
{this.state.NewEditQuestionBankCategory}
{this.state.ImportCourseCategory}
</div>
);
}
}
export default QuestionBankSider;
export default CourseCategorySiderTree;
......@@ -2,11 +2,11 @@
* @Author: yuananting
* @Date: 2021-02-22 12:02:34
* @LastEditors: yuananting
* @LastEditTime: 2021-03-24 15:57:12
* @Description: 助学工具-题库-题库主页面侧边栏样式
* @LastEditTime: 2021-03-27 13:52:19
* @Description: 助学工具-题库-课程分类侧边栏样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
.question-bank-sider {
.category-tree-sider {
position: relative;
.sider-title {
height: 22px;
......
......@@ -2,15 +2,15 @@
* @Author: yuananting
* @Date: 2021-02-22 17:51:28
* @LastEditors: yuananting
* @LastEditTime: 2021-03-24 15:02:53
* @Description: 助学工具-题库-题库新建或编辑题库分类模态框
* @LastEditTime: 2021-03-27 14:08:47
* @Description: 助学工具-题库-新建编辑课程分类模态框
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { Component } from "react";
import { Modal, Form, Input, message } from "antd";
import User from "@/common/js/user";
import QuestionBankService from "@/domains/question-bank-domain/QuestionBankService";
class NewEditQuestionBankCategory extends Component {
class NewEditCourseCategoryModal extends Component {
formRef = React.createRef();
constructor(props) {
super(props);
......@@ -22,7 +22,6 @@ class NewEditQuestionBankCategory extends Component {
}
componentDidMount() {
// document.getElementById("categoryName").setAttribute("style", "autocomplete","off")
this.queryCategoryTree();
}
......@@ -196,4 +195,4 @@ class NewEditQuestionBankCategory extends Component {
);
}
}
export default NewEditQuestionBankCategory;
export default NewEditCourseCategoryModal;
......@@ -2,14 +2,14 @@
* @Author: yuananting
* @Date: 2021-02-21 17:51:01
* @LastEditors: yuananting
* @LastEditTime: 2021-03-24 13:55:56
* @LastEditTime: 2021-03-27 13:42:42
* @Description: 助学工具-题库-题库主页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { Component } from "react";
import "./QuestionBankIndex.less";
import QuestionBankSider from "./components/QuestionBankSider";
import QuestionBankSider from "../components/CourseCategorySiderTree";
import QuestionManageContent from "./components/QuestionManageContent";
class QuestionBankIndex extends Component {
......@@ -29,8 +29,7 @@ class QuestionBankIndex extends Component {
};
updatedSiderTreeFromList = (currentTotal, updatedCategoryId) => {
this.setState({ currentTotal });
this.setState({ updatedCategoryId });
this.setState({ currentTotal, updatedCategoryId });
};
render() {
......@@ -38,7 +37,9 @@ class QuestionBankIndex extends Component {
<div className="question-bank-index page">
<div className="content-header">题目</div>
<div className="box content-body">
<div style={{borderRight: "0.5px solid #EEEEEE", paddingRight: "4px"}}>
<div
style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }}
>
<div className="sider">
<QuestionBankSider
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting
* @LastEditTime: 2021-03-25 19:52:09
* @LastEditTime: 2021-03-27 14:02:44
* @Description: 助学工具-题库-题目管理-新建题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -73,8 +73,10 @@ class NewQuestionTab extends Component {
// 选择题(单选 多选 不定项)-插入4条默认选项
for (var i = 0; i < 4; i++) {
this.handleAddOption();
this.setState({ [`optionsValidate_${i}`]: "success" });
this.setState({ [`optionsText_${i}`]: "" });
this.setState({
[`optionsValidate_${i}`]: "success",
[`optionsText_${i}`]: "",
});
}
}
} else if (this.props.questionTypeKey === "JUDGE") {
......@@ -105,16 +107,18 @@ class NewQuestionTab extends Component {
shouldComponentUpdate(nextProps, nextState) {
const { questionInfo } = nextProps;
if (this.props.questionInfo !== questionInfo) {
this.setState({
gapFillingAnswer: JSON.parse(
JSON.stringify(questionInfo.gapFillingAnswerList)
),
});
this.setState(
{
gapFillingAnswer: JSON.parse(
JSON.stringify(questionInfo.gapFillingAnswerList)
),
stemContent: JSON.parse(
JSON.stringify(questionInfo.questionStemList)
),
chooseOptions: JSON.parse(JSON.stringify(questionInfo.optionList)),
questionAnswerDesc: JSON.parse(
JSON.stringify(questionInfo.questionAnswerDescList)
),
},
() => {
const con = questionInfo.questionStemList[0].content;
......@@ -126,15 +130,7 @@ class NewQuestionTab extends Component {
});
this.setState({ blanksList: _blanksList || [] });
}
); // 题干内容
this.setState({
chooseOptions: JSON.parse(JSON.stringify(questionInfo.optionList)),
}); // 单选多选不定项-选项列表
this.setState({
questionAnswerDesc: JSON.parse(
JSON.stringify(questionInfo.questionAnswerDescList)
),
}); // 答案解析
);
this._onSetState();
}
return true;
......@@ -175,8 +171,8 @@ class NewQuestionTab extends Component {
stem = stem.replace(/\s+/g, "");
if (this.props.questionTypeKey === "GAP_FILLING") {
if (this.state.blanksList.length === 0 || stem.length === 0) {
this.setState({ stemValidate: "error" });
this.setState({
stemValidate: "error",
stemText: (
<div style={{ marginTop: 8, minWidth: "523px" }}>
请输入正确格式,示例:党章规定,凡事有
......@@ -193,17 +189,14 @@ class NewQuestionTab extends Component {
});
validateError++;
} else {
this.setState({ stemValidate: "success" });
this.setState({ stemText: "" });
this.setState({ stemValidate: "success", stemText: "" });
}
} else {
if (stem.length === 0) {
this.setState({ stemValidate: "error" });
this.setState({ stemText: "请输入题干" });
this.setState({ stemValidate: "error", stemText: "请输入题干" });
validateError++;
} else {
this.setState({ stemValidate: "success" });
this.setState({ stemText: "" });
this.setState({ stemValidate: "success", stemText: "" });
}
}
// 选项校验
......@@ -212,12 +205,16 @@ class NewQuestionTab extends Component {
if (this.props.questionTypeKey === "GAP_FILLING") {
this.state.gapFillingAnswer.forEach((item, index) => {
if (item.correctAnswerList.length === 0) {
this.setState({ [`optionsValidate_${index}`]: "error" });
this.setState({ [`optionsText_${index}`]: "请输入答案" });
this.setState({
[`optionsValidate_${index}`]: "error",
[`optionsText_${index}`]: "请输入答案",
});
validateError++;
} else {
this.setState({ [`optionsValidate_${index}`]: "success" });
this.setState({ [`optionsText_${index}`]: "" });
this.setState({
[`optionsValidate_${index}`]: "success",
[`optionsText_${index}`]: "",
});
}
});
} else {
......@@ -235,12 +232,16 @@ class NewQuestionTab extends Component {
optionContent[0].type === "RICH_TEXT" &&
optionInput.length === 0
) {
this.setState({ [`optionsValidate_${index}`]: "error" });
this.setState({ [`optionsText_${index}`]: "请输入选项" });
this.setState({
[`optionsValidate_${index}`]: "error",
[`optionsText_${index}`]: "请输入选项",
});
validateError++;
} else {
this.setState({ [`optionsValidate_${index}`]: "success" });
this.setState({ [`optionsText_${index}`]: "" });
this.setState({
[`optionsValidate_${index}`]: "success",
[`optionsText_${index}`]: "",
});
}
});
var chooseIcon = [];
......@@ -254,11 +255,8 @@ class NewQuestionTab extends Component {
chooseIcon = document.getElementsByClassName("ant-checkbox-inner");
}
if (optionUnChecked === chooseOptions.length) {
this.setState({ radioValidate: "error" });
chooseIcon.forEach((item) => {
item.setAttribute("style", "border:1px solid #ff4d4f;");
});
this.setState({
radioValidate: "error",
radioText: (
<span>
正确答案
......@@ -267,10 +265,12 @@ class NewQuestionTab extends Component {
</span>
),
});
chooseIcon.forEach((item) => {
item.setAttribute("style", "border:1px solid #ff4d4f;");
});
validateError++;
} else {
this.setState({ radioValidate: "success" });
this.setState({ radioText: "" });
this.setState({ radioValidate: "success", radioText: "" });
chooseIcon.forEach((item) => {
item.removeAttribute("style");
});
......@@ -279,8 +279,7 @@ class NewQuestionTab extends Component {
this.props.questionTypeKey === "MULTI_CHOICE" &&
this.state.chooseOptions.length - optionUnChecked === 1
) {
this.setState({ radioValidate: "error" });
this.setState({ radioText: "最少选两个" });
this.setState({ radioValidate: "error", radioText: "最少选两个" });
chooseIcon.forEach((item) => {
item.setAttribute("style", "border:1px solid #ff4d4f;");
});
......@@ -485,8 +484,6 @@ class NewQuestionTab extends Component {
// 录音
this.setState({
showRecord: true,
});
this.setState({
onAudioFinish: function () {
change();
},
......@@ -582,27 +579,31 @@ class NewQuestionTab extends Component {
changeBlankCount = (data, idx) => {
let _gap = this.state.gapFillingAnswer;
if (data.length <= idx) {
_gap.splice(idx, 1);
if (data.length === 0) {
_gap = [];
} else {
data.forEach((item, index) => {
if (index === idx) {
if (_gap.length < data.length) {
_gap.splice(idx, 0, { correctAnswerList: [] });
} else if (_gap.length > data.length) {
_gap.splice(idx, 1);
} else {
_gap.splice(idx, 1, { correctAnswerList: [] });
if (data.length <= idx) {
_gap.splice(idx, 1);
} else {
data.forEach((item, index) => {
if (index === idx) {
if (_gap.length < data.length) {
_gap.splice(idx, 0, { correctAnswerList: [] });
} else if (_gap.length > data.length) {
_gap.splice(idx, 1);
} else {
_gap.splice(idx, 1, { correctAnswerList: [] });
}
}
}
if (!item.correctAnswerList) {
item.correctAnswerList = [];
}
item.inputVisible = false;
item.errorHold = false;
item.editInput = false;
return item;
});
if (!item.correctAnswerList) {
item.correctAnswerList = [];
}
item.inputVisible = false;
item.errorHold = false;
item.editInput = false;
return item;
});
}
}
this.setState(
......@@ -644,10 +645,10 @@ class NewQuestionTab extends Component {
}
});
this.setState({ gapFillingAnswer: _gapFillingAnswer }, () =>
this._onSetState()
this.setState(
{ gapFillingAnswer: _gapFillingAnswer, blanksList: _blanksList },
() => this._onSetState()
);
this.setState({ blanksList: _blanksList });
};
handleTagClose = (optionItem, removedTag, removedIndex) => {
......@@ -663,10 +664,10 @@ class NewQuestionTab extends Component {
);
}
});
this.setState({ gapFillingAnswer: _gapFillingAnswer }, () =>
this._onSetState()
this.setState(
{ gapFillingAnswer: _gapFillingAnswer, blanksList: _blanksList },
() => this._onSetState()
);
this.setState({ blanksList: _blanksList });
};
// 输入框关闭
......
......@@ -8,16 +8,6 @@
import React, { useState, useEffect, useRef } from "react";
import "./XMAudio.less";
import VideoUpload from "@/core/upload";
import { string } from "prop-types";
// interface XMAudioProps {
// style?: any;
// index?: any;
// size?: number | string;
// url?: any;
// forbidParse?:boolean;
// getDuration?: (value: number) => void;
// }
let timerInterval;
......
/*
* @Author: chenjianyu
* @Date: 2020-09-12 17:00:44
* @LastEditTime: 2021-03-18 17:23:09
* @LastEditors: sunbingqing
* @LastEditTime: 2021-03-27 14:02:17
* @LastEditors: yuananting
* @Description: 答题模式模板
* @Copyright © 2020 杭州杰竞科技有限公司 版权所有
*/
......
......@@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { Modal, Button, Upload, message, Spin, Progress } from "antd";
import { Modal, Button, message, Spin } from "antd";
import "./BatchImportQuestionModal.less";
import SelectPrepareFileModal from "@/modules/prepare-lesson/modal/SelectPrepareFileModal";
import User from "@/common/js/user";
......@@ -222,9 +222,11 @@ class BatchImportQuestionModal extends Component {
type="primary"
className="down-btn"
onClick={() => {
this.setState({ status: "init" });
this.setState({ uploadFile: null });
this.setState({ showSelectFileModal: true });
this.setState({
status: "init",
uploadFile: null,
showSelectFileModal: true,
});
}}
>
重新上传文件
......
@import '../../../core/mixins.less';
@import '@/core/mixins.less';
.import-score-modal {
.step-section {
margin-bottom: 24px;
......
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-04-29 10:26:32
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18 11:30:15
* @LastEditTime: 2021-03-27 11:38:59
* @Description: 内容线路由配置
*/
import Home from '@/modules/home/Home';
......@@ -25,9 +25,9 @@ import PlanPage from '@/modules/plan-manage/PlanPage';
import AddPlanPage from '@/modules/plan-manage/AddPlan';
import LearningDataPage from '@/modules/plan-manage/LearningData';
import StoreInfoPage from '@/modules/store-manage/StoreInfo';
import QuestionBankIndex from '@/modules/teach-tool/QuestionBankIndex';
import QuestionCategoryManage from '@/modules/teach-tool/QuestionCategoryManage';
import AddNewQuestion from '@/modules/teach-tool/AddNewQuestion';
import QuestionBankIndex from '@/modules/teach-tool/question-bank/QuestionBankIndex';
import CourseCategoryManage from '@/modules/teach-tool/components/CourseCategoryManage';
import AddNewQuestion from '@/modules/teach-tool/question-bank/AddNewQuestion';
const mainRoutes = [
{
......@@ -101,8 +101,8 @@ const mainRoutes = [
name: '题库'
},
{
path: '/question-category-manage',
component:QuestionCategoryManage,
path: '/course-category-manage',
component:CourseCategoryManage,
name: '分类管理'
},
{
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-21 15:53:31
* @LastEditors: yuananting
* @LastEditTime: 2021-03-19 15:31:56
* @LastEditTime: 2021-03-27 11:50:31
* @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -93,7 +93,7 @@ export const menuList: any = [
{
groupName: "课程分类",
groupCode: "CourseCategory",
link: '/question-category-manage'
link: '/course-category-manage'
},
{
groupName: "店铺装修",
......
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