试卷,问卷详情页立即发布

competitions
杨树明 5 years ago
parent 276eb9c4a7
commit 0df28461cd

@ -229,8 +229,6 @@ class OneSelfOrderModal extends Component{
let {group_ids,endtime,course_groups}=this.state; let {group_ids,endtime,course_groups}=this.state;
// TODO course_groups为空时的处理 // TODO course_groups为空时的处理
// let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months')
return( return(
<div> <div>
{ {

@ -430,6 +430,7 @@ class Testpapersettinghomepage extends Component{
className={"btn fr color-blue font-16 mt20 mr20"} className={"btn fr color-blue font-16 mt20 mr20"}
checkBoxValues={[parseInt(this.props.match.params.Id)]} checkBoxValues={[parseInt(this.props.match.params.Id)]}
Exercisetype={"exercise"} Exercisetype={"exercise"}
pushtype={true}
action={this.Commonheadofthetestpaper} action={this.Commonheadofthetestpaper}
single={true} single={true}
getsetdata={this.getsetdata} getsetdata={this.getsetdata}

@ -115,12 +115,18 @@ class GraduationTaskDetail extends Component{
// this.props.history.goBack() // this.props.history.goBack()
this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`); this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`);
} }
setend_time=(time)=>{
this.setState({
starttimesend:time===undefined||time===null||time===""?undefined:time,
})
}
//立即发布 //立即发布
publish=()=>{ publish=()=>{
let {questionslist}=this.state; let {questionslist}=this.state;
let starttime= this.props.getNowFormatDates(1,1); let starttime= this.props.getNowFormatDates(1,1);
let endtime=this.props.getNowFormatDates(2,1); let endtime=this.props.getNowFormatDates(2,1);
// this.homeworkstart() console.log(this.bindRef.end_time)
this.setState({ this.setState({
modalname:"立即发布", modalname:"立即发布",
// visible:true, // visible:true,
@ -367,7 +373,14 @@ class GraduationTaskDetail extends Component{
course_groups={this.state.course_groups} course_groups={this.state.course_groups}
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)} getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/> />
{/*关联项目*/} {/*关联项目*/}
{visibles===true? {visibles===true?
<Associationmodel <Associationmodel
@ -505,19 +518,19 @@ class GraduationTaskDetail extends Component{
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list"
render={ render={
(props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`list`}/>) (props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`list`}/>)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/setting" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/setting"
render={ render={
(props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`setting`}/>) (props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`setting`}/>)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/questions" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/questions"
render={ render={
(props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`questions`}/>) (props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`questions`}/>)
}></Route> }></Route>
</Switch> </Switch>

@ -143,6 +143,7 @@ class GraduationTaskssettingapp extends Component{
commenttime:result.data.comment_time===null||result.data.comment_time=== ""?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"), commenttime:result.data.comment_time===null||result.data.comment_time=== ""?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"),
task_status: result.data.task_status task_status: result.data.task_status
}) })
this.props.setend_time(result.data.end_time)
} }
}).catch((error)=>{ }).catch((error)=>{

@ -151,7 +151,9 @@ class GraduationTaskssettinglist extends Component{
taskslistdata: result.data, taskslistdata: result.data,
data: datalist, data: datalist,
loadingstate: false, loadingstate: false,
end_time:result.data.end_time
}) })
this.props.setend_time(result.data.end_time)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)

@ -54,8 +54,10 @@ class GraduationTasksquestions extends Component{
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result.status===200){ if(result.status===200){
this.setState({ this.setState({
questionslist:result.data questionslist:result.data,
end_time:result.data.end_time
}) })
this.props.setend_time(result.data.end_time)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)

@ -185,6 +185,7 @@ class PollDetailIndex extends Component{
className={"font-16"} className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]} checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo} action={this.getPollInfo}
pushtype={true}
single={true} single={true}
></ImmediatelyPublish> ></ImmediatelyPublish>
</li> </li>

