|
|
|
@ -33,9 +33,11 @@ class PublishRightnow extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
homeworkstart=()=>{
|
|
|
|
|
const isPublish = this.props.isPublish;
|
|
|
|
|
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';
|
|
|
|
|
|
|
|
|
|
// getNextHalfHourOfMoment
|
|
|
|
|
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=()=>{
|
|
|
|
@ -124,14 +127,15 @@ class PublishRightnow extends Component{
|
|
|
|
|
detail:true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|