|
|
|
@ -1,14 +1,10 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Author: tangjiang
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-11-20 10:35:40
|
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
* @LastEditTime : 2020-01-03 17:35:45
|
|
|
|
|
=======
|
|
|
|
|
* @LastEditTime : 2020-01-03 19:02:17
|
|
|
|
|
>>>>>>> dev_aliyun
|
|
|
|
|
* @LastEditTime : 2020-01-06 16:17:22
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
// import 'katex/dist/katex.css';
|
|
|
|
@ -79,7 +75,7 @@ class EditTab extends React.Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
scrollEl: oWrap,
|
|
|
|
|
targetEl: oTarget,
|
|
|
|
|
offsetTop: offsetTop, // 记录初始位置
|
|
|
|
|
offsetTop: offsetTop, // 记录初始位置
|
|
|
|
|
scrollHeight,
|
|
|
|
|
}, () => {
|
|
|
|
|
this.state.scrollEl.addEventListener('scroll', this.handleScroll, false);
|
|
|
|
@ -93,7 +89,7 @@ class EditTab extends React.Component {
|
|
|
|
|
// componentDidUpdate (nextProp) {
|
|
|
|
|
// console.log(nextProp);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount (nextPro) {
|
|
|
|
|
this.state.scrollEl.removeEventListener('scroll', this.handleScroll, false);
|
|
|
|
|
}
|
|
|
|
@ -116,7 +112,7 @@ class EditTab extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 改变任务名称
|
|
|
|
|
// 改变任务名称
|
|
|
|
|
handleNameChange = (e) => {
|
|
|
|
|
const value = e.target.value;
|
|
|
|
|
this.props.validateOJName(value);
|
|
|
|
@ -171,8 +167,8 @@ class EditTab extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|
const {
|
|
|
|
|
ojForm,
|
|
|
|
|
const {
|
|
|
|
|
ojForm,
|
|
|
|
|
ojFormValidate,
|
|
|
|
|
// testCases = [], // 测试用例集合
|
|
|
|
|
addTestCase, // 添加测试用例
|
|
|
|
@ -183,10 +179,9 @@ class EditTab extends React.Component {
|
|
|
|
|
tag_discipline_id,
|
|
|
|
|
knowledges
|
|
|
|
|
} = this.props;
|
|
|
|
|
// console.log('knowledge======>>>>>>', knowledges);
|
|
|
|
|
console.log('knowledge======>>>>>>', knowledges);
|
|
|
|
|
// const {knowledges} = this.state;
|
|
|
|
|
// 表单label
|
|
|
|
|
// console.log('props=====>>>>', this.props);
|
|
|
|
|
const myLabel = (name, subTitle, nostar) => {
|
|
|
|
|
if (subTitle) {
|
|
|
|
|
return (
|
|
|
|
@ -225,8 +220,8 @@ class EditTab extends React.Component {
|
|
|
|
|
return <AddTestDemo
|
|
|
|
|
key={`${i}`}
|
|
|
|
|
isOpen={openTestCodeIndex.includes(i)}
|
|
|
|
|
onSubmitTest={handleSubmitTest}
|
|
|
|
|
onDeleteTest={handleDeleteTest}
|
|
|
|
|
onSubmitTest={handleSubmitTest}
|
|
|
|
|
onDeleteTest={handleDeleteTest}
|
|
|
|
|
testCase={item}
|
|
|
|
|
testCaseValidate={testCasesValidate[i]}
|
|
|
|
|
index={i}
|
|
|
|
@ -282,10 +277,10 @@ class EditTab extends React.Component {
|
|
|
|
|
const quillConfig = [
|
|
|
|
|
{ header: 1}, {header: 2},
|
|
|
|
|
// {size: ['12px', '14px', '16px', '18px', '20px', false]},
|
|
|
|
|
'bold', 'italic', 'underline', 'strike', // 切换按钮
|
|
|
|
|
'bold', 'italic', 'underline', 'strike', // 切换按钮
|
|
|
|
|
'blockquote', 'code-block', // 代码块
|
|
|
|
|
{align: []}, { 'list': 'ordered' }, { 'list': 'bullet' }, // 列表
|
|
|
|
|
{ 'script': 'sub'}, { 'script': 'super' },
|
|
|
|
|
{ 'script': 'sub'}, { 'script': 'super' },
|
|
|
|
|
{ 'color': [] }, { 'background': [] }, // 字体颜色与背景色
|
|
|
|
|
// {font: []},
|
|
|
|
|
'image', 'formula', // 数学公式、图片、视频
|
|
|
|
@ -310,7 +305,7 @@ class EditTab extends React.Component {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
loop(arrs, tempArr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取选中的下拉值
|
|
|
|
|
let choid_ids = [];
|
|
|
|
|
// let tempKnowledges = [];
|
|
|
|
@ -325,10 +320,10 @@ class EditTab extends React.Component {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(choid_ids);
|
|
|
|
|
return (
|
|
|
|
|
<Cascader
|
|
|
|
|
<Cascader
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
options={tempArr}
|
|
|
|
|
expandTrigger="hover"
|
|
|
|
@ -338,7 +333,7 @@ class EditTab extends React.Component {
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 知识点
|
|
|
|
|
const handleKnowledgeChange = (values= []) => {
|
|
|
|
|
const _result = [];
|
|
|
|
@ -349,11 +344,11 @@ class EditTab extends React.Component {
|
|
|
|
|
// 保存选择的知识点
|
|
|
|
|
this.props.saveTagDisciplineId(_result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={'editor_area'} id="textCase">
|
|
|
|
|
<Form className={'editor_form'}>
|
|
|
|
|
<FormItem
|
|
|
|
|
<FormItem
|
|
|
|
|
className={`input_area flex_50 flex_50_left`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['difficult'])}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.difficult.validateStatus}
|
|
|
|
@ -365,7 +360,7 @@ class EditTab extends React.Component {
|
|
|
|
|
</Select>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
<FormItem
|
|
|
|
|
className={`input_area flex_50 flex_50_right`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['sub_discipline_id'], '合理的课程分类有利于快速检索')}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.sub_discipline_id.validateStatus}
|
|
|
|
@ -375,7 +370,7 @@ class EditTab extends React.Component {
|
|
|
|
|
{/* <Select onChange={this.handleChangeCategory} value={`${ojForm.category}`}>
|
|
|
|
|
{getOptions('category')}
|
|
|
|
|
</Select> */}
|
|
|
|
|
{/* <Cascader
|
|
|
|
|
{/* <Cascader
|
|
|
|
|
options={courseQuestions}
|
|
|
|
|
expandTrigger="hover"
|
|
|
|
|
onChange={this.handleChangeCategory}
|
|
|
|
@ -388,14 +383,14 @@ class EditTab extends React.Component {
|
|
|
|
|
className='input_area flex_100'
|
|
|
|
|
label={<span>{myLabel(jcLabel['knowledge'], '', 'nostar')}</span>}
|
|
|
|
|
>
|
|
|
|
|
<KnowLedge
|
|
|
|
|
<KnowLedge
|
|
|
|
|
options={knowledges}
|
|
|
|
|
values={tag_discipline_id}
|
|
|
|
|
onChange={handleKnowledgeChange}
|
|
|
|
|
/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
className={`input_area flex_50 flex_50_left`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['timeLimit'], '程序允许时间限制时长,单位:秒')}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.timeLimit.validateStatus}
|
|
|
|
@ -405,7 +400,7 @@ class EditTab extends React.Component {
|
|
|
|
|
<InputNumber value={ojForm.timeLimit} min={0} max={5} style={{ width: '100%' }} onChange={this.handleTimeLimitChange}/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
<FormItem
|
|
|
|
|
className={`input_area flex_50 flex_50_right`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['language'])}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.language.validateStatus}
|
|
|
|
@ -417,7 +412,7 @@ class EditTab extends React.Component {
|
|
|
|
|
</Select>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
<FormItem
|
|
|
|
|
className={`input_area flex_100`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['name'])}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.name.validateStatus}
|
|
|
|
@ -432,24 +427,24 @@ class EditTab extends React.Component {
|
|
|
|
|
onChange={this.handleNameChange}
|
|
|
|
|
/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
|
|
|
|
|
<FormItem
|
|
|
|
|
className={`input_area flex_100`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['description'])}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.description.validateStatus}
|
|
|
|
|
help={ojFormValidate.description.errMsg}
|
|
|
|
|
colon={ false }
|
|
|
|
|
>
|
|
|
|
|
<QuillForEditor
|
|
|
|
|
<QuillForEditor
|
|
|
|
|
style={{ height: '200px' }}
|
|
|
|
|
placeholder="请输入描述信息"
|
|
|
|
|
placeholder="请输入描述信息"
|
|
|
|
|
onContentChange={handleContentChange}
|
|
|
|
|
options={quillConfig}
|
|
|
|
|
value={ojForm.description}
|
|
|
|
|
/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
{/* <FormItem
|
|
|
|
|
|
|
|
|
|
{/* <FormItem
|
|
|
|
|
className={`input_area flex_50 flex_50_right`}
|
|
|
|
|
label={<span>{myLabel(jcLabel['openOrNot'], '社区:您的任务将向整个社会公开')}</span>}
|
|
|
|
|
validateStatus={ojFormValidate.openOrNot.validateStatus}
|
|
|
|
@ -460,9 +455,9 @@ class EditTab extends React.Component {
|
|
|
|
|
{getOptions('openOrNot')}
|
|
|
|
|
</Select>
|
|
|
|
|
</FormItem> */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* 添加测试用例 */}
|
|
|
|
|
<div className={'test_demo_title'} ref={this.headerRef}>
|
|
|
|
|
<h2>测试用例</h2>
|
|
|
|
@ -481,11 +476,11 @@ class EditTab extends React.Component {
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
|
const ojFormReducer = state.ojFormReducer;
|
|
|
|
|
const {
|
|
|
|
|
ojForm,
|
|
|
|
|
position,
|
|
|
|
|
testCases,
|
|
|
|
|
ojForm,
|
|
|
|
|
position,
|
|
|
|
|
testCases,
|
|
|
|
|
openTestCodeIndex,
|
|
|
|
|
testCasesValidate,
|
|
|
|
|
testCasesValidate,
|
|
|
|
|
ojFormValidate,
|
|
|
|
|
courseQuestions,
|
|
|
|
|
tag_discipline_id,
|
|
|
|
|