|  |  |  | @ -1,17 +1,34 @@ | 
			
		
	
		
			
				
					|  |  |  |  | import React,{ Component } from "react"; | 
			
		
	
		
			
				
					|  |  |  |  | import { Modal,Checkbox,Select,Input,Spin,Icon} from "antd"; | 
			
		
	
		
			
				
					|  |  |  |  | import { Modal,Checkbox,Select,Input,Spin,Icon,Radio,DatePicker} from "antd"; | 
			
		
	
		
			
				
					|  |  |  |  | import locale from 'antd/lib/date-picker/locale/zh_CN'; | 
			
		
	
		
			
				
					|  |  |  |  | import axios from'axios'; | 
			
		
	
		
			
				
					|  |  |  |  | import {handleDateString} from 'educoder'; | 
			
		
	
		
			
				
					|  |  |  |  | import NoneData from "../coursesPublic/NoneData"; | 
			
		
	
		
			
				
					|  |  |  |  | import Modals from '../../modals/Modals'; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import moment from 'moment'; | 
			
		
	
		
			
				
					|  |  |  |  | const Option = Select.Option; | 
			
		
	
		
			
				
					|  |  |  |  | const Search = Input.Search; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | const dateFormat ="YYYY-MM-DD HH:mm" | 
			
		
	
		
			
				
					|  |  |  |  | function formatDate(date) { | 
			
		
	
		
			
				
					|  |  |  |  | 	var dateee = new Date(date).toJSON(); | 
			
		
	
		
			
				
					|  |  |  |  | 	return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '') | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | function range(start, end) { | 
			
		
	
		
			
				
					|  |  |  |  | 	const result = []; | 
			
		
	
		
			
				
					|  |  |  |  | 	for (let i = start; i < end; i++) { | 
			
		
	
		
			
				
					|  |  |  |  | 		result.push(i); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	return result; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | function disabledDateTime() { | 
			
		
	
		
			
				
					|  |  |  |  | 	return { | 
			
		
	
		
			
				
					|  |  |  |  | 		disabledMinutes: () => range(1, 30).concat(range(31, 60)), | 
			
		
	
		
			
				
					|  |  |  |  | 		// disabledSeconds: () => range(1,60)
 | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | function disabledDate(current) { | 
			
		
	
		
			
				
					|  |  |  |  | 	return current && current < moment().endOf('day').subtract(1, 'days'); | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 	constructor(props){ | 
			
		
	
		
			
				
					|  |  |  |  | 		super(props); | 
			
		
	
	
		
			
				
					|  |  |  | @ -23,7 +40,9 @@ class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 			Resourcelist:undefined, | 
			
		
	
		
			
				
					|  |  |  |  | 			hometypepvisible:true, | 
			
		
	
		
			
				
					|  |  |  |  | 			getallfiles:false, | 
			
		
	
		
			
				
					|  |  |  |  | 			searchtype:'getallfiles' | 
			
		
	
		
			
				
					|  |  |  |  | 			searchtype:'getallfiles', | 
			
		
	
		
			
				
					|  |  |  |  | 			Radiovalue:0, | 
			
		
	
		
			
				
					|  |  |  |  | 			datatime:undefined | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	componentDidMount() { | 
			
		
	
	
		
			
				
					|  |  |  | @ -32,11 +51,7 @@ class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	componentDidUpdate = (prevProps) => { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     let {getallfiles}=this.state; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		if ( prevProps.visible != this.props.visible ) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -197,7 +212,7 @@ class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	savecouseShixunModal=()=>{ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		let {patheditarry}=this.state; | 
			
		
	
		
			
				
					|  |  |  |  | 		let {patheditarry,datatime,Radiovalue}=this.state; | 
			
		
	
		
			
				
					|  |  |  |  | 		let {coursesId,attachmentId}=this.props; | 
			
		
	
		
			
				
					|  |  |  |  | 	   let url="/files/import.json"; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -212,19 +227,28 @@ class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 		  }) | 
			
		
	
		
			
				
					|  |  |  |  | 	  } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		if(this.state.Radiovalue===1){ | 
			
		
	
		
			
				
					|  |  |  |  | 			if(datatime===undefined||datatime===null||datatime=== ""){ | 
			
		
	
		
			
				
					|  |  |  |  | 				this.setState({ | 
			
		
	
		
			
				
					|  |  |  |  | 					Radiovaluetype:true | 
			
		
	
		
			
				
					|  |  |  |  | 				}) | 
			
		
	
		
			
				
					|  |  |  |  | 				return | 
			
		
	
		
			
				
					|  |  |  |  | 			}else{ | 
			
		
	
		
			
				
					|  |  |  |  | 				this.setState({ | 
			
		
	
		
			
				
					|  |  |  |  | 					Radiovaluetype:false | 
			
		
	
		
			
				
					|  |  |  |  | 				}) | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		axios.post(url, { | 
			
		
	
		
			
				
					|  |  |  |  | 				course_id:coursesId, | 
			
		
	
		
			
				
					|  |  |  |  | 				attachment_ids:patheditarry, | 
			
		
	
		
			
				
					|  |  |  |  | 				course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, | 
			
		
	
		
			
				
					|  |  |  |  | 			  delay_publish:Radiovalue, | 
			
		
	
		
			
				
					|  |  |  |  | 		  	publish_time:Radiovalue===1?datatime:undefined | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		).then((response) => { | 
			
		
	
		
			
				
					|  |  |  |  | 				if(response.data.status===0){ | 
			
		
	
		
			
				
					|  |  |  |  | 					// this.setState({
 | 
			
		
	
		
			
				
					|  |  |  |  | 					// 	Modalstype:true,
 | 
			
		
	
		
			
				
					|  |  |  |  | 					// 	Modalstopval:response.data.message,
 | 
			
		
	
		
			
				
					|  |  |  |  | 					// 	ModalSave:this.ModalCancelModalCancel,
 | 
			
		
	
		
			
				
					|  |  |  |  | 					// 	loadtype:true
 | 
			
		
	
		
			
				
					|  |  |  |  | 					// })
 | 
			
		
	
		
			
				
					|  |  |  |  | 					this.ModalCancelModalCancel(); | 
			
		
	
		
			
				
					|  |  |  |  | 					this.props.updataleftNavfun(); | 
			
		
	
		
			
				
					|  |  |  |  | 					this.props.showNotification("选用资源成功"); | 
			
		
	
	
		
			
				
					|  |  |  | @ -236,15 +260,33 @@ class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	selectCloseList=(value)=>{ | 
			
		
	
		
			
				
					|  |  |  |  | 	RadioonChange=(e)=>{ | 
			
		
	
		
			
				
					|  |  |  |  | 		if(e.target.value===0){ | 
			
		
	
		
			
				
					|  |  |  |  | 			this.setState({ | 
			
		
	
		
			
				
					|  |  |  |  | 				datatime:undefined | 
			
		
	
		
			
				
					|  |  |  |  | 			}) | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		this.setState({ | 
			
		
	
		
			
				
					|  |  |  |  | 			Radiovalue: e.target.value, | 
			
		
	
		
			
				
					|  |  |  |  | 		}); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	onChangeTimepublish= (date, dateString) => { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		this.setState({ | 
			
		
	
		
			
				
					|  |  |  |  | 			category_id:value | 
			
		
	
		
			
				
					|  |  |  |  | 			datatime:handleDateString(dateString), | 
			
		
	
		
			
				
					|  |  |  |  | 		}) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	render(){ | 
			
		
	
		
			
				
					|  |  |  |  | 		let {Searchvalue,type,category_id,Resourcelist,hometypepvisible,patheditarry}=this.state; | 
			
		
	
		
			
				
					|  |  |  |  | 		let {visible,shixunmodallist}=this.props; | 
			
		
	
		
			
				
					|  |  |  |  | 		let {Searchvalue,type,Resourcelist,hometypepvisible,patheditarry,datatime}=this.state; | 
			
		
	
		
			
				
					|  |  |  |  | 		let {visible}=this.props; | 
			
		
	
		
			
				
					|  |  |  |  | 		const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; | 
			
		
	
		
			
				
					|  |  |  |  | 		const radioStyle = { | 
			
		
	
		
			
				
					|  |  |  |  | 			display: 'block', | 
			
		
	
		
			
				
					|  |  |  |  | 			height: '30px', | 
			
		
	
		
			
				
					|  |  |  |  | 			lineHeight: '30px', | 
			
		
	
		
			
				
					|  |  |  |  | 		}; | 
			
		
	
		
			
				
					|  |  |  |  | 		return( | 
			
		
	
		
			
				
					|  |  |  |  | 			<div> | 
			
		
	
		
			
				
					|  |  |  |  | 				{/*提示*/} | 
			
		
	
	
		
			
				
					|  |  |  | @ -373,10 +415,36 @@ class Selectresource extends Component{ | 
			
		
	
		
			
				
					|  |  |  |  | 								} | 
			
		
	
		
			
				
					|  |  |  |  | 								</div> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 							<div className={"mt10"}> | 
			
		
	
		
			
				
					|  |  |  |  | 								<span className={"color-ooo fl mt6 ml20"}>发布设置:</span> | 
			
		
	
		
			
				
					|  |  |  |  | 								<Radio.Group onChange={this.RadioonChange} value={this.state.Radiovalue} style={{'width': '460px'}}> | 
			
		
	
		
			
				
					|  |  |  |  | 									<Radio style={radioStyle} value={0}> | 
			
		
	
		
			
				
					|  |  |  |  | 										立即发布 | 
			
		
	
		
			
				
					|  |  |  |  | 									</Radio> | 
			
		
	
		
			
				
					|  |  |  |  | 									<Radio style={radioStyle} value={1} className={"fl"}> | 
			
		
	
		
			
				
					|  |  |  |  | 										<span className={"mr5"}>延迟发布</span> | 
			
		
	
		
			
				
					|  |  |  |  | 										<DatePicker | 
			
		
	
		
			
				
					|  |  |  |  | 											dropdownClassName="hideDisable" | 
			
		
	
		
			
				
					|  |  |  |  | 											showTime={{ format: 'HH:mm' }} | 
			
		
	
		
			
				
					|  |  |  |  | 											locale={locale} | 
			
		
	
		
			
				
					|  |  |  |  | 											format={dateFormat} | 
			
		
	
		
			
				
					|  |  |  |  | 											placeholder="请选择发布时间" | 
			
		
	
		
			
				
					|  |  |  |  | 											id={"startime"} | 
			
		
	
		
			
				
					|  |  |  |  | 											showToday={false} | 
			
		
	
		
			
				
					|  |  |  |  | 											width={"210px"} | 
			
		
	
		
			
				
					|  |  |  |  | 											value={this.state.Radiovalue===1?datatime===undefined||datatime===""?undefined:moment(datatime, dateFormat):undefined} | 
			
		
	
		
			
				
					|  |  |  |  | 											onChange={(e,index)=>this.onChangeTimepublish(e,index,undefined,1)} | 
			
		
	
		
			
				
					|  |  |  |  | 											disabledTime={disabledDateTime} | 
			
		
	
		
			
				
					|  |  |  |  | 											disabledDate={disabledDate} | 
			
		
	
		
			
				
					|  |  |  |  | 											disabled={this.state.Radiovalue===1?false:true} | 
			
		
	
		
			
				
					|  |  |  |  | 										/> | 
			
		
	
		
			
				
					|  |  |  |  | 									</Radio> | 
			
		
	
		
			
				
					|  |  |  |  | 									<span className={"fl mt5 color-grey-c"}>(按照设置的时间定时发布)</span> | 
			
		
	
		
			
				
					|  |  |  |  | 								</Radio.Group> | 
			
		
	
		
			
				
					|  |  |  |  | 							</div> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 							{this.state.patheditarrytype===true?<p className={"color-red ml20"}>请选择资源</p>:""} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 							{this.state.Radiovaluetype===true?<p className={"color-red ml20"}>发布时间不能为空</p>:""} | 
			
		
	
		
			
				
					|  |  |  |  | 							<div className="mt20 marginauto clearfix edu-txt-center"> | 
			
		
	
		
			
				
					|  |  |  |  | 								<a className="pop_close task-btn mr30 margin-tp26" onClick={this.hidecouseShixunModal}>取消</a> | 
			
		
	
		
			
				
					|  |  |  |  | 								<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.savecouseShixunModal}>确定</a> | 
			
		
	
	
		
			
				
					|  |  |  | 
 |