dev_forum
parent
ac2a798c76
commit
a6142f8cd1
@ -1,207 +1,207 @@
|
|||||||
import React,{ Component } from "react";
|
import React,{ Component } from "react";
|
||||||
import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd";
|
import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd";
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { SnackbarHOC } from 'educoder';
|
import { SnackbarHOC } from 'educoder';
|
||||||
import Modals from '../../modals/Modals';
|
import Modals from '../../modals/Modals';
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
const CheckboxGroup = Checkbox.Group;
|
const CheckboxGroup = Checkbox.Group;
|
||||||
class sendPanel extends Component{
|
class sendPanel extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
sentShixunPath:false,
|
sentShixunPath:false,
|
||||||
sendToCourseList:undefined,
|
sendToCourseList:undefined,
|
||||||
openSearch:false,
|
openSearch:false,
|
||||||
sendToCourseId:undefined,
|
sendToCourseId:undefined,
|
||||||
sendToShixunArray:[],
|
sendToShixunArray:[],
|
||||||
shixunNum:0,
|
shixunNum:0,
|
||||||
Modalstype:false,
|
Modalstype:false,
|
||||||
cardsModalcancel:this.cardsModalcancel,
|
cardsModalcancel:this.cardsModalcancel,
|
||||||
cardsModalsave:this.cardsModalsave,
|
cardsModalsave:this.cardsModalsave,
|
||||||
modalsTopval:'',
|
modalsTopval:'',
|
||||||
Modalsbottomval:'',
|
Modalsbottomval:'',
|
||||||
courseurl:''
|
courseurl:''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//发送至
|
//发送至
|
||||||
SentToLesson =() =>{
|
SentToLesson =() =>{
|
||||||
this.setState({
|
this.setState({
|
||||||
sentShixunPath:true
|
sentShixunPath:true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//隐藏发送至弹框
|
//隐藏发送至弹框
|
||||||
hideSenttothevalue =()=>{
|
hideSenttothevalue =()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
sentShixunPath:false
|
sentShixunPath:false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//打开课堂列表下拉框
|
//打开课堂列表下拉框
|
||||||
openList=()=>{
|
openList=()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
openSearch:true
|
openSearch:true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//关闭课堂列表下拉框
|
//关闭课堂列表下拉框
|
||||||
closeList=()=>{
|
closeList=()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
openSearch:false
|
openSearch:false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选择课堂获取选中的Id
|
// 选择课堂获取选中的Id
|
||||||
selectCloseList=(e)=>{
|
selectCloseList=(e)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
openSearch:false,
|
openSearch:false,
|
||||||
sendToCourseId:e
|
sendToCourseId:e
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//选择checkbox
|
//选择checkbox
|
||||||
changeCheckBoxs=(list)=>{
|
changeCheckBoxs=(list)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
sendToShixunArray:list,
|
sendToShixunArray:list,
|
||||||
shixunNum:list.length
|
shixunNum:list.length
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//确认提交
|
//确认提交
|
||||||
submitInfo=()=>{
|
submitInfo=()=>{
|
||||||
let {sendToCourseId,sendToShixunArray}=this.state;
|
let {sendToCourseId,sendToShixunArray}=this.state;
|
||||||
if(sendToCourseId===undefined){
|
if(sendToCourseId===undefined){
|
||||||
this.props.showSnackbar("您还未选择发送的课堂");
|
this.props.showSnackbar("您还未选择发送的课堂");
|
||||||
}else if(parseInt(sendToShixunArray.length)==0){
|
}else if(parseInt(sendToShixunArray.length)==0){
|
||||||
this.props.showSnackbar("您还未选择实训");
|
this.props.showSnackbar("您还未选择实训");
|
||||||
}else{
|
}else{
|
||||||
let id=this.props.detailInfoList.id;
|
let id=this.props.detailInfoList.id;
|
||||||
let url="/paths/"+id+"/send_to_course.json";
|
let url="/paths/"+id+"/send_to_course.json";
|
||||||
axios.post(url,{
|
axios.post(url,{
|
||||||
shixun_ids:sendToShixunArray,
|
shixun_ids:sendToShixunArray,
|
||||||
course_id:sendToCourseId
|
course_id:sendToCourseId
|
||||||
}).then((result)=>{
|
}).then((result)=>{
|
||||||
if(result.data.status===1){
|
if(result.data.status===1){
|
||||||
this.setState({
|
this.setState({
|
||||||
Modalstype:true,
|
Modalstype:true,
|
||||||
sentShixunPath:false,
|
sentShixunPath:false,
|
||||||
Modalstopval:result.data.message,
|
Modalstopval:result.data.message,
|
||||||
courseurl:result.data.url
|
courseurl:result.data.url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
let id=this.props.detailInfoList.id;
|
let id=this.props.detailInfoList.id;
|
||||||
let url="/paths/"+id+"/choose_course.json";
|
let url="/paths/"+id+"/choose_course.json";
|
||||||
axios.get(url).then((result)=>{
|
axios.get(url).then((result)=>{
|
||||||
if(result.status==200){
|
if(result.status==200){
|
||||||
this.setState({
|
this.setState({
|
||||||
sendToCourseList:result.data
|
sendToCourseList:result.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
cardsModalcancel=()=>{
|
cardsModalcancel=()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
Modalstype:false,
|
Modalstype:false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
cardsModalsave=()=>{
|
cardsModalsave=()=>{
|
||||||
let {courseurl}=this.state;
|
let {courseurl}=this.state;
|
||||||
window.location.href = "https://www.educoder.net/"+courseurl;
|
window.location.href =courseurl;
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
let{sentShixunPath,sendToCourseList,openSearch,shixunNum,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state;
|
let{sentShixunPath,sendToCourseList,openSearch,shixunNum,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state;
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<Modals
|
<Modals
|
||||||
modalsType={Modalstype}
|
modalsType={Modalstype}
|
||||||
modalsTopval={Modalstopval}
|
modalsTopval={Modalstopval}
|
||||||
modalsBottomval={Modalsbottomval}
|
modalsBottomval={Modalsbottomval}
|
||||||
modalCancel={cardsModalcancel}
|
modalCancel={cardsModalcancel}
|
||||||
modalSave={cardsModalsave}
|
modalSave={cardsModalsave}
|
||||||
>
|
>
|
||||||
</Modals>
|
</Modals>
|
||||||
{
|
{
|
||||||
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
|
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
|
||||||
<Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂">
|
<Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂">
|
||||||
<a onClick = {this.SentToLesson} className="user_default_btn edu-greenline-btn fr font-18 mr20">
|
<a onClick = {this.SentToLesson} className="user_default_btn edu-greenline-btn fr font-18 mr20">
|
||||||
发送至
|
发送至
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>:''
|
</Tooltip>:''
|
||||||
}
|
}
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
keyboard={false}
|
keyboard={false}
|
||||||
title="发送至课堂"
|
title="发送至课堂"
|
||||||
visible={sentShixunPath}
|
visible={sentShixunPath}
|
||||||
closable={false}
|
closable={false}
|
||||||
footer={null}
|
footer={null}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
>
|
>
|
||||||
<div className="newupload_conbox">
|
<div className="newupload_conbox">
|
||||||
<div className="mb20" onMouseLeave={this.closeList}>
|
<div className="mb20" onMouseLeave={this.closeList}>
|
||||||
<Select
|
<Select
|
||||||
placeholder="请选择您要发送的课堂"
|
placeholder="请选择您要发送的课堂"
|
||||||
style={{"width":"100%"}}
|
style={{"width":"100%"}}
|
||||||
onSelect={this.selectCloseList}
|
onSelect={this.selectCloseList}
|
||||||
onMouseEnter={this.openList}
|
onMouseEnter={this.openList}
|
||||||
defaultOpen={false}
|
defaultOpen={false}
|
||||||
open={openSearch}
|
open={openSearch}
|
||||||
optionLabelProp="name"
|
optionLabelProp="name"
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
sendToCourseList === undefined ? "": sendToCourseList.courses.map((item,key)=>{
|
sendToCourseList === undefined ? "": sendToCourseList.courses.map((item,key)=>{
|
||||||
return(
|
return(
|
||||||
<Option key={item.course_id} id={key} name={item.course_name}>
|
<Option key={item.course_id} id={key} name={item.course_name}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col className="fl with70 task-hide">{item.course_name}</Col>
|
<Col className="fl with70 task-hide">{item.course_name}</Col>
|
||||||
<Col className="fl color-grey-9 with30 edu-txt-center">{item.created_at}</Col>
|
<Col className="fl color-grey-9 with30 edu-txt-center">{item.created_at}</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Option>
|
</Option>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="edu-back-skyblue pl15 pr15 clearfix over280 pt5">
|
<div className="edu-back-skyblue pl15 pr15 clearfix over280 pt5">
|
||||||
<CheckboxGroup onChange={this.changeCheckBoxs}>
|
<CheckboxGroup onChange={this.changeCheckBoxs}>
|
||||||
|
|
||||||
{
|
{
|
||||||
sendToCourseList && sendToCourseList.stages.map((item,key)=>{
|
sendToCourseList && sendToCourseList.stages.map((item,key)=>{
|
||||||
return(
|
return(
|
||||||
item.shixuns.map((items,keys)=>{
|
item.shixuns.map((items,keys)=>{
|
||||||
return(
|
return(
|
||||||
<div className="mt5" key={keys}>
|
<div className="mt5" key={keys}>
|
||||||
<Checkbox name={key} value={items.shixun_id}>{items.shixun_name}</Checkbox>
|
<Checkbox name={key} value={items.shixun_id}>{items.shixun_name}</Checkbox>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</div>
|
</div>
|
||||||
<p className="color-grey-9 pl15 font-12 mt10">已选择 {shixunNum} 个实训</p>
|
<p className="color-grey-9 pl15 font-12 mt10">已选择 {shixunNum} 个实训</p>
|
||||||
<div className="mt20 clearfix edu-txt-center">
|
<div className="mt20 clearfix edu-txt-center">
|
||||||
<a onClick={this.hideSenttothevalue} className="pop_close task-btn mr30">取消</a>
|
<a onClick={this.hideSenttothevalue} className="pop_close task-btn mr30">取消</a>
|
||||||
<a className="task-btn task-btn-orange" onClick={this.submitInfo}>确定</a>
|
<a className="task-btn task-btn-orange" onClick={this.submitInfo}>确定</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
export default SnackbarHOC()(sendPanel);
|
export default SnackbarHOC()(sendPanel);
|
Loading…
Reference in new issue