From 08a21cb577a1685b384cb5cd4671cf5c402162d8 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 7 Sep 2019 14:10:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E6=88=90=E5=91=98=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/searchable/course.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/searchable/course.rb b/app/models/searchable/course.rb index 5060d9ddd..794dec0e2 100644 --- a/app/models/searchable/course.rb +++ b/app/models/searchable/course.rb @@ -24,7 +24,7 @@ module Searchable::Course author_name: teacher&.real_name, author_school_name: teacher&.school_name, visits_count: visits, - members_count: members_count, + members_count: course_members_count, is_public: is_public == 1, first_category_url: ApplicationController.helpers.module_url(none_hidden_course_modules.first, self) } From baa1e581fb37f755f36b2e6e287a9bc7d97d8357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 7 Sep 2019 14:17:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/gradinforms/Bullsubdirectory.js | 85 ++++++++++++++++++- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index bc45eeece..d7a07f4d8 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -6,6 +6,7 @@ import axios from 'axios'; import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; import moment from "../new/CoursesNew"; import Fileslistitem from "../Resource/Fileslistitem"; +import Modals from "../../modals/Modals"; // 公告栏 class Bullsubdirectory extends Component{ constructor(props){ @@ -19,6 +20,10 @@ class Bullsubdirectory extends Component{ addonAfter:0, eduintits:"", informs:[], + Modalstype:false, + Modalstopval:"是否确认删除?", + ModalCancel:"", + ModalSave:"", } @@ -47,6 +52,61 @@ class Bullsubdirectory extends Component{ } + setModeltrue=()=>{ + this.setState({ + Modalstype:true, + Modalstopval:"是否确认删除?", + ModalCancel:this.cancelmodel, + ModalSave:this.saveonOpen, + }) + } + + cancelmodel=()=>{ + //取消 + this.setState({ + Modalstype:false, + Modalstopval:"是否确认删除?", + ModalCancel:"", + ModalSave:"", + }) + } + + saveonOpen=()=>{ + //确认 + // / + // 删除公告 + var id=this.props.match.params.coursesId + const url =`/courses/${id}/delete_informs.json`; + axios.delete(url, { data: { + inform_id: this.props.id + }}) + .then((response) => { + if(response){ + if(response.data){ + if(response.data.status===0){ + this.setState({ + Modalstype:false, + Modalstopval:"是否确认删除?", + ModalCancel:"", + ModalSave:"", + }) + this.props.showNotification(`删除成功`); + this.props.getinputdata(); + }else{ + this.props.showNotification(`删除失败`); + } + }else{ + this.props.showNotification(`删除失败`); + } + } + + }) + .catch(function (error) { + console.log(error); + this.props.showNotification(`删除失败`); + }); + } + bianji = (bians)=>{ this.setState({ @@ -154,12 +214,18 @@ class Bullsubdirectory extends Component{ render(){ let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; - let{myname,mydescription}=this.props; + let{myname,mydescription,id}=this.props; const {getFieldDecorator} = this.props.form; return(
+ {this.state.Modalstype&&this.state.Modalstype===true?:""}
{ @@ -171,16 +237,29 @@ class Bullsubdirectory extends Component{ {myname}
- + { - this.props.isAdmin() === true ? + this.props.isClassManagement() === true ? (this.props.yslbool===false? + this.bianji(true)}> : "" ) :"" } + + + { + this.props.isClassManagement() === true ? + (this.props.yslbool===false? + + this.setModeltrue(true)}> + : + "" + ) + :"" + }