实践课程新建阶段-增加添加实训项目的入口

chromesetting
杨树明 5 years ago
parent ad9c38f002
commit 286fc11d87

@ -0,0 +1,73 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input} from 'antd';
class Addshixuns extends Component {
constructor(props) {
super(props);
this.state = {
shixunname:undefined,
}
}
handleChange=(e)=>{
this.setState({
shixunname:e.target.value,
})
}
modalCancel=()=>{
this.setState({
shixunname:undefined,
})
this.props.modalCancel()
}
modalSave=()=>{
let {shixunname}=this.state;
this.props.Setaddshixuns(shixunname);
this.props.modalCancel();
}
render() {
return(
<Modal
className={this.props.className}
keyboard={false}
title="添加实训项目"
visible={this.props.Addshixunstype===undefined?false:this.props.Addshixunstype}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
width="530px"
>
{this.props.Addshixunstype===true?<style>
{
`
body{
overflow: hidden !important;
}
`
}
</style>:""}
<div className="task-popup-content">
<p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span>
<span><Input style={{ width:"80%"}} className="yslzxueshisy " placeholder="请输入60字以内的实训名称" onChange={this.handleChange} addonAfter={String(this.state.shixunname===undefined?0:this.state.shixunname.length)+"/60"} maxLength={60} />
</span>
</p>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 colorFFF" onClick={this.modalCancel}>取消</a>
<a className="task-btn task-btn-orange" onClick={this.modalSave}>确定</a>
</div>
</div>
</Modal>
)
}
}
export default Addshixuns;

