dev_oauth
杨树林 6 years ago
parent 2c94c246e8
commit 8f202a7d5c

@ -67,8 +67,46 @@ class Eduinforms extends Component{
})
};
handleSubmit=()=>{
handleSubmit=(e) => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
console.log(values.description);
if(values.description === undefined|| values.description === "" || values.description ===null){
this.props.showNotification(`请输入提交内容`);
return
}
var id=this.props.match.params.id
var url = `/courses/${id}/update_informs.json`;
axios.post(url,{
description:values.description,
}).then((result) => {
if(result){
if(result.data){
if(result.data.status === 0){
this.setState({
description:values.description,
whethertoedit:false,
})
}else {
this.props.showNotification(result.data.message);
}
}
}
}).catch((error) => {
console.log(error)
})
}else{
console.log(err);
}
});
}
@ -79,13 +117,19 @@ class Eduinforms extends Component{
return(
<React.Fragment >
<div id={"zhudiv"}>
<div className="edu-back-white" style={whethertoedit===false?{heigth:"501px"}:{heigth:"657px"}}>
<div className="edu-back-white">
<p className="clearfix padding30 bor-bottom-greyE">
<p style={{height: '20px'}}>
<span className="font-18 fl color-dark-21">公告栏</span>
<li class="btn colorblue font-16 fr" style={{cursor:"default"}} onClick={()=>this.bianji(true)}>
编辑
</li>
{
this.props.isAdmin()===true?
<li className="btn colorblue font-16 fr" style={{cursor: "default"}}
onClick={() => this.bianji(true)}>
编辑
</li>
:""
}
</p>
</p>
@ -97,13 +141,19 @@ class Eduinforms extends Component{
whethertoedit === false?
<div>
{
description === null || description=== undefined ?
description === null || description=== undefined ||description === "" ?
<div className="alltask ">
<div className="edu-tab-con-box clearfix edu-txt-center"><img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p></div>
</div>
:""
:
<div className="edu-back-white ">
<div id="MakedownHTML" className={"markdown-body fonttext yslmtopcg"} dangerouslySetInnerHTML={{__html: markdownToHTML(description).replace(/▁/g, "▁▁▁")}}>
</div>
</div>
}
</div>
:
@ -132,13 +182,34 @@ class Eduinforms extends Component{
margin-top: 0px !important;
margin-bottom: 0px !important;
padding-left: 0px !important;
}
.chooseDes .ant-form-item-with-help {
margin-bottom: 24px !important;
}
.courseMessageMD .ant-form-item-with-help {
margin-bottom: 24px !important;
}
.chooseDes .editormd-toolbar {
width: 100%;
min-height: 37px;
background: #fff;
display: none;
position: absolute;
left: 0;
z-index: 10;
border-bottom: 1px solid #ddd;
}
.yslmt16px .ant-form-item-with-help
{
margin-bottom: 24px !important;
}
`
}
</style>
<Form.Item
style={{"borderBottom":'none'}}
className="chooseDes pr"
className="chooseDes "
>
{getFieldDecorator('description', {
rules: [{
@ -149,7 +220,7 @@ class Eduinforms extends Component{
})(
<TPMMDEditor ref={this.messageRef}
placeholder={'请在此输入内容,最多5000个字符'}
initValue={this.state.description}
initValue={description}
mdID={'courseMessageMD'}
className="courseMessageMD "
height={518}
@ -161,7 +232,7 @@ class Eduinforms extends Component{
<Form.Item>
<div className="clearfix mt28 fr" style={{display:"block;"}}>
<a className="defalutCancelbtn fl mr20">取消</a>
<a className="defalutCancelbtn fl mr20" onClick={()=>this.bianji(false)}>取消</a>
<Button htmlType="submit" className="ant-btn defalutSubmitbtn fl ant-btn-primary">
<span> </span></Button>
</div>

@ -1,6 +1,13 @@
.yslmt16px{
padding-top: 16px;
padding-left: 25px;
padding-right: 25px;
padding-bottom: 20px;
padding-top: 16px !important;
padding-left: 25px !important;
padding-right: 25px !important;
padding-bottom: 1px !important;
}
.yslmtopcg
{
padding: 25px !important;
}
Loading…
Cancel
Save