diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index 729308852..d1859e135 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -24,25 +24,28 @@ class Bullsubdirectory extends Component{ Modalstopval:"是否确认删除?", ModalCancel:"", ModalSave:"", - + index:0, } + //不能显示数据编辑的时候没有赋值 + //没加initialValue 输入不能赋值到from 上 } componentDidMount() { console.log("获取到数据"); console.log(this.props); - let{id,myname,mydescription} =this.props + let{id,myname,mydescription,index,item} =this.props this.props.form.setFieldsValue({ id:id, - eduintits:myname, - description:mydescription, + eduintits:item.name, + description:item.description, }); + // this.contentMdRef.current.setValue(mydescription); this.setState({ id:id, - eduintits:myname, - description:mydescription, - + eduintits:item.name, + description:item.description, + index:index }) if(myname!=undefined){ this.setState({ @@ -108,10 +111,20 @@ class Bullsubdirectory extends Component{ } - bianji = (bians)=>{ + bianji = (bians,i)=>{ + console.log("bianji"); + console.log(this.props.myname); + console.log(this.props.mydescription); this.setState({ whethertoeditysl:bians, - }) + eduintits:this.props.myname, + description:this.props.mydescription, + index:i + }); + this.props.form.setFieldsValue({ + eduintits:this.props.myname, + description:this.props.mydescription, + }); if(bians===true){ this.props.getyslbooltrue(); }else { @@ -143,6 +156,7 @@ class Bullsubdirectory extends Component{ handleSubmit=(e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { + debugger if (!err) { console.log(values.description); if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ @@ -180,11 +194,11 @@ class Bullsubdirectory extends Component{ if(result){ if(result.data){ if(result.data.status === 0){ - this.props.form.setFieldsValue({ - id:this.state.id, - eduintits:titname, - description:values.description, - }); + // this.props.form.setFieldsValue({ + // id:this.state.id, + // eduintits:titname, + // description:values.description, + // }); this.setState({ whethertoeditysl:false, id:this.state.id, @@ -266,111 +280,118 @@ class Bullsubdirectory extends Component{ render(){ - let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; + let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl,index} =this.state; let{myname,mydescription,id}=this.props; const {getFieldDecorator} = this.props.form; // console.log("Bullsubdirectory"); // console.log(this.props.isAdmin()); - // console.log(this.props); + console.log(this.props); + console.log(whethertoeditysl); + console.log(this.state.eduintits); + console.log(this.state.description); + return( - -
- {this.state.Modalstype&&this.state.Modalstype===true?:""} - -
- { - whethertoeditysl === false? -
-
-
-
- {myname} -
-
+ +
+ {this.state.Modalstype&&this.state.Modalstype===true?:""} + +
+ { + whethertoeditysl === false? +
+
+
+
+ {myname} +
+
{ this.props.isAdmin() === true ? (this.props.yslbool===false? - - 编辑 -
}> - this.bianji(true)}> - + + 编辑 +
}> + this.bianji(true,this.props.index)}> + : "" ) :"" } - + { this.props.isAdmin() === true ? (this.props.yslbool===false? - - 删除 -
}> - this.setModeltrue(true)}> - + + 删除 +
}> + this.setModeltrue(true)}> + : "" ) :"" } - { - this.props.length - 1 === this.props.index ? "" : - this.props.isAdmin() === true ? - (this.props.yslbool === false ? - this.Movedown(this.props.id)} - > - : - "" - ) - : "" - } - { - this.props.index === 0 ? "" : - this.props.isAdmin() === true ? - (this.props.yslbool === false ? - this.Moveupward(this.props.id)} - > - : - "" - ) - : "" - } -
-
-
-
+ { + this.props.length - 1 === this.props.index ? "" : + this.props.isAdmin() === true ? + (this.props.yslbool === false ? + this.Movedown(this.props.id)} + > + : + "" + ) + : "" + } + { + this.props.index === 0 ? "" : + this.props.isAdmin() === true ? + (this.props.yslbool === false ? + this.Moveupward(this.props.id)} + > + : + "" + ) + : "" + }
- {parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":
} +
- : -
-
- - - {getFieldDecorator('eduintits',{ initialValue: this.state.eduintits }, { - rules: [{ - required: true, message: '请在此输入标题,最多60个字符', - }], - })( -
-
- * -
-
- + + {getFieldDecorator('eduintits', { initialValue: eduintits}, { + rules: [{ + required: true, message: '请在此输入标题,最多60个字符', + }], + })( +
+
+ * +
+
+ - -
- + } +
- )} -
+
+ )} + -
-
- - - {getFieldDecorator('description', { initialValue: this.state.description },{ - rules: [{ - required: true, message: '请在此输入内容,最多5000个字符', - }, { - len: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - -
-
+ } + + + {getFieldDecorator('description', { initialValue: description},{ + rules: [{ + required: true, message: '请在此输入内容,最多5000个字符', + }, { + len: 5000, message: '最大限制为5000个字符', + }], + })( + + + + )} + - -
- this.bianji(false)}>取消 - -
-
- -
-
- } -
- +
+
-
+ + + + +
+
+ :"" + } +
+ + +
) } diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js index 4cb42eff9..5acfeb4fe 100644 --- a/public/react/src/modules/courses/gradinforms/Eduinforms.js +++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js @@ -497,6 +497,7 @@ class Eduinforms extends Component{ this.getyslbooltrue()} getyslboolfalse={()=>this.getyslboolfalse()} getinputdata={()=>this.getinputdata()} >