|
|
@ -4,12 +4,12 @@
|
|
|
|
* @Github:
|
|
|
|
* @Github:
|
|
|
|
* @Date: 2019-11-20 10:35:40
|
|
|
|
* @Date: 2019-11-20 10:35:40
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditTime : 2019-12-27 14:30:55
|
|
|
|
* @LastEditTime : 2019-12-30 11:05:14
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import './index.scss';
|
|
|
|
import './index.scss';
|
|
|
|
// import 'katex/dist/katex.css';
|
|
|
|
// import 'katex/dist/katex.css';
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import { Form, Input, Select, InputNumber, Button } from 'antd';
|
|
|
|
import { Form, Input, Select, InputNumber, Button, Cascader } from 'antd';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import AddTestDemo from './AddTestDemo';
|
|
|
|
import AddTestDemo from './AddTestDemo';
|
|
|
|
// import QuillEditor from '../../../quillEditor';
|
|
|
|
// import QuillEditor from '../../../quillEditor';
|
|
|
@ -77,6 +77,10 @@ class EditTab extends React.Component {
|
|
|
|
}, () => {
|
|
|
|
}, () => {
|
|
|
|
this.state.scrollEl.addEventListener('scroll', this.handleScroll, false);
|
|
|
|
this.state.scrollEl.addEventListener('scroll', this.handleScroll, false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 获取题库
|
|
|
|
|
|
|
|
this.props.getQuestion({
|
|
|
|
|
|
|
|
source: 'question'
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount () {
|
|
|
|
componentWillUnmount () {
|
|
|
@ -127,7 +131,8 @@ class EditTab extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 改变分类
|
|
|
|
// 改变分类
|
|
|
|
handleChangeCategory = (value) => {
|
|
|
|
handleChangeCategory = (value) => {
|
|
|
|
this.props.validateOjCategory(value);
|
|
|
|
console.log(value);
|
|
|
|
|
|
|
|
// this.props.validateOjCategory(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 改变公开程序
|
|
|
|
// 改变公开程序
|
|
|
|
handleChangeOpenOrNot = (value) => {
|
|
|
|
handleChangeOpenOrNot = (value) => {
|
|
|
@ -146,7 +151,8 @@ class EditTab extends React.Component {
|
|
|
|
addTestCase, // 添加测试用例
|
|
|
|
addTestCase, // 添加测试用例
|
|
|
|
deleteTestCase, // 删除测试用例
|
|
|
|
deleteTestCase, // 删除测试用例
|
|
|
|
testCasesValidate,
|
|
|
|
testCasesValidate,
|
|
|
|
openTestCodeIndex = []
|
|
|
|
openTestCodeIndex = [],
|
|
|
|
|
|
|
|
courseQuestions
|
|
|
|
} = this.props;
|
|
|
|
} = this.props;
|
|
|
|
// 表单label
|
|
|
|
// 表单label
|
|
|
|
const myLabel = (name, subTitle) => {
|
|
|
|
const myLabel = (name, subTitle) => {
|
|
|
@ -244,6 +250,59 @@ class EditTab extends React.Component {
|
|
|
|
['image', 'formula'], // 数学公式、图片、视频
|
|
|
|
['image', 'formula'], // 数学公式、图片、视频
|
|
|
|
['clean'], // 清除格式
|
|
|
|
['clean'], // 清除格式
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const renderCourseQuestion = (arrs) => {
|
|
|
|
|
|
|
|
const tempArr = [];
|
|
|
|
|
|
|
|
function loop (arrs, tempArr) {
|
|
|
|
|
|
|
|
arrs.forEach(item => {
|
|
|
|
|
|
|
|
const obj = {};
|
|
|
|
|
|
|
|
obj.value = item.id;
|
|
|
|
|
|
|
|
obj.label = item.name;
|
|
|
|
|
|
|
|
// 当item下还有子元素时,递归调用
|
|
|
|
|
|
|
|
if (item.sub_disciplines || item.tag_disciplines) {
|
|
|
|
|
|
|
|
arrs = item.sub_disciplines || item.tag_disciplines;
|
|
|
|
|
|
|
|
obj.children = [];
|
|
|
|
|
|
|
|
loop(arrs, obj.children);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tempArr.push(obj);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
loop(arrs, tempArr);
|
|
|
|
|
|
|
|
// arrs.forEach(item => {
|
|
|
|
|
|
|
|
// const obj = Object.create(null);
|
|
|
|
|
|
|
|
// obj.value = item.id;
|
|
|
|
|
|
|
|
// obj.label = item.name;
|
|
|
|
|
|
|
|
// if (item.sub_disciplines) {
|
|
|
|
|
|
|
|
// obj.children = [];
|
|
|
|
|
|
|
|
// item.sub_disciplines.forEach(sub => {
|
|
|
|
|
|
|
|
// const subObj = Object.create(null);
|
|
|
|
|
|
|
|
// subObj.value = sub.id;
|
|
|
|
|
|
|
|
// subObj.label = sub.name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (sub.tag_disciplines) {
|
|
|
|
|
|
|
|
// subObj.children = [];
|
|
|
|
|
|
|
|
// sub.tag_disciplines.forEach(tag => {
|
|
|
|
|
|
|
|
// const tabObj = Object.create(null);
|
|
|
|
|
|
|
|
// tabObj.value = tag.id;
|
|
|
|
|
|
|
|
// tabObj.label = tag.name;
|
|
|
|
|
|
|
|
// subObj.children.push(tabObj);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// obj.children.push(subObj);
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// tempArr.push(obj);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
console.log(tempArr);
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Cascader
|
|
|
|
|
|
|
|
options={tempArr}
|
|
|
|
|
|
|
|
value={[1,1,1]}
|
|
|
|
|
|
|
|
expandTrigger="hover"
|
|
|
|
|
|
|
|
onChange={this.handleChangeCategory}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={'editor_area'} id="textCase">
|
|
|
|
<div className={'editor_area'} id="textCase">
|
|
|
@ -262,14 +321,24 @@ class EditTab extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
<FormItem
|
|
|
|
className={`input_area flex_50 flex_50_right`}
|
|
|
|
className={`input_area flex_50 flex_50_right`}
|
|
|
|
label={<span>{myLabel(jcLabel['category'], '合理的分类有利于快速检索')}</span>}
|
|
|
|
label={<span>{myLabel(jcLabel['category'], '合理的课程分类有利于快速检索')}</span>}
|
|
|
|
validateStatus={ojFormValidate.category.validateStatus}
|
|
|
|
validateStatus={ojFormValidate.category.validateStatus}
|
|
|
|
help={ojFormValidate.category.errMsg}
|
|
|
|
help={ojFormValidate.category.errMsg}
|
|
|
|
colon={ false }
|
|
|
|
colon={ false }
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Select onChange={this.handleChangeCategory} value={`${ojForm.category}`}>
|
|
|
|
{/* <Select onChange={this.handleChangeCategory} value={`${ojForm.category}`}>
|
|
|
|
{getOptions('category')}
|
|
|
|
{getOptions('category')}
|
|
|
|
</Select>
|
|
|
|
</Select> */}
|
|
|
|
|
|
|
|
{/* <Cascader
|
|
|
|
|
|
|
|
options={courseQuestions}
|
|
|
|
|
|
|
|
expandTrigger="hover"
|
|
|
|
|
|
|
|
onChange={this.handleChangeCategory}
|
|
|
|
|
|
|
|
/> */}
|
|
|
|
|
|
|
|
{ renderCourseQuestion(courseQuestions)}
|
|
|
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<FormItem>
|
|
|
|
|
|
|
|
|
|
|
|
</FormItem>
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
<FormItem
|
|
|
@ -366,14 +435,17 @@ const mapStateToProps = (state) => {
|
|
|
|
testCases,
|
|
|
|
testCases,
|
|
|
|
openTestCodeIndex,
|
|
|
|
openTestCodeIndex,
|
|
|
|
testCasesValidate,
|
|
|
|
testCasesValidate,
|
|
|
|
ojFormValidate} = ojFormReducer;
|
|
|
|
ojFormValidate,
|
|
|
|
|
|
|
|
courseQuestions
|
|
|
|
|
|
|
|
} = ojFormReducer;
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
ojForm,
|
|
|
|
ojForm,
|
|
|
|
testCases,
|
|
|
|
testCases,
|
|
|
|
testCasesValidate,
|
|
|
|
testCasesValidate,
|
|
|
|
ojFormValidate,
|
|
|
|
ojFormValidate,
|
|
|
|
position,
|
|
|
|
position,
|
|
|
|
openTestCodeIndex
|
|
|
|
openTestCodeIndex,
|
|
|
|
|
|
|
|
courseQuestions
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -390,6 +462,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
|
addTestCase: (value) => dispatch(actions.addTestCase(value)),
|
|
|
|
addTestCase: (value) => dispatch(actions.addTestCase(value)),
|
|
|
|
// 删除测试用例
|
|
|
|
// 删除测试用例
|
|
|
|
deleteTestCase: (value) => dispatch(actions.deleteTestCase(value)),
|
|
|
|
deleteTestCase: (value) => dispatch(actions.deleteTestCase(value)),
|
|
|
|
|
|
|
|
// 获取题库
|
|
|
|
|
|
|
|
getQuestion: (params) => dispatch(actions.getQuestion(params))
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
export default connect(
|
|
|
|