chromesetting
杨树明 5 years ago
parent 763af53e9a
commit dded28be5d

@ -1,12 +1,13 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import {Modal,Input} from 'antd'; import {Modal,Input,Form,Radio} from 'antd';
class Addshixuns extends Component { class Addshixuns extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
shixunname:undefined, shixunname:undefined,
shixunzero:false shixunzero:false,
is_jupyter:"1"
} }
} }
@ -52,12 +53,22 @@ class Addshixuns extends Component {
}) })
return return
} }
this.props.Setaddshixuns(shixunname);
let is_jupyter=this.state.is_jupyter==="1"?false:true
this.props.Setaddshixuns(shixunname,is_jupyter);
this.props.modalCancel(); this.props.modalCancel();
} }
GrouponChange = e => {
this.setState({
is_jupyter: e.target.value,
});
};
render() { render() {
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
};
return( return(
<Modal <Modal
className={this.props.className} className={this.props.className}
@ -81,6 +92,14 @@ class Addshixuns extends Component {
</style>:""} </style>:""}
<div className="task-popup-content"> <div className="task-popup-content">
<Form {...formItemLayout}>
<Form.Item label="实训类型">
<Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>
<Radio value="1">普通实训</Radio>
<Radio value="2">jupyter实训</Radio>
</Radio.Group>
</Form.Item>
</Form>
<p className="task-popup-text-center font-16"> <p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span> <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><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} />

@ -320,7 +320,7 @@ class DetailCardsEditAndAdd extends Component{
}) })
} }
Getaddshixuns=(value)=>{ Getaddshixuns=(value,is_jupyter)=>{
let { let {
shixuns_listeditlist, shixuns_listeditlist,
shixuns_listedit, shixuns_listedit,
@ -329,7 +329,8 @@ class DetailCardsEditAndAdd extends Component{
let list=shixuns_listeditlist let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json'; let url='/paths/add_shixun_to_stage.json';
axios.post(url,{ axios.post(url,{
name:value name:value,
is_jupyter:is_jupyter
}).then((response) => { }).then((response) => {
if(response){ if(response){
if(response.data){ if(response.data){
@ -383,7 +384,7 @@ class DetailCardsEditAndAdd extends Component{
{this.state.Addshixunstype===true?<Addshixuns {this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel} modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)} Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props} {...this.props}
{...this.state} {...this.state}
/>:""} />:""}

@ -320,7 +320,7 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data); notification.open(data);
} }
Getaddshixuns=(value)=>{ Getaddshixuns=(value,is_jupyter)=>{
let { let {
shixuns_listeditlist, shixuns_listeditlist,
shixuns_listedit, shixuns_listedit,
@ -329,7 +329,8 @@ class DetailCardsEditAndEdit extends Component{
let list=shixuns_listeditlist let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json'; let url='/paths/add_shixun_to_stage.json';
axios.post(url,{ axios.post(url,{
name:value name:value,
is_jupyter:is_jupyter
}).then((response) => { }).then((response) => {
if(response){ if(response){
if(response.data){ if(response.data){
@ -383,7 +384,7 @@ class DetailCardsEditAndEdit extends Component{
</Modals> </Modals>
{this.state.Addshixunstype===true?<Addshixuns {this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel} modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)} Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props} {...this.props}
{...this.state} {...this.state}
/>:""} />:""}

@ -96,17 +96,15 @@ class Newshixuns extends Component {
axios.post(Url, { axios.post(Url, {
description: mdContnet, description: mdContnet,
main_type: values.main_type, main_type: values.main_type,
is_jupyter: values.is_jupyter === "2" ? true : false,
sub_type: values.sub_type, sub_type: values.sub_type,
shixun: { shixun: {
name: values.name, name: values.name,
trainee: values.select, trainee: values.select,
task_pass: 1 is_jupyter: values.is_jupyter === "2" ? true : false,
} }
} }
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
debugger
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
} else { } else {

Loading…
Cancel
Save