From 1e99acc02c1c5302d5cd647fdd86754fad318779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 20 Jun 2019 19:28:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 83 ++++++++++++++++++- .../src/modules/courses/Resource/index.js | 19 +++-- .../courses/coursesPublic/SelectResource.js | 1 + .../courses/coursesPublic/SelectSetting.js | 9 +- .../courses/coursesPublic/sendResource.js | 2 +- .../courses/exercise/ExerciseListItem.js | 50 ++++++----- .../graduation/tasks/GraduateTaskItem.js | 12 ++- 7 files changed, 142 insertions(+), 34 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index bc79bdada..cc6304481 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -8,6 +8,7 @@ import {getUrl} from 'educoder'; import moment from 'moment'; import CoursesListType from '../coursesPublic/CoursesListType'; import Showoldfiles from "../coursesPublic/Showoldfiles"; +import Modals from '../../modals/Modals'; class Fileslistitem extends Component{ constructor(props){ @@ -74,7 +75,68 @@ class Fileslistitem extends Component{ Showoldfiles:false, }) } - render(){ + + onDelete = (id) => { + + this.setState({ + Modalstype:true, + Modalstopval:"是否确认删除?", + ModalCancel:this.cancelmodel, + ModalSave:()=>this.savedelete(id), + }) + + } + + cancelmodel=()=>{ + + this.setState({ + Modalstype:false, + Loadtype:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + checkBoxValues:[], + }) + + } + + savedelete=(id)=>{ + + this.setState({ + Modalstype:false, + }) + + + const cid = this.props.match.params.coursesId + const url = `/files/bulk_delete.json`; + axios.delete(url, { data: { + course_id:cid, + ids: [id], + }}) + .then((response) => { + if (response.data.status == 0) { + //Modalstopval:response.data.message, + + this.props.updatafiledfun() + this.setState({ + // Modalstype:true, + // Modalstopval:"删除成功", + ModalsBottomval:"", + // ModalSave:this.cancelmodel, + // Loadtype:true, + checkBoxValues:[], + checkAllValue:false + }) + + this.props.showNotification("删除成功"); + } + }) + .catch(function (error) { + console.log(error); + }); + } + + render(){ const { checkBox, discussMessage, @@ -84,6 +146,16 @@ class Fileslistitem extends Component{ return(
请选择分班
:""}*/} {/*{course_group_publish_timestype===true?请填写完整
:""}*/} - - {descriptiontype===true?描述不能超过最大限制:100个字符
:""} + {descriptiontype===true?请输入资源描述,最大限制100个字符
:""}+
{/*{item.exercise_name}*/} { @@ -132,7 +135,7 @@ class ExerciseListItem extends Component{ {/**/} {/**/}
-+
{item.exercise_status===1?"":{item.exercise_answer} 已答} {item.exercise_status===1?"":{item.exercise_unanswer} 未答} {item.unreview_count===null||item.exercise_status===1?"":{item.unreview_count} 未评数 } @@ -161,23 +164,32 @@ class ExerciseListItem extends Component{ {/*item.exercise_status ==2?"":*/} {/* 发布于{moment(item.exercise_left_time).fromNow()} */} {/*}*/} -
- { - IsAdmin && -+
{discussMessage.course_groups.map((item,key)=>{ return(
+
- {discussMessage.author.name}
+ {discussMessage.author.login}
大小 {discussMessage.filesize}
下载 {discussMessage.downloads_count}
引用 {discussMessage.quotes}
@@ -299,15 +289,31 @@ class Fileslistitem extends Component{
{ discussMessage.publish_time===null?"":discussMessage.is_publish===true?moment(discussMessage.publish_time).fromNow():moment(discussMessage.publish_time).format('YYYY-MM-DD hh:mm')}
+ {this.props.isAdmin ||this.props.current_user.login===discussMessage.author.login?
+
+
+
- 资源描述 :
- {discussMessage.description}
- {this.props.isAdmin ?this.settingList()}>:""}
+ {/**/}
+
+ 资源描述 :{discussMessage.description===null?"暂无描述":discussMessage.description}
+
+ {/*{this.props.isAdmin ?this.settingList()}>:""}*/}
非成员不能访问
-- -
- {/*{item.name.length>32?*/}
- {/*
{item.creator} {item.technical_title}
-
-
-
- {/* target="_blank" */} - - {memo.subject} - - - { memo.sticky && 置顶 } - - { memo.reward && - - {memo.reward} - - } -
- -- {/* data-tip-down="回复数" {memo.replies_count} - {memo.praise_count}*/} - {memo.replies_count ? - - {memo.replies_count} 回复 - :''} - - {memo.praise_count ? - - {memo.praise_count} 赞 - :''} - - {memo.viewed_count ? - - {this._toTenThousand(memo.viewed_count)} 浏览 - :''} - -
-+ {/* target="_blank" */} + + {memo.subject} + + + { memo.sticky && 置顶 } + + { memo.reward && + + {memo.reward} + + } +
+ ++ {/* data-tip-down="回复数" {memo.replies_count} + {memo.praise_count}*/} + {memo.replies_count ? + + {memo.replies_count} 回复 + :''} + + {memo.praise_count ? + + {memo.praise_count} 赞 + :''} + + {memo.viewed_count ? + + {this._toTenThousand(memo.viewed_count)} 浏览 + :''} + +
+