diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js new file mode 100644 index 000000000..09fb43a23 --- /dev/null +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -0,0 +1,302 @@ +import React,{ Component } from "react"; +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"; +import moment from "../new/CoursesNew"; +import Fileslistitem from "../Resource/Fileslistitem"; +// 公告栏 +class Bullsubdirectory extends Component{ + constructor(props){ + super(props); + this.messageRef = React.createRef(); + + this.state={ + description:null, + isSpinysl:false, + whethertoeditysl:false, + addonAfter:0, + eduintits:"", + informs:[], + + + } + } + + componentDidMount() { + console.log("获取到数据"); + console.log(this.props); + let{id,myname,mydescription} =this.props + this.props.form.setFieldsValue({ + id:id, + eduintits:myname, + description:mydescription, + }); + this.setState({ + id:id, + eduintits:myname, + description:mydescription, + }) + + } + + + bianji = (bians)=>{ + this.setState({ + whethertoeditysl:bians, + }) + if(bians===true){ + this.props.getyslbooltrue(); + }else { + this.props.getyslboolfalse(); + } + }; + changeTopicName = (e) => { + console.log("调用了changeTopicName"); + let num = parseInt(e.target.value.length); + if(num>60){ + return; + } + this.setState({ + addonAfter: num < 0 ? 0 : num + }); + this.setState({ + eduintits: e.target.value + }) + + this.props.form.setFieldsValue({ + eduintits: e.target.value, + }); + } + handleSubmit=(e) => { + e.preventDefault(); + this.props.form.validateFields((err, values) => { + if (!err) { + console.log(values.description); + if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ + this.props.showNotification(`请输入标题`); + return + + } + if(values.description === undefined|| values.description === "" || values.description ===null){ + this.props.showNotification(`请输入内容`); + return + + } + var id=this.props.match.params.coursesId + + var url = `/courses/${id}/update_informs.json`; + axios.post(url,{ + inform_id:this.state.id, + name:values.eduintits, + description:values.description, + }).then((result) => { + if(result){ + if(result.data){ + if(result.data.status === 0){ + this.props.form.setFieldsValue({ + id:this.state.id, + eduintits:values.eduintits, + description:values.description, + }); + this.setState({ + whethertoeditysl:false, + id:this.state.id, + eduintits:values.eduintits, + description:values.description, + }); + this.props.getinputdata(); + this.props.showNotification(result.data.message); + }else { + this.props.showNotification(result.data.message); + + } + } + + } + }).catch((error) => { + console.log(error) + }) + }else{ + console.log(err); + } + + }); + } + + + render(){ + let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; + let{myname,mydescription}=this.props; + const {getFieldDecorator} = this.props.form; + + return( + +
+ +
+ { + whethertoeditysl === false? +
+
{myname}
+ { + this.props.isAdmin() === true ? + (this.props.yslbool===false? + this.bianji(true)}> + : + "" + ) + + :"" + } +
+
+
+ : +
+
+ + + {getFieldDecorator('eduintits', { + rules: [{ + required: true, message: '请在此输入标题,最多60个字符', + }, { + max: 60, message: '最大限制为60个字符', + }], + })( +
+
+ * +
+
+ +
+ +
+ )} +
+ + +
+
+ + + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请在此输入内容,最多5000个字符', + }, { + max: 5000, message: '最大限制为5000个字符', + }], + })( + + )} + +
+
+ + +
+ this.bianji(false)}>取消 + +
+
+
+
+ } +
+ + +
+ + ) + } +} +const Bullsubdirectorys = Form.create({ name: 'bullsubdirectorys' })(Bullsubdirectory); +export default Bullsubdirectorys; diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js index a50bc0369..d4680f7be 100644 --- a/public/react/src/modules/courses/gradinforms/Eduinforms.js +++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js @@ -4,6 +4,9 @@ import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import './myysleduinforms.css' import axios from 'axios'; import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; +import Bullsubdirectory from "./Bullsubdirectory"; +import moment from "../new/CoursesNew"; +import Fileslistitem from "../Resource/Fileslistitem"; // 公告栏 class Eduinforms extends Component{ constructor(props){ @@ -14,33 +17,57 @@ class Eduinforms extends Component{ description:null, isSpin:true, whethertoedit:false, - + addonAfter:0, + eduintit:"", + informs:[], + yslbool:false, } } componentDidMount() { console.log("获取到数据"); console.log(this.props); - let url = `/courses/${this.props.match.params.coursesId}/informs.json`; + + this.getinputdata(); + } + + getyslbooltrue(){ + console.log("调用了getyslbooltrue"); + this.setState({ + yslbool:true, + }); + } + + getyslboolfalse(){ + console.log("调用了getyslboolfalse"); + this.setState({ + yslbool:false, + }); + } + getinputdata=()=>{ + this.setState({ + isSpin:true, + }) + let url = `/courses/${this.props.match.params.coursesId}/informs.json`; // 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, - - }) - - } + if(response.data){ + this.setState({ + informs:response.data.informs, + isSpin:false, + }) + }else { + this.setState({ + informs:[], + isSpin:false, + + }) + + } }else { this.setState({ - description:null, + informs:[], isSpin:false, }) @@ -48,14 +75,12 @@ class Eduinforms extends Component{ }).catch((error) => { console.log(error) this.setState({ - description:null, + informs:[], isSpin:false, }) }); - } - componentDidUpdate = (prevProps) => { @@ -65,32 +90,60 @@ class Eduinforms extends Component{ this.setState({ whethertoedit:bians, }) + if(bians===true){ + this.getyslbooltrue(); + }else { + this.getyslboolfalse(); + } }; + changeTopicName = (e) => { + console.log("调用了changeTopicName"); + let num = parseInt(e.target.value.length); + if(num>60){ + return; + } + this.setState({ + addonAfter: num < 0 ? 0 : num + }); + this.setState({ + eduintit: e.target.value + }) + this.props.form.setFieldsValue({ + eduintits: e.target.value, + }); + } handleSubmit=(e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { console.log(values.description); + if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ + this.props.showNotification(`请输入标题`); + return + + } if(values.description === undefined|| values.description === "" || values.description ===null){ - this.props.showNotification(`请输入提交内容`); + this.props.showNotification(`请输入内容`); return } var id=this.props.match.params.coursesId - var url = `/courses/${id}/update_informs.json`; + var url = `/courses/${id}/new_informs.json`; axios.post(url,{ + name:values.eduintits, description:values.description, }).then((result) => { if(result){ if(result.data){ if(result.data.status === 0){ this.setState({ - description:values.description, whethertoedit:false, - }) + }); + this.getinputdata(); + this.getyslboolfalse(); this.props.showNotification(result.data.message); }else { this.props.showNotification(result.data.message); @@ -111,7 +164,7 @@ class Eduinforms extends Component{ render(){ - let{description,whethertoedit} =this.state; + let{description,whethertoedit,addonAfter,eduintit,informs,yslbool} =this.state; const {getFieldDecorator} = this.props.form; return( @@ -123,10 +176,13 @@ class Eduinforms extends Component{ 公告栏 { this.props.isAdmin()===true? -
  • this.bianji(true)}> - 编辑 -
  • + (this.state.yslbool===false? +
  • this.bianji(true)}> + 发布公告 +
  • + :"") + :"" } @@ -138,36 +194,73 @@ class Eduinforms extends Component{
    { - whethertoedit === false? -
    - { - description === null || description=== undefined ||description === "" ? -
    -
    -

    暂时还没有相关数据哦!

    -
    - : -
    -
    + whethertoedit === false?"" + : +
    -
    -
    - } -
    - : -
    - -
    -
    + + {getFieldDecorator('eduintits', { + rules: [{ + required: true, message: '请在此输入标题,最多60个字符', + }, { + max: 60, message: '最大限制为60个字符', + }], + })( +
    +
    + * +
    +
    + +
    + +
    + )} +
    + + +
    +
    + - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请在此输入内容,最多5000个字符', - }, { - max: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - -
    -
    + } + + + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请在此输入内容,最多5000个字符', + }, { + max: 5000, message: '最大限制为5000个字符', + }], + })( + + )} + +
    +
    -
    - this.bianji(false)}>取消 - -
    +
    + this.bianji(false)}>取消 + +
    } +
    + { + informs === null || informs=== undefined ||informs.length === 0 ? +
    +
    +

    暂时还没有相关数据哦!

    +
    + : + +
    + { informs&&informs.map((item, index) => { + return ( + this.getyslbooltrue()} + getyslboolfalse={()=>this.getyslboolfalse()} + getinputdata={()=>this.getinputdata()} > + ) + }) + } +
    + } +
    + +
    @@ -257,3 +375,7 @@ class Eduinforms extends Component{ } const Eduinformss = Form.create({ name: 'eduinforms' })(Eduinforms); export default Eduinformss; +{/*
    */} +{/* {item.name===""?"":item.name===undefined?"":item.name===null?"":
    {item.name}
    }*/} +{/*
    */} +{/*
    */} \ No newline at end of file diff --git a/public/react/src/modules/courses/gradinforms/myysleduinforms.css b/public/react/src/modules/courses/gradinforms/myysleduinforms.css index f3fa2fb1a..53211d582 100644 --- a/public/react/src/modules/courses/gradinforms/myysleduinforms.css +++ b/public/react/src/modules/courses/gradinforms/myysleduinforms.css @@ -1,5 +1,5 @@ .yslmt16px{ - padding-top: 25px !important; + padding-top: 12px !important; padding-left: 25px !important; padding-right: 25px !important; padding-bottom: 1px !important; @@ -10,4 +10,65 @@ padding: 25px !important; -} \ No newline at end of file +} + +.bluebkbk{ + border: 1px solid #4CADFF; + width: 79px; + height: 30px; + text-align: center; + line-height: 30px; +} +.ysleduinwh{ + + padding-right: 25px; + margin-top: 26px; + display: flex; + justify-content:flex-start; +} +.yslduincolorred{ + color: red; + line-height: 40px; + height: 40px; + text-align: center; +} +.yslduinleft{ + width: 100% ; +} +.yslduinlefts{ + width: 25px; + line-height: 40px; + height: 40px; + text-align: center; +} +.mtyslduin25{ + margin-top: 25px; +} + +.newbianji1{ + font-size: 16px !important; + margin-right: 10px; + color: #4CACFF; + margin-bottom: 3px; + display: inline-block; +} + +.ysltitbt{ + float: left; + padding-top: 31px; + padding-left: 25px; + font-size: 16px; + color: #333333; + text-align: left; +} +.markdownysltext{ + font-size: 14px; + color: #999999; +} +.fudonyingxiangysl{ + width: 100%; + height: 66px; +} +.yslbianji{ + padding-top: 31px; +}