|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-11-20 10:35:40
|
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
|
* @LastEditTime : 2020-01-06 16:17:22
|
|
|
|
|
* @LastEditTime : 2020-01-07 15:21:19
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
// import 'katex/dist/katex.css';
|
|
|
|
@ -61,6 +61,7 @@ class EditTab extends React.Component {
|
|
|
|
|
top: 500,
|
|
|
|
|
bottom: 20,
|
|
|
|
|
offsetTop: 0,
|
|
|
|
|
showAdd: false
|
|
|
|
|
// knowledges: [],
|
|
|
|
|
// coursers: [] // 选中的课程
|
|
|
|
|
}
|
|
|
|
@ -147,13 +148,15 @@ class EditTab extends React.Component {
|
|
|
|
|
item.sub_disciplines && item.sub_disciplines.forEach(c => {
|
|
|
|
|
if (value[1] && c.id === value[1]) {
|
|
|
|
|
saveKnowledge(c.tag_disciplines)
|
|
|
|
|
console.log(c.tag_disciplines);
|
|
|
|
|
} else if (!value[1]) {
|
|
|
|
|
saveKnowledge([]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.setState({
|
|
|
|
|
showAdd: value[1] ? true : false
|
|
|
|
|
});
|
|
|
|
|
// this.props.validateOjCategory(value[1] || '');
|
|
|
|
|
this.props.validateOjSubDisciplineId(value[1] || '');
|
|
|
|
|
}
|
|
|
|
@ -167,6 +170,7 @@ class EditTab extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|
const { showAdd } = this.state;
|
|
|
|
|
const {
|
|
|
|
|
ojForm,
|
|
|
|
|
ojFormValidate,
|
|
|
|
@ -177,9 +181,10 @@ class EditTab extends React.Component {
|
|
|
|
|
openTestCodeIndex = [],
|
|
|
|
|
courseQuestions,
|
|
|
|
|
tag_discipline_id,
|
|
|
|
|
knowledges
|
|
|
|
|
knowledges,
|
|
|
|
|
tagDisciplines,
|
|
|
|
|
} = this.props;
|
|
|
|
|
console.log('knowledge======>>>>>>', knowledges);
|
|
|
|
|
// console.log('knowledge======>>>>>>', knowledges);
|
|
|
|
|
// const {knowledges} = this.state;
|
|
|
|
|
// 表单label
|
|
|
|
|
const myLabel = (name, subTitle, nostar) => {
|
|
|
|
@ -321,7 +326,7 @@ class EditTab extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log(choid_ids);
|
|
|
|
|
// console.log(choid_ids);
|
|
|
|
|
return (
|
|
|
|
|
<Cascader
|
|
|
|
|
placeholder="请选择"
|
|
|
|
@ -340,10 +345,19 @@ class EditTab extends React.Component {
|
|
|
|
|
values.forEach(v => {
|
|
|
|
|
_result.push(v.id);
|
|
|
|
|
});
|
|
|
|
|
console.log('下拉选择的值:===>>>', _result);
|
|
|
|
|
// console.log('下拉选择的值:===>>>', _result);
|
|
|
|
|
// 保存选择的知识点
|
|
|
|
|
this.props.saveTagDisciplineId(_result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增知识点
|
|
|
|
|
const handleAddKnowledge = (values) => {
|
|
|
|
|
// console.log('调用了新增知识点并返回了结果: ', values);
|
|
|
|
|
// 获取课程id
|
|
|
|
|
const {sub_discipline_id} = this.props.ojForm;
|
|
|
|
|
const obj = Object.assign({}, values, {sub_discipline_id})
|
|
|
|
|
tagDisciplines(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={'editor_area'} id="textCase">
|
|
|
|
@ -383,10 +397,12 @@ class EditTab extends React.Component {
|
|
|
|
|
className='input_area flex_100'
|
|
|
|
|
label={<span>{myLabel(jcLabel['knowledge'], '', 'nostar')}</span>}
|
|
|
|
|
>
|
|
|
|
|
<KnowLedge
|
|
|
|
|
<KnowLedge
|
|
|
|
|
showAdd={showAdd}
|
|
|
|
|
options={knowledges}
|
|
|
|
|
values={tag_discipline_id}
|
|
|
|
|
onChange={handleKnowledgeChange}
|
|
|
|
|
addKnowledge={handleAddKnowledge}
|
|
|
|
|
/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
@ -514,7 +530,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
|
|
addTestCase: (value) => dispatch(actions.addTestCase(value)),
|
|
|
|
|
// 删除测试用例
|
|
|
|
|
deleteTestCase: (value) => dispatch(actions.deleteTestCase(value)),
|
|
|
|
|
saveKnowledge: (value) => dispatch(actions.saveKnowledge(value))
|
|
|
|
|
saveKnowledge: (value) => dispatch(actions.saveKnowledge(value)),
|
|
|
|
|
tagDisciplines: (params) => dispatch(actions.tagDisciplines(params))
|
|
|
|
|
// 获取题库
|
|
|
|
|
// getQuestion: (params) => dispatch(actions.getQuestion(params))
|
|
|
|
|
});
|
|
|
|
|