@ -4,13 +4,14 @@ 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 OneSelfOrderModal from "../../coursesPublic/OneSelfOrderModal";
import axios from 'axios' import axios from 'axios'
import moment from 'moment'; import moment from 'moment';
class Immediatelypublish extends Component{ class Immediatelypublish extends Component{
constructor(props){ constructor(props){
super(props) super(props)
@ -39,12 +40,76 @@ class Immediatelypublish extends Component{
} }
//立即发布 //立即发布
homeworkstart=()=>{ homeworkstart=()=>{
let {checkBoxValues}=this.props let {checkBoxValues,pushtype}=this.props
// console.log(this.props.Exercisetype==="exercise") if(pushtype===true){
if(checkBoxValues.length==0){
this.props.showNotification("请先在列表中选择数据");
// this.setState({
// modalsType:true,
// modalsTopval:"请先在列表中选择数据",
// loadtype:true
// })
}else{
let coursesId=this.props.match.params.coursesId;
if(this.props.Exercisetype==="exercise"){
let url=`/exercises/${this.props.match.params.Id}/publish_groups.json`;
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
OneSelftype:true,
Topval:"学生将立即收到试卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
course_groups:response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
})
}
}).catch((error) => {
console.log(error)
});
}else{
let url=`/polls/${this.props.match.params.pollId}/publish_groups.json`;
axios.get(url).then((response) => {
if(response){
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
OneSelftype:true,
Topval:"学生将立即收到问卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
course_groups:response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
})
}
}).catch((error) => {
console.log(error)
});
}
}
}else{
if(checkBoxValues.length==0){ if(checkBoxValues.length==0){
this.props.showNotification("请先在列表中选择数据"); this.props.showNotification("请先在列表中选择数据");
// this.setState({ // this.setState({
@ -137,6 +202,8 @@ class Immediatelypublish extends Component{
} }
} }
}
} }
@ -154,6 +221,7 @@ class Immediatelypublish extends Component{
modalname:undefined, modalname:undefined,
modaltype:undefined, modaltype:undefined,
visible:false, visible:false,
OneSelftype:false,
Topval:undefined, Topval:undefined,
Topvalright:undefined, Topvalright:undefined,
Botvalleft:undefined, Botvalleft:undefined,
@ -174,18 +242,42 @@ class Immediatelypublish extends Component{
// 确定立即发布 // 确定立即发布
homeworkstartend=(ids,endtime)=>{ homeworkstartend=(ids,endtime)=>{
let {checkBoxValues}=this.props let {checkBoxValues,pushtype}=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"){ let data={};
let url=`/courses/${coursesId}/exercises/publish.json` if(pushtype===true){
axios.post(url,{
if(ids.length===0){
data = {
check_ids:checkBoxValues,
end_time: endtime,
}
}else{
data={
check_ids: checkBoxValues,
group_ids: ids,
group_end_times:endtime,
detail:true
}
}
}else{
data={
check_ids:checkBoxValues, check_ids:checkBoxValues,
group_ids:chooseId, group_ids:chooseId,
end_time:endtime end_time:endtime
}).then((result)=>{ }
}
if(this.props.Exercisetype==="exercise"){
let url=`/courses/${coursesId}/exercises/publish.json`
axios.post(url,data).then((result)=>{
if(result){ if(result){
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
this.homeworkhide(); this.homeworkhide();
@ -210,11 +302,7 @@ class Immediatelypublish extends Component{
}else{ }else{
let url=`/courses/${coursesId}/polls/publish.json` let url=`/courses/${coursesId}/polls/publish.json`
axios.post(url,{ axios.post(url,data).then((result)=>{
check_ids:checkBoxValues,
group_ids:chooseId,
end_time:endtime
}).then((result)=>{
if(result){ if(result){
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
this.homeworkhide(); this.homeworkhide();
@ -277,6 +365,29 @@ class Immediatelypublish extends Component{
course_groups={course_groups} course_groups={course_groups}
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)} getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/> />
{/*立即发布*/}
<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
{/* 公用的提示弹框 */} {/* 公用的提示弹框 */}
<Modals <Modals
modalsType={modalsType} modalsType={modalsType}

@ -1590,7 +1590,7 @@ class Trainingjobsetting extends Component {
// 立即发布 // 立即发布
homeworkstartend = (ds,endtime) => { homeworkstartend = (ds,endtime) => {
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
console.log(this.props)
let data={} let data={}
if(ds.length===0){ if(ds.length===0){
if(this.props.teacherdatapage.category.main===1){ if(this.props.teacherdatapage.category.main===1){

Loading…
Cancel
Save