problem_set
杨树明 5 years ago
parent 2e018f16f8
commit 64d0280e73

@ -34,8 +34,10 @@ class PublishRightnow extends Component{
homeworkstart=()=>{
const isPublish = this.props.isPublish;
let showdatatypes=isPublish===true||isPublish===1;
if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) {
this.props.showNotification(`请先选择要立即${isPublish ? "发布" : "截止"}的作业`)
this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`)
return;
}
@ -46,25 +48,26 @@ class PublishRightnow extends Component{
showDialog = () => {
const isPublish = this.props.isPublish;
const dateFormat = 'YYYY-MM-DD HH:mm';
let showdatatype=isPublish===true&&isPublish!=1;
let showdatatypes=isPublish===true||isPublish===1;
// getNextHalfHourOfMoment
const startMoment = (moment());
this.setState({
modalname: isPublish ? "立即发布" : "立即截止",
modalname: showdatatypes ? "立即发布" : "立即截止",
modaltype:1,
visible:isPublish?false:true,
OneSelftype:isPublish?true:false,
Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品",
visible:showdatatype?false:true,
OneSelftype:showdatatype?true:false,
Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品",
// Botvalleft: isPublish ? "暂不发布" : "暂不截止",
Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '',
endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
Cancelname:isPublish ? "暂不发布" : "暂不截止",
Savesname:isPublish ? "立即发布" : "立即截止",
Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '',
endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
Cancelname:showdatatypes ? "暂不发布" : "暂不截止",
Savesname:showdatatypes ? "立即发布" : "立即截止",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
typs:isPublish ? "start" : "end",
typs:showdatatypes ? "start" : "end",
})
}
homeworkhide=()=>{
@ -125,13 +128,14 @@ class PublishRightnow extends Component{
}
}
let showdatatypes=isPublish===true||isPublish===1;
let coursesId=this.props.match.params.coursesId;
const url = `/courses/${coursesId}/homework_commons/${isPublish ? "publish_homework" : "end_homework"}.json`
const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json`
axios.post(url, data)
.then((response) => {
if (response.data.status == 0) {
this.homeworkhide()
this.props.showNotification(isPublish ? "立即发布成功" : "立即截止成功")
this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功")
this.props.doWhenSuccess && this.props.doWhenSuccess()
this.setState({ visible : false })
this.props.action && this.props.action()
@ -147,13 +151,15 @@ class PublishRightnow extends Component{
// }
// }
fetchCourseGroups = () => {
const isPublish = this.props.isPublish;
let showdatatypes=isPublish===true||isPublish===1;
let coursesId=this.props.match.params.coursesId;
// TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668
// /homework_commons/:id/publish_groups.json
let url = `/courses/${coursesId}/all_course_groups.json`
if (this.props.checkBoxValues.length == 1) {
const isPublish = this.props.isPublish;
url = `/homework_commons/${this.props.checkBoxValues[0]}/${ isPublish ? 'publish_groups' : 'end_groups'}.json`
url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json`
}
axios.get(url, {
@ -176,7 +182,7 @@ class PublishRightnow extends Component{
render(){
const isPublish = this.props.isPublish;
let showdatatypes=isPublish===true||isPublish===1;
let{
Topvalright,
modalname,
@ -239,7 +245,7 @@ class PublishRightnow extends Component{
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ isPublish ? "立即发布" : "立即截止" }</a> }
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ showdatatypes ? "立即发布" : "立即截止" }</a> }
</div>
)
}

@ -431,7 +431,7 @@ class commonWork extends Component{
></Titlesearchsection>
<PublishRightnow ref="publishModalRef" showActionButton={true} {...this.props} checkBoxValues={checkBoxValues}
showActionButton={false}
isPublish={true} doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow>
isPublish={1} doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow>
{
mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
<div className="mt20 edu-back-white padding20-30">

@ -161,7 +161,21 @@ class OneSelfOrderModal extends Component{
}
onChangeTimeendlist=(date, dateString,id)=>{
let {course_groups}=this.state;
let {course_groups,endtimetypeid}=this.state;
if(endtimetypeid===id){
if(date!=null){
this.setState({
endtimetypeid:undefined
})
}
if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{
if(date!=null){
this.setState({
endtimetypeid:undefined
})
}
}
}
let arr=course_groups;
arr.map((item,key)=>{
@ -219,6 +233,13 @@ class OneSelfOrderModal extends Component{
// arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
}else{
if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
this.setState({
endtimetype:true,
endtimetypevalue:"必须晚于发布时间"
})
return
}
arr.push(items.end_time)
}
}
@ -256,6 +277,7 @@ class OneSelfOrderModal extends Component{
render(){
let {group_ids,endtime,course_groups}=this.state;
// console.log(course_groups)
let course_groupstype=course_groups===undefined||course_groups.length===0;
// TODO course_groups为空时的处理
return(
<div>
@ -377,7 +399,7 @@ class OneSelfOrderModal extends Component{
</li>
</div>}
{this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<ul className="upload_select_box fl clearfix mb30"
|| this.props.usingCheckBeforePost ?"":<ul className={this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?"upload_select_box fl clearfix mb20":"upload_select_box fl clearfix mb30"}
style={{"overflow-y":"auto",padding:"10px 0px"}}
id="search_not_members_list"
@ -422,12 +444,15 @@ class OneSelfOrderModal extends Component{
</ul>
}
<div className="clearfix mt30 edu-txt-center mb10">
<Checkbox className="fl ml10" checked={this.state.Checkboxtype} onChange={this.Checkboxtype}>全选</Checkbox>
{this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?<div className={"color-red fl ml10 mb20"}>{this.state.endtimetypevalue}</div>:""}
{course_groupstype===true?<div className="clearfix mt30 edu-txt-center mb10">
<a className="task-btn color-white mr30" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
<a className="task-btn task-btn-orange" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
</div>
</div>:<div className="clearfix mt30 edu-txt-center mb10">
{course_groupstype===true?"":<Checkbox className="fl ml10" checked={this.state.Checkboxtype} onChange={this.Checkboxtype}>全选</Checkbox>}
<a className="task-btn task-btn-orange fr" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
<a className="task-btn color-white mr30 fr" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
</div>}
</div>
</Modal>:""}

Loading…
Cancel
Save