|
|
|
@ -33,52 +33,110 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
super(props);
|
|
|
|
|
this.state={
|
|
|
|
|
group_ids:[],
|
|
|
|
|
endtime:""
|
|
|
|
|
endtime:"",
|
|
|
|
|
course_groups:undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){
|
|
|
|
|
|
|
|
|
|
let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
if(this.props.course_groups!=undefined) {
|
|
|
|
|
let arr = this.props.course_groups.map(item => item.id);
|
|
|
|
|
let newarr = [];
|
|
|
|
|
let course_groups = this.props.course_groups;
|
|
|
|
|
course_groups.map((item, key) => {
|
|
|
|
|
if (item.end_time === null) {
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}else{
|
|
|
|
|
item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
} else {
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
course_groups: newarr
|
|
|
|
|
})
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate=(prevProps)=>{
|
|
|
|
|
// if(prevProps.visible!=this.props.visible){
|
|
|
|
|
//
|
|
|
|
|
// if(this.props.course_groups!=undefined){
|
|
|
|
|
// let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
// this.shixunhomeworkedit(arr);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if(prevProps.course_groups!=this.props.course_groups){
|
|
|
|
|
if(this.props.course_groups!=undefined){
|
|
|
|
|
let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
}
|
|
|
|
|
if(this.props.course_groups!=undefined){
|
|
|
|
|
let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
let newarr=[];
|
|
|
|
|
let course_groups=this.props.course_groups;
|
|
|
|
|
course_groups.map((item,key)=>{
|
|
|
|
|
if(item.end_time===null){
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}else{
|
|
|
|
|
item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
}else{
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
course_groups:newarr
|
|
|
|
|
})
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(prevProps.starttimes!=this.props.starttimes){
|
|
|
|
|
|
|
|
|
|
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -101,22 +159,37 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onChangeTimeendlist=(date, dateString,id)=>{
|
|
|
|
|
let {course_groups}=this.state;
|
|
|
|
|
let arr=course_groups;
|
|
|
|
|
|
|
|
|
|
arr.map((item,key)=>{
|
|
|
|
|
if(item.id===id){
|
|
|
|
|
item.end_time=dateString
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
course_groups:arr
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
propsSaves=(ds,endtime)=>{
|
|
|
|
|
let {course_groups}=this.state;
|
|
|
|
|
|
|
|
|
|
if(ds.length ===0&&endtime === ""){
|
|
|
|
|
if(this.props.typs=="end"){
|
|
|
|
|
this.props.Saves()
|
|
|
|
|
}else{
|
|
|
|
|
if(this.props.typs!="end"){
|
|
|
|
|
if(endtime === ""||endtime===undefined||endtime===null){
|
|
|
|
|
|
|
|
|
|
if(!endtime){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtimetype:true,
|
|
|
|
|
endtimetypevalue:"截止时间不能为空"
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){
|
|
|
|
|
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtimetype:true,
|
|
|
|
|
endtimetypevalue:"必须晚于发布时间"
|
|
|
|
@ -124,22 +197,37 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
|
|
|
|
|
if(course_groups===undefined||course_groups.length===0){
|
|
|
|
|
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
}else{
|
|
|
|
|
let arr=[]
|
|
|
|
|
ds.map((item,key)=>{
|
|
|
|
|
course_groups.map((items,key)=>{
|
|
|
|
|
if(item===items.id){
|
|
|
|
|
if(!items.end_time){
|
|
|
|
|
arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
}else{
|
|
|
|
|
arr.push(items.end_time)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.props.Saves(ds,arr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
let {group_ids,endtime}=this.state;
|
|
|
|
|
let {course_groups}=this.props;
|
|
|
|
|
|
|
|
|
|
// console.log(this.props.starttimes)
|
|
|
|
|
// console.log(endtime)
|
|
|
|
|
// console.log(this.props.starttimes)
|
|
|
|
|
// console.log(this.state.endtime)
|
|
|
|
|
let {group_ids,endtime,course_groups}=this.state;
|
|
|
|
|
|
|
|
|
|
// console.log(this.props.starttime,this.props.endtime)
|
|
|
|
|
// TODO course_groups为空时的处理
|
|
|
|
|
|
|
|
|
|
// let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months')
|
|
|
|
@ -195,7 +283,7 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
|
|
|
|
|
{this.props.starttime===undefined||
|
|
|
|
|
this.props.starttime===""?""
|
|
|
|
|
: <p className="task-popup-text-center font-16 mt20">
|
|
|
|
|
: <p className="task-popup-text-center font-16 mt10 mb10">
|
|
|
|
|
<span className={"font-14 mr20 color979797"}>
|
|
|
|
|
<span className={"mr10"}>发布时间:</span>
|
|
|
|
|
{this.props.starttime}</span>
|
|
|
|
@ -257,10 +345,10 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
|
|
|
|
|
{ <Checkbox.Group style={{ width: '100%' }} value={group_ids} onChange={this.shixunhomeworkedit}>
|
|
|
|
|
{
|
|
|
|
|
course_groups.map((item,key)=>{
|
|
|
|
|
course_groups===undefined?"":course_groups.map((item,key)=>{
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
|
<div className="clearfix edu-txt-center lineh-40" key={key}>
|
|
|
|
|
<div className="clearfix edu-txt-center lineh-40 mb10" key={key}>
|
|
|
|
|
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
|
|
|
|
|
<Checkbox
|
|
|
|
|
className="task-hide edu-txt-left"
|
|
|
|
@ -282,7 +370,7 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
id={"endTime"}
|
|
|
|
|
width={"210px"}
|
|
|
|
|
value={item.end_time===null||item.end_time===""?"":moment(item.end_time, dateFormat)}
|
|
|
|
|
onChange={this.onChangeTimeend}
|
|
|
|
|
onChange={(e,data)=>this.onChangeTimeendlist(e,data,item.id)}
|
|
|
|
|
className={ this.state.endtimetype===true?"noticeTip fr":"fr"}
|
|
|
|
|
/>
|
|
|
|
|
</li>
|
|
|
|
|