@ -3,6 +3,7 @@ import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd"; import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd'; import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import Addshixuns from './Addshixuns';
import '../ShixunPaths.css'; import '../ShixunPaths.css';
import axios from 'axios'; import axios from 'axios';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel'; import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
@ -52,7 +53,8 @@ class DetailCardsEditAndAdd extends Component{
Modalsbottomval:"", Modalsbottomval:"",
ChooseShixunListshixun_list:undefined, ChooseShixunListshixun_list:undefined,
stage_nametype:false, stage_nametype:false,
descriptiontype:false descriptiontype:false,
Addshixunstype:false
} }
this.onDragEnd = this.onDragEnd.bind(this); this.onDragEnd = this.onDragEnd.bind(this);
} }
@ -113,9 +115,12 @@ class DetailCardsEditAndAdd extends Component{
for(var z=0; z<newshixun_lists.length; z++){ for(var z=0; z<newshixun_lists.length; z++){
newshixuns_listedit.push(newshixun_lists[z]); newshixuns_listedit.push(newshixun_lists[z]);
} }
for(var i=0; i<newshixun_lists.length; i++){ for(var i=0; i<newshixun_lists.length; i++){
list.push(newshixun_lists[i].shixun_id); list.push(newshixun_lists[i].shixun_id);
} }
this.setState({ this.setState({
shixuns_listedit:newshixuns_listedit, shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list, shixuns_listeditlist:list,
@ -224,7 +229,8 @@ class DetailCardsEditAndAdd extends Component{
Modalstype:false, Modalstype:false,
Modalstopval:'', Modalstopval:'',
Modalsbottomval:'', Modalsbottomval:'',
delectfunvalue:undefined delectfunvalue:undefined,
Addshixunstype:false
}) })
} }
@ -308,6 +314,41 @@ class DetailCardsEditAndAdd extends Component{
}) })
} }
Addshixuns=()=>{
this.setState({
Addshixunstype:true,
})
}
Getaddshixuns=(value)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
} = this.state
let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
name:value
}).then((response) => {
if(response){
if(response.data){
newshixuns_listedit.push(response.data);
list.push(response.data.shixun_id);
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
patheditarry:[],
selectShixun:false,
page:1,
})
}
}
}).catch((error) => {
console.log(error)
});
}
render(){ render(){
let {selectShixun, let {selectShixun,
@ -340,6 +381,22 @@ class DetailCardsEditAndAdd extends Component{
> >
</Modals> </Modals>
{this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)}
{...this.props}
{...this.state}
/>:""}
<style>
{
`
.mb10 {
margin-bottom: 10px !important;
}
`
}
</style>
{ editPanel && { editPanel &&
<div className="lesson-edit-content mb10"> <div className="lesson-edit-content mb10">
<div className="clearfix edu-back-white pt30 pb30"> <div className="clearfix edu-back-white pt30 pb30">
@ -371,13 +428,20 @@ class DetailCardsEditAndAdd extends Component{
<div className={descriptiontype===true?"red":"none"}>描述不能超多最大限制300个字符</div> <div className={descriptiontype===true?"red":"none"}>描述不能超多最大限制300个字符</div>
</div> </div>
<p className="clearfix mb30"> <p className="clearfix mb10">
<a onClick={this.AddShixunBox} className="fl defalutGreyBorder color-grey-6 ml37"> <a onClick={()=>this.AddShixunBox()} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i> <i className="iconfont icon-tianjiafangda fl mr5"></i>
选用实训项目</a> 选用实训项目</a>
<span id="sx_notice" className="fl ml20 color-grey-9 mt5">选择下面实训后可以通过拖拽进行排序调整</span> <span id="sx_notice" className="fl ml20 color-grey-9 mt5">选择下面实训后可以通过拖拽进行排序调整</span>
</p> </p>
<p className="clearfix mb30">
<a onClick={()=>this.Addshixuns()} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
添加实训项目</a>
<span id="sx_notice" className="fl ml20 color-grey-9 mt5">您只需输入实训名称即可完成实训项目的添加进入实训详情后可进行具体配置操作</span>
</p>
{selectShixun===true?<style> {selectShixun===true?<style>
{ {
` `

@ -3,6 +3,7 @@ import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd"; import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd'; import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import Addshixuns from './Addshixuns';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel'; import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
import '../ShixunPaths.css'; import '../ShixunPaths.css';
import axios from 'axios'; import axios from 'axios';
@ -54,7 +55,8 @@ class DetailCardsEditAndEdit extends Component{
delectfunvalue:undefined, delectfunvalue:undefined,
ChooseShixunListshixun_list:undefined, ChooseShixunListshixun_list:undefined,
stage_nametype:false, stage_nametype:false,
descriptiontype:false descriptiontype:false,
Addshixunstype:false
} }
this.onDragEnd = this.onDragEnd.bind(this); this.onDragEnd = this.onDragEnd.bind(this);
} }
@ -74,12 +76,11 @@ class DetailCardsEditAndEdit extends Component{
}) })
} }
searchNameInput=(e)=>{ Addshixuns=()=>{
this.setState({ this.setState({
search:e.target.value Addshixunstype:true,
}) })
} }
shixunhomeworkedit=(list)=>{ shixunhomeworkedit=(list)=>{
@ -266,9 +267,11 @@ class DetailCardsEditAndEdit extends Component{
Modalstype:false, Modalstype:false,
Modalstopval:'', Modalstopval:'',
Modalsbottomval:'', Modalsbottomval:'',
delectfunvalue:undefined delectfunvalue:undefined,
Addshixunstype:false
}) })
} }
cardsModalsave=()=>{ cardsModalsave=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,
@ -317,7 +320,37 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data); notification.open(data);
} }
render(){ Getaddshixuns=(value)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
} = this.state
let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
name:value
}).then((response) => {
if(response){
if(response.data){
newshixuns_listedit.push(response.data);
list.push(response.data.shixun_id);
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
patheditarry:[],
selectShixun:false,
page:1,
})
}
}
}).catch((error) => {
console.log(error)
});
}
render(){
let {selectShixun, let {selectShixun,
editPanel, editPanel,
ChooseShixunList, ChooseShixunList,
@ -348,7 +381,21 @@ class DetailCardsEditAndEdit extends Component{
modalSave={delectfunvalue===undefined?()=>this.cardsModalsave():()=>this.shixunslisteditdelectfun()} modalSave={delectfunvalue===undefined?()=>this.cardsModalsave():()=>this.shixunslisteditdelectfun()}
> >
</Modals> </Modals>
{this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)}
{...this.props}
{...this.state}
/>:""}
<style>
{
`
.mb10 {
margin-bottom: 10px !important;
}
`
}
</style>
{ this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true? { this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true?
<div className="lesson-edit-content mb10"> <div className="lesson-edit-content mb10">
@ -381,13 +428,21 @@ class DetailCardsEditAndEdit extends Component{
></textarea> ></textarea>
<div className={descriptiontype===true?"red":"none"}>描述不能超多最大限制300个字符</div> <div className={descriptiontype===true?"red":"none"}>描述不能超多最大限制300个字符</div>
</div> </div>
<p className="clearfix mb30">
<p className="clearfix mb10">
<a onClick={this.AddShixunBox} className="fl defalutGreyBorder color-grey-6 ml37"> <a onClick={this.AddShixunBox} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i> <i className="iconfont icon-tianjiafangda fl mr5"></i>
</a> </a>
<span id="sx_notice" className="fl ml20 color-grey-9 mt5">选择下面实训后可以通过拖拽进行排序调整</span> <span id="sx_notice" className="fl ml20 color-grey-9 mt5">选择下面实训后可以通过拖拽进行排序调整</span>
</p> </p>
<p className="clearfix mb30">
<a onClick={this.Addshixuns} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
</a>
<span id="sx_notice" className="fl ml20 color-grey-9 mt5">您只需输入实训名称即可完成实训项目的添加进入实训详情后可进行具体配置操作</span>
</p>
{selectShixun===true?<style> {selectShixun===true?<style>
{ {
` `

@ -26,6 +26,10 @@ class NewFooter extends Component {
max-height: 140px !important; max-height: 140px !important;
padding-bottom: 20px !important; padding-bottom: 20px !important;
} }
p {
margin-top: 0;
margin-bottom:0px !important;
}
` `
} }
</style> </style>

@ -1284,7 +1284,9 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}> <div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div> <div className="overPart"></div>
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===false?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}> <ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===false?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>} {this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===false?
<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>:""
}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>} {shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"": {this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.main_site===true||this.props.user&&this.props.user.admin===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:"" pathstype===true?"":this.props.user&&this.props.user.main_site===true||this.props.user&&this.props.user.admin===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""

Loading…
Cancel
Save