Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_daiao
cxt 5 years ago
commit 0868eb87a9

@ -42,12 +42,7 @@ class Selectresource extends Component{
getallfiles:false,
searchtype:'getallfiles',
Radiovalue:0,
datatime:undefined,
course_group_publish_times:[
{
group_id : [],
publish_time :undefined,
}],
datatime:undefined
}
}
componentDidMount() {
@ -217,7 +212,7 @@ class Selectresource extends Component{
savecouseShixunModal=()=>{
let {patheditarry,datatime,Radiovalue,course_group_publish_times}=this.state;
let {patheditarry,datatime,Radiovalue}=this.state;
let {coursesId,attachmentId}=this.props;
let url="/files/import.json";
@ -232,7 +227,7 @@ class Selectresource extends Component{
})
}
if(this.state.Radiovalue===1&&this.props.course_groups.length===0){
if(this.state.Radiovalue===1){
if(datatime===undefined||datatime===null||datatime=== ""){
this.setState({
Radiovaluetype:true
@ -250,8 +245,7 @@ class Selectresource extends Component{
attachment_ids:patheditarry,
course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId,
delay_publish:Radiovalue,
publish_time:this.props.course_groups.length===0?Radiovalue===1?datatime===undefined? undefined:datatime:undefined:undefined,
group_settings:this.props.course_groups.length===0?undefined:course_group_publish_times
publish_time:Radiovalue===1?datatime:undefined
}
).then((response) => {
if(response.data.status===0){
@ -277,58 +271,15 @@ class Selectresource extends Component{
});
}
onChangeTimepublish= (date, dateString,key,type) => {
if(type===1){
onChangeTimepublish= (date, dateString) => {
this.setState({
datatime:handleDateString(dateString),
})
}else if(type===2){
let {course_group_publish_times}=this.state;
let newgroup_publish=course_group_publish_times;
for(var i=0; i<newgroup_publish.length; i++){
if(i===parseInt(key)){
newgroup_publish[i].publish_time=handleDateString(dateString);
}
}
this.setState({
course_group_publish_times:newgroup_publish,
})
}
}
addgrouppublish=()=>{
let newlist=this.state.course_group_publish_times;
newlist.push( {
group_id : undefined,
publish_time :undefined,
})
this.setState({
course_group_publish_times:newlist
})
}
deletegrouppublish=(key)=>{
let newlist=this.state.course_group_publish_times;
newlist.splice(key,1);
this.setState({
course_group_publish_times:newlist
})
}
selectassigngroups=(e,index,key)=>{
debugger
let {course_group_publish_times}=this.state;
let newgroup_publish=course_group_publish_times;
for(var i=0; i<newgroup_publish.length; i++){
if(i===parseInt(key)){
newgroup_publish[i].group_id=e;
}
}
this.setState({
course_group_publish_times:newgroup_publish,
})
}
render(){
let {Searchvalue,type,Resourcelist,hometypepvisible,patheditarry,datatime,course_group_publish_times}=this.state;
let {Searchvalue,type,Resourcelist,hometypepvisible,patheditarry,datatime}=this.state;
let {visible}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
const radioStyle = {
@ -336,8 +287,6 @@ class Selectresource extends Component{
height: '30px',
lineHeight: '30px',
};
console.log(course_group_publish_times)
return(
<div>
{/*提示*/}
@ -376,12 +325,12 @@ class Selectresource extends Component{
}
#shixun_tab_div{
padding: 0 30px;
padding-top:15px;
padding-top:30px;
}
.search-news{
width: 237px!important;
height: 30px;
margin-bottom: 15px;
margin-bottom: 30px;
}
`}</style>
@ -424,7 +373,7 @@ class Selectresource extends Component{
height: 37px;
}
.scrollbox{
height:145px !important;
height:250px !important;
}
.selectfilsbox{
height: 50px;
@ -475,7 +424,7 @@ class Selectresource extends Component{
<Tooltip placement="bottom" title={this.props.isStudent()===true?"不支持学生延迟发布":""} >
<Radio style={radioStyle} value={1} className={"fl"} disabled={this.props.isStudent()}>
<span className={"mr5"}>延期发布</span>
{this.props.course_groups.length>0?"":<DatePicker
<DatePicker
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
@ -489,93 +438,11 @@ class Selectresource extends Component{
disabledTime={disabledDateTime}
disabledDate={disabledDate}
disabled={this.state.Radiovalue===1?false:true}
/>}
/>
</Radio>
</Tooltip>
<span className={"fl mt5 color-grey-c"}>(按照设置的时间定时发布)</span>
</Radio.Group>
<style>{`
.Selectleft20{
margin-left: 20px !important;
width: 176px;
height: 40px;
}
#startimes .ant-calendar-picker-icon{
margin-top:-11px;
}
.resourcebox{
max-height:106px;
overflow: auto;
}
.ml70{
margin-left:70px;
}
`}</style>
{this.props.course_groups.length>0?this.props.isStudent()===true?"":<div className={"resourcebox"}>
{this.state.Radiovalue===1?<style>
{
`
.ant-input, .ant-input .ant-input-suffix {
background-color: #fff!important;
}
`
}
</style>:""}
{
course_group_publish_times.map((item,key)=>{
return(
<div className={"mt10"} key={key}>
<Select
mode="multiple"
className={"ml70"}
disabled={this.state.Radiovalue===1?false:true}
placeholder="请选择分班名称"
value={item.group_id}
style={{ width: 200 }}
onChange={(e,index)=>this.selectassigngroups(e,index,key)}
>
{this.props.course_groups.map((items,keys)=>{
let type=0
{course_group_publish_times.map((itsem,kesy)=>{
if(itsem.group_id===items.id){
type=1
return
}
})}
if(type===0){
return(
<Option value={items.name} key={keys} id={items.id}>{items.name}</Option>
)
}
})}
</Select>
<DatePicker
disabled={this.state.Radiovalue===1?false:true}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
showToday={false}
format={dateFormat}
placeholder="请选择发布时间"
id={"startimes"}
className={"Selectleft20 "}
width={"200px"}
value={item.publish_time===undefined||item.publish_time===""?undefined:moment(item.publish_time, dateFormat)}
onChange={(e,index)=>this.onChangeTimepublish(e,index,key,2)}
// onChange={ this.onChangeTimepublish }
disabledTime={disabledDateTime}
disabledDate={disabledDate}
/>
{key!=0?<i className="iconfont icon-shanchu color-grey-c font-14 font-n ml20" onClick={()=>this.deletegrouppublish(key)}></i>:""}
{key+1===this.props.course_groups.length?"":<i className="iconfont icon-tianjiafangda color-green ml15" onClick={this.addgrouppublish}></i>}
</div>
)
})
}
</div>:""}
</div>
{this.state.patheditarrytype===true?<p className={"color-red ml20"}>请选择资源</p>:""}

@ -14,12 +14,12 @@ function range(start, end) {
}
return result;
}
function disabledDateTime() {
return {
// disabledHours: () => range(0, 24).splice(4, 20),
disabledMinutes: () => range(1, 30).concat(range(31, 60)),
// disabledSeconds: () => range(0,60)
}
// disabledSeconds: () => [0, 60],
};
}
function disabledDate(current) {
@ -45,8 +45,8 @@ class Sendresource extends Component{
// moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
course_group_publish_times:[
{
group_id : undefined,
publish_time :undefined,
course_group_id : undefined,
publish_time :""
}],
course_groups:undefined,
course_groups_count:undefined,
@ -127,7 +127,7 @@ class Sendresource extends Component{
}
Saves=()=>{
let {fileList,description,is_public,datatime,Radiovalue,course_group_publish_times} =this.state;
let {fileList,description,is_public,datatime,Radiovalue} =this.state;
let newfileList=[];
for(var list of fileList){
@ -141,7 +141,7 @@ class Sendresource extends Component{
return
}
if(this.state.Radiovalue===1&&this.props.course_groups.length===0){
if(this.state.Radiovalue===1){
if(datatime===undefined||datatime===null||datatime=== ""){
this.setState({
Radiovaluetype:true
@ -156,7 +156,6 @@ class Sendresource extends Component{
if(description===undefined){
}else if(description.length>100){
@ -177,10 +176,9 @@ class Sendresource extends Component{
course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId,
attachment_ids:newfileList,
is_public:is_public,
publish_time:this.props.course_groups.length===0?Radiovalue===1?datatime===undefined? undefined:datatime:undefined:"",
publish_time:Radiovalue===1?datatime===undefined? undefined:datatime:undefined,
description:description,
delay_publish:Radiovalue,
group_settings:this.props.course_groups.length===0?"":course_group_publish_times
}).then((result)=>{
if(result.data.status===0){
@ -239,42 +237,10 @@ class Sendresource extends Component{
Radiovalue: e.target.value,
});
}
addgrouppublish=()=>{
let newlist=this.state.course_group_publish_times;
newlist.push( {
group_id : undefined,
publish_time :undefined,
})
this.setState({
course_group_publish_times:newlist
})
}
deletegrouppublish=(key)=>{
let newlist=this.state.course_group_publish_times;
newlist.splice(key,1);
this.setState({
course_group_publish_times:newlist
})
}
selectassigngroups=(e,index,key)=>{
let {course_group_publish_times}=this.state;
let newgroup_publish=course_group_publish_times;
for(var i=0; i<newgroup_publish.length; i++){
if(i===parseInt(key)){
newgroup_publish[i].group_id=e;
}
}
this.setState({
course_group_publish_times:newgroup_publish,
})
}
render(){
let { newfileListtype,descriptiontype,
is_public,
datatime,
course_group_publish_times
}=this.state;
const uploadProps = {
@ -299,7 +265,7 @@ class Sendresource extends Component{
};
//console.log(this.state.course_group_publish_times)
console.log(this.props.course_groups)
return(
<div>
{/*提示*/}
@ -455,89 +421,10 @@ class Sendresource extends Component{
</Radio>
</Tooltip>
<span className={"fl mt5 color-grey-c"}>(按照设置的时间定时发布)</span>
</Radio.Group>
<style>{`
.Selectleft20{
margin-left: 20px !important;
width: 176px;
height: 40px;
}
#startimes .ant-calendar-picker-icon{
margin-top:-11px;
}
.resourcebox{
max-height:150px;
overflow: auto;
}
.ml70{
margin-left:70px;
}
`}</style>
{this.props.course_groups.length>0?this.props.isStudent()===true?"":<div className={"resourcebox"}>
{this.state.Radiovalue===1?<style>
{
`
.ant-input, .ant-input .ant-input-suffix {
background-color: #fff!important;
}
`
}
</style>:""}
{
course_group_publish_times.map((item,key)=>{
return(
<div className={"mt10"} key={key}>
<Select
mode="multiple"
disabled={this.state.Radiovalue===1?false:true}
placeholder="请选择分班名称"
value={item.group_id}
style={{ width: 200 }}
onChange={(e,index)=>this.selectassigngroups(e,index,key)}
>
{this.props.course_groups.map((items,keys)=>{
let type=0
{course_group_publish_times.map((itsem,kesy)=>{
if(itsem.group_id===items.id){
type=1
return
}
})}
if(type===0){
return(
<Option value={items.name} key={keys} id={items.id}>{items.name}</Option>
)
}
})}
</Select>
<DatePicker
disabled={this.state.Radiovalue===1?false:true}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
showToday={false}
format={dateFormat}
placeholder="请选择发布时间"
id={"startimes"}
className={"Selectleft20 "}
width={"200px"}
value={item.publish_time===undefined||item.publish_time===""?undefined:moment(item.publish_time, dateFormat)}
onChange={(e,index)=>this.onChangeTimepublish(e,index,key,2)}
// onChange={ this.onChangeTimepublish }
disabledTime={disabledDateTime}
disabledDate={disabledDate}
/>
{key!=0?<i className="iconfont icon-shanchu color-grey-c font-14 font-n ml20" onClick={()=>this.deletegrouppublish(key)}></i>:""}
{key+1===this.props.course_groups.length?"":<i className="iconfont icon-tianjiafangda color-green ml15" onClick={this.addgrouppublish}></i>}
</div>
)
})
}
</div>:""}
</Radio.Group>
</div>

Loading…
Cancel
Save