Merge branch 'master' of https://bdgit.educoder.net/Hjqreturn/educoder
commit
109d266f70
@ -1,269 +1,269 @@
|
|||||||
import React,{ Component } from "react";
|
import React,{ Component } from "react";
|
||||||
|
|
||||||
|
|
||||||
import Modals from '../../../modals/Modals'
|
import Modals from '../../../modals/Modals'
|
||||||
import { WordsBtn } from 'educoder'
|
import { WordsBtn } from 'educoder'
|
||||||
import HomeworkModal from "../../coursesPublic/HomeworkModal";
|
import HomeworkModal from "../../coursesPublic/HomeworkModal";
|
||||||
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
|
|
||||||
class ImmediatelyEnd extends Component{
|
class ImmediatelyEnd extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props)
|
super(props)
|
||||||
this.state={
|
this.state={
|
||||||
modalname:undefined,
|
modalname:undefined,
|
||||||
modaltype:undefined,
|
modaltype:undefined,
|
||||||
visible:false,
|
visible:false,
|
||||||
Topval:undefined,
|
Topval:undefined,
|
||||||
Topvalright:undefined,
|
Topvalright:undefined,
|
||||||
Botvalleft:undefined,
|
Botvalleft:undefined,
|
||||||
Botval:undefined,
|
Botval:undefined,
|
||||||
starttime:undefined,
|
starttime:undefined,
|
||||||
endtime:undefined,
|
endtime:undefined,
|
||||||
Cancelname:undefined,
|
Cancelname:undefined,
|
||||||
Savesname:undefined,
|
Savesname:undefined,
|
||||||
Cancel:undefined,
|
Cancel:undefined,
|
||||||
Saves:undefined,
|
Saves:undefined,
|
||||||
course_groups:undefined,
|
course_groups:undefined,
|
||||||
|
|
||||||
modalsType:false,
|
modalsType:false,
|
||||||
modalsTopval:"",
|
modalsTopval:"",
|
||||||
loadtype:false,
|
loadtype:false,
|
||||||
chooseId:undefined
|
chooseId:undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//立即截止
|
//立即截止
|
||||||
homeworkstart=()=>{
|
homeworkstart=()=>{
|
||||||
let {checkBoxValues}=this.props
|
let {checkBoxValues}=this.props
|
||||||
if(checkBoxValues.length==0){
|
if(checkBoxValues.length==0){
|
||||||
this.props.showNotification("请先在列表中选择数据");
|
this.props.showNotification("请先在列表中选择数据");
|
||||||
// this.setState({
|
// this.setState({
|
||||||
// modalsType:true,
|
// modalsType:true,
|
||||||
// modalsTopval:"请先在列表中选择数据",
|
// modalsTopval:"请先在列表中选择数据",
|
||||||
// loadtype:true
|
// loadtype:true
|
||||||
// })
|
// })
|
||||||
}else{
|
}else{
|
||||||
let coursesId=this.props.match.params.coursesId;
|
let coursesId=this.props.match.params.coursesId;
|
||||||
if(this.props.Exercisetype==="exercise"){
|
if(this.props.Exercisetype==="exercise"){
|
||||||
let url=`/courses/${coursesId}/exercises/end_modal.json`;
|
let url=`/courses/${coursesId}/exercises/end_modal.json`;
|
||||||
axios.get(url,{
|
axios.get(url,{
|
||||||
params:{
|
params:{
|
||||||
check_ids:checkBoxValues
|
check_ids:checkBoxValues
|
||||||
}
|
}
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if(response.status===200){
|
if(response.status===200){
|
||||||
let list=[];
|
let list=[];
|
||||||
if(response.data.course_info){
|
if(response.data.course_info){
|
||||||
for(var i=0;i<response.data.course_info.length;i++){
|
for(var i=0;i<response.data.course_info.length;i++){
|
||||||
list.push({
|
list.push({
|
||||||
id:response.data.course_info[i].course_group_id,
|
id:response.data.course_info[i].course_group_id,
|
||||||
name:response.data.course_info[i].course_group_name,
|
name:response.data.course_info[i].course_group_name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
course_groups:list,
|
course_groups:list,
|
||||||
})
|
})
|
||||||
this.setState({
|
this.setState({
|
||||||
modalname:"立即截止",
|
modalname:"立即截止",
|
||||||
modaltype:response.data.on_commiting > 0 ? 1 : 2,
|
modaltype:response.data.on_commiting > 0 ? 1 : 2,
|
||||||
visible:true,
|
visible:true,
|
||||||
Topval:"本操作只对“提交中”的对象生效",
|
Topval:"学生将不能再提交试卷",
|
||||||
Botvalleft:"暂不截止",
|
// Botvalleft:"暂不截止",
|
||||||
Botval:"则将根据已设置的截止时间,定时截止",
|
Botval:`本操作只对"提交中"的分班有效`,
|
||||||
// starttime:"发布时间:"+getNowFormatDate(1),
|
// starttime:"发布时间:"+getNowFormatDate(1),
|
||||||
// endtime:"截止时间:"+getNowFormatDate(2),
|
// endtime:"截止时间:"+getNowFormatDate(2),
|
||||||
Cancelname:"暂不截止",
|
Cancelname:"暂不截止",
|
||||||
Savesname:"立即截止",
|
Savesname:"立即截止",
|
||||||
Cancel:this.homeworkhide,
|
Cancel:this.homeworkhide,
|
||||||
Saves:this.homeworkstartend,
|
Saves:this.homeworkstartend,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
let url=`/courses/${coursesId}/polls/end_poll_modal.json`;
|
let url=`/courses/${coursesId}/polls/end_poll_modal.json`;
|
||||||
|
|
||||||
axios.get(url,{
|
axios.get(url,{
|
||||||
params:{
|
params:{
|
||||||
check_ids:checkBoxValues
|
check_ids:checkBoxValues
|
||||||
}
|
}
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if(response.status===200){
|
if(response.status===200){
|
||||||
let list=[];
|
let list=[];
|
||||||
if(response.data.course_info){
|
if(response.data.course_info){
|
||||||
for(var i=0;i<response.data.course_info.length;i++){
|
for(var i=0;i<response.data.course_info.length;i++){
|
||||||
list.push({
|
list.push({
|
||||||
id:response.data.course_info[i].course_group_id,
|
id:response.data.course_info[i].course_group_id,
|
||||||
name:response.data.course_info[i].course_group_name,
|
name:response.data.course_info[i].course_group_name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
course_groups:list,
|
course_groups:list,
|
||||||
})
|
})
|
||||||
this.setState({
|
this.setState({
|
||||||
modalname:"立即截止",
|
modalname:"立即截止",
|
||||||
modaltype:response.data.on_commiting > 0 ? 1 : 2,
|
modaltype:response.data.on_commiting > 0 ? 1 : 2,
|
||||||
visible:true,
|
visible:true,
|
||||||
Topval:"本操作只对“提交中”的对象生效",
|
Topval:"学生将不能再提交问卷",
|
||||||
Botvalleft:"暂不截止",
|
// Botvalleft:"暂不截止",
|
||||||
Botval:"则将根据已设置的截止时间,定时截止",
|
Botval:`本操作只对"提交中"的分班有效`,
|
||||||
// starttime:"发布时间:"+getNowFormatDate(1),
|
// starttime:"发布时间:"+getNowFormatDate(1),
|
||||||
// endtime:"截止时间:"+getNowFormatDate(2),
|
// endtime:"截止时间:"+getNowFormatDate(2),
|
||||||
Cancelname:"暂不截止",
|
Cancelname:"暂不截止",
|
||||||
Savesname:"立即截止",
|
Savesname:"立即截止",
|
||||||
Cancel:this.homeworkhide,
|
Cancel:this.homeworkhide,
|
||||||
Saves:this.homeworkstartend,
|
Saves:this.homeworkstartend,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消提示弹框
|
//取消提示弹框
|
||||||
modalCancel=()=>{
|
modalCancel=()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
modalsType:false,
|
modalsType:false,
|
||||||
modalsTopval:"",
|
modalsTopval:"",
|
||||||
loadtype:false
|
loadtype:false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//暂不发布
|
//暂不发布
|
||||||
homeworkhide=()=>{
|
homeworkhide=()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
modalname:undefined,
|
modalname:undefined,
|
||||||
modaltype:undefined,
|
modaltype:undefined,
|
||||||
visible:false,
|
visible:false,
|
||||||
Topval:undefined,
|
Topval:undefined,
|
||||||
Topvalright:undefined,
|
Topvalright:undefined,
|
||||||
Botvalleft:undefined,
|
Botvalleft:undefined,
|
||||||
Botval:undefined,
|
Botval:undefined,
|
||||||
starttime:undefined,
|
starttime:undefined,
|
||||||
endtime:undefined,
|
endtime:undefined,
|
||||||
Cancelname:undefined,
|
Cancelname:undefined,
|
||||||
Savesname:undefined,
|
Savesname:undefined,
|
||||||
Cancel:undefined,
|
Cancel:undefined,
|
||||||
Saves:undefined,
|
Saves:undefined,
|
||||||
StudentList_value:undefined,
|
StudentList_value:undefined,
|
||||||
addname:undefined,
|
addname:undefined,
|
||||||
addnametype:false,
|
addnametype:false,
|
||||||
addnametab:undefined
|
addnametab:undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 确定立即截止
|
// 确定立即截止
|
||||||
homeworkstartend=()=>{
|
homeworkstartend=()=>{
|
||||||
|
|
||||||
let {checkBoxValues}=this.props
|
let {checkBoxValues}=this.props
|
||||||
let {chooseId}=this.state;
|
let {chooseId}=this.state;
|
||||||
let coursesId=this.props.match.params.coursesId;
|
let coursesId=this.props.match.params.coursesId;
|
||||||
if(this.props.Exercisetype==="exercise"){
|
if(this.props.Exercisetype==="exercise"){
|
||||||
let url=`/courses/${coursesId}/exercises/end_exercise.json`
|
let url=`/courses/${coursesId}/exercises/end_exercise.json`
|
||||||
axios.post(url,{
|
axios.post(url,{
|
||||||
check_ids:checkBoxValues,
|
check_ids:checkBoxValues,
|
||||||
group_ids:chooseId
|
group_ids:chooseId
|
||||||
}).then((result)=>{
|
}).then((result)=>{
|
||||||
if(result){
|
if(result){
|
||||||
this.props.showNotification(result.data.message);
|
this.props.showNotification(result.data.message);
|
||||||
this.homeworkhide();
|
this.homeworkhide();
|
||||||
// 调用父级公共头部的接口刷新
|
// 调用父级公共头部的接口刷新
|
||||||
this.props.action()
|
this.props.action()
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
let url=`/courses/${coursesId}/polls/end_poll.json`
|
let url=`/courses/${coursesId}/polls/end_poll.json`
|
||||||
axios.post(url,{
|
axios.post(url,{
|
||||||
check_ids:checkBoxValues,
|
check_ids:checkBoxValues,
|
||||||
group_ids:chooseId
|
group_ids:chooseId
|
||||||
}).then((result)=>{
|
}).then((result)=>{
|
||||||
if(result){
|
if(result){
|
||||||
this.props.showNotification(result.data.message);
|
this.props.showNotification(result.data.message);
|
||||||
this.homeworkhide();
|
this.homeworkhide();
|
||||||
// 调用父级公共头部的接口刷新
|
// 调用父级公共头部的接口刷新
|
||||||
this.props.action()
|
this.props.action()
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getcourse_groupslist=(id)=>{
|
getcourse_groupslist=(id)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
chooseId:id
|
chooseId:id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let{
|
let{
|
||||||
modalname,
|
modalname,
|
||||||
modaltype,
|
modaltype,
|
||||||
visible,
|
visible,
|
||||||
Topval,
|
Topval,
|
||||||
Topvalright,
|
Topvalright,
|
||||||
Botvalleft,
|
Botvalleft,
|
||||||
Botval,
|
Botval,
|
||||||
starttime,
|
starttime,
|
||||||
endtime,
|
endtime,
|
||||||
Cancelname,
|
Cancelname,
|
||||||
Savesname,
|
Savesname,
|
||||||
Cancel,
|
Cancel,
|
||||||
Saves,
|
Saves,
|
||||||
course_groups,
|
course_groups,
|
||||||
|
|
||||||
modalsType,
|
modalsType,
|
||||||
modalsTopval,
|
modalsTopval,
|
||||||
loadtype,
|
loadtype,
|
||||||
}=this.state
|
}=this.state
|
||||||
return(
|
return(
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<HomeworkModal
|
<HomeworkModal
|
||||||
modaltype={modaltype}
|
modaltype={modaltype}
|
||||||
typs={"end"}
|
typs={"end"}
|
||||||
modalname={modalname}
|
modalname={modalname}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
Topval={Topval}
|
Topval={Topval}
|
||||||
Topvalright={Topvalright}
|
Topvalright={Topvalright}
|
||||||
Botvalleft={Botvalleft}
|
Botvalleft={Botvalleft}
|
||||||
Botval={Botval}
|
Botval={Botval}
|
||||||
starttime={starttime}
|
starttime={starttime}
|
||||||
endtime={endtime}
|
endtime={endtime}
|
||||||
Cancelname={Cancelname}
|
Cancelname={Cancelname}
|
||||||
Savesname={Savesname}
|
Savesname={Savesname}
|
||||||
Cancel={Cancel}
|
Cancel={Cancel}
|
||||||
Saves={Saves}
|
Saves={Saves}
|
||||||
course_groups={course_groups}
|
course_groups={course_groups}
|
||||||
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
|
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
|
||||||
/>
|
/>
|
||||||
{/* 公用的提示弹框 */}
|
{/* 公用的提示弹框 */}
|
||||||
<Modals
|
<Modals
|
||||||
modalsType={modalsType}
|
modalsType={modalsType}
|
||||||
modalsTopval={modalsTopval}
|
modalsTopval={modalsTopval}
|
||||||
modalsBottomval=""
|
modalsBottomval=""
|
||||||
loadtype={loadtype}
|
loadtype={loadtype}
|
||||||
modalCancel={this.modalCancel}
|
modalCancel={this.modalCancel}
|
||||||
modalSave={this.modalCancel}
|
modalSave={this.modalCancel}
|
||||||
></Modals>
|
></Modals>
|
||||||
|
|
||||||
<WordsBtn style={this.props.style} className={this.props.className} onClick={this.homeworkstart}>立即截止</WordsBtn>
|
<WordsBtn style={this.props.style} className={this.props.className} onClick={this.homeworkstart}>立即截止</WordsBtn>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default ImmediatelyEnd
|
export default ImmediatelyEnd
|
Loading…
Reference in new issue