dev_oauth
杨树林 6 years ago
parent 38b72f0d70
commit cd3aecc8f1

@ -1,13 +1,19 @@
import React,{ Component } from "react";
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin } from "antd";
import { WordsBtn,on, off, trigger } from 'educoder';
import '../css/members.css';
import '../css/busyWork.css'
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form } from "antd";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder';
import './myysleduinforms.css'
import axios from 'axios';
import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor";
class Eduinforms extends Component{
constructor(props){
super(props);
this.messageRef = React.createRef();
this.state={
description:null,
isSpin:true,
whethertoedit:false,
}
}
@ -15,15 +21,37 @@ class Eduinforms extends Component{
componentDidMount() {
console.log("获取到数据");
console.log(this.props);
// let url = "/courses/:id/informs.json";
//
// axios.get(url).then((response) => {
// if(response){
let url = `/courses/${this.props.match.params.id}/informs.json`;
//
// }
// }).catch((error) => {
// console.log(error)
// });
axios.get(url).then((response) => {
if(response){
if(response.data){
this.setState({
description:response.data.description,
isSpin:false,
})
}else {
this.setState({
description:null,
isSpin:false,
})
}
}else {
this.setState({
description:null,
isSpin:false,
})
}
}).catch((error) => {
console.log(error)
this.setState({
description:null,
isSpin:false,
})
});
}
@ -33,35 +61,123 @@ class Eduinforms extends Component{
}
bianji = (bians)=>{
this.setState({
whethertoedit:bians,
})
};
handleSubmit=()=>{
}
render(){
let{description,whethertoedit} =this.state;
const {getFieldDecorator} = this.props.form;
return(
<React.Fragment >
<div>
<div className="edu-back-white">
<div id={"zhudiv"}>
<div className="edu-back-white" style={whethertoedit===false?{heigth:"501px"}:{heigth:"657px"}}>
<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">
<li class="btn colorblue font-16 fr" style={{cursor:"default"}} onClick={()=>this.bianji(true)}>
编辑
</li>
</p>
</p>
</div>
{/*<Spin size="large" spinning={this.state.isSpin}>*/}
{/*</Spin>*/}
<Spin size="large" spinning={this.state.isSpin} id={"cdiv"}>
<div id={"cdiv1"}>
{
whethertoedit === false?
<div>
{
description === null || description=== undefined ?
<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>
:
<div>
<Form layout='vertical' onSubmit={this.handleSubmit} >
<div className="edu-back-white ">
<div className={"yslmt16px"}>
<style>
{
`
.ant-form-item-children {
position: unset;
}
.rememberTip{
position:absolute;
right:0px;
bottom:-10px;
}
.chooseDes .ant-form-explain{
position:absolute;
bottom:-10px;
left:0px;
}
`
}
</style>
<Form.Item
style={{"borderBottom":'none'}}
className="chooseDes pr"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请在此输入内容,最多5000个字符',
}, {
max: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.messageRef}
placeholder={'请在此输入内容,最多5000个字符'}
initValue={this.state.description}
mdID={'courseMessageMD'}
className="courseMessageMD "
height={518}
></TPMMDEditor>
)}
</Form.Item>
</div>
</div>
<Form.Item>
<div className="clearfix mt28 fr" style={{display:"block;"}}>
<a className="defalutCancelbtn fl mr20">取消</a>
<Button htmlType="submit" className="ant-btn defalutSubmitbtn fl ant-btn-primary">
<span> </span></Button>
</div>
</Form.Item>
</Form>
</div>
}
</div>
</Spin>
</div>
</React.Fragment>
)
}
}
export default Eduinforms;
const Eduinformss = Form.create({ name: 'eduinforms' })(Eduinforms);
export default Eduinformss;

@ -0,0 +1,6 @@
.yslmt16px{
padding-top: 16px;
padding-left: 25px;
padding-right: 25px;
padding-bottom: 50px;
}
Loading…
Cancel
Save