diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index bc79bdada..dd37c441c 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(
+
{discussMessage.course_groups.map((item,key)=>{ return(
+
- {discussMessage.author.name}
+ {discussMessage.author.login}
大小 {discussMessage.filesize}
下载 {discussMessage.downloads_count}
引用 {discussMessage.quotes}
@@ -220,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()}>:""}*/}
this.onItemClick(item)}
+ className="fl font-16 font-bd mt2 comnonwidth580" style={{cursor: canNotLink ? 'normal' : 'poninter'}}
+ onClick={canNotLink ? () => {} : () => this.onItemClick(item)}
>{item.name}
{/* 只有非课堂成员且作业是私有的情况下才会为true */}
@@ -155,7 +157,7 @@ class CommonWorkItem extends Component{
{title} -
非成员不能访问
-- -
- {/*{item.name.length>32?*/}
- {/*
{item.creator} {item.technical_title}
-
-
-
请选择分班
:""}*/} {/*{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 && -- {/* 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)} 浏览 + :''} + +
+{ChallengesDataList === undefined ? "" :ChallengesDataList.description===null?"": - +
}