fork功能调整

chromesetting
杨树明 5 years ago
parent 4d5f902f1c
commit e170214ed9

@ -15,6 +15,7 @@ import axios from 'axios'
import Modals from '../modals/Modals'; import Modals from '../modals/Modals';
import './shixuns/css/TPMBanner.css'; import './shixuns/css/TPMBanner.css';
import types from "../../redux/actions/actionTypes";
let $ = window.$; let $ = window.$;
@ -22,6 +23,8 @@ const Search = Input.Search;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const { TextArea } = Input;
class TPMBanner extends Component { class TPMBanner extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -54,7 +57,9 @@ class TPMBanner extends Component {
Senttothevcaluetype: false, Senttothevcaluetype: false,
jupyterbool: false, jupyterbool: false,
openknow:false, openknow:false,
openshowpublictype:false openshowpublictype:false,
Radiovalue:1,
TextAreaintshow:false
} }
} }
@ -197,13 +202,46 @@ class TPMBanner extends Component {
}) })
} }
changeTextArea=(e)=>{
this.setState({
TextArea:e.target.value
})
}
addForkvisible = () => { addForkvisible = () => {
let reason;
switch (this.state.Radiovalue) {
case 1:
reason="Shixun";
break;
case 2:
reason="Course";
break;
case 3:
reason="Subject";
break;
case 4:
reason=this.state.TextArea;
}
if(this.state.Radiovalue===4){
if(this.state.TextArea===null||this.state.TextArea===undefined||this.state.TextArea=== ""){
this.setState({
TextAreaintshow:true
})
return
}
}
this.setState({ this.setState({
Forkvisibletype:true, Forkvisibletype:true,
}) })
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/copy.json"; let url = "/shixuns/" + id + "/copy.json";
axios.post(url).then((response) => { axios.post(url, {
reason:reason,
}).then((response) => {
if (response.data.status === 401) { if (response.data.status === 401) {
} else { } else {
@ -212,7 +250,7 @@ class TPMBanner extends Component {
Forkauthentication: false, Forkauthentication: false,
// Forkvisibletype:false // Forkvisibletype:false
}) })
window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; // window.location.href = "/shixuns/" + response.data.shixun + "/challenges";
} }
}).catch((error) => { }).catch((error) => {
@ -694,17 +732,9 @@ class TPMBanner extends Component {
} }
showonMouseOver = () => { onChangeRadiovalue=(e)=>{
$("#ratePanel").show();
this.setState({
showradios: true
})
}
hideonMouseOut = () => {
$("#ratePanel").hide();
this.setState({ this.setState({
showradios: false Radiovalue:e.target.value
}) })
} }
@ -1233,9 +1263,34 @@ class TPMBanner extends Component {
</span> </span>
</Tooltip> </Tooltip>
{Forkvisible===true?<style>
{
`
.ant-modal-body{
padding: 10px;
}
`
}
</style>:""}
{
this.state.TextAreaintshow===true?<style>
{
`
.ant-input:hover {
border: 1px solid red !important;
}
.ant-input:focus {
border: 1px solid red !important;
}
`
}
</style>:""
}
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="Fork原因"
visible={Forkvisible} visible={Forkvisible}
closable={false} closable={false}
footer={null} footer={null}
@ -1247,8 +1302,25 @@ class TPMBanner extends Component {
> >
</Spin> : </Spin> :
<div> <div>
<div className="task-popup-content"><p <div className="task-popup-content">
className="task-popup-text-center font-16 pb20">复制将在后台执行平台将为你创建<br/>一个新的同名实训和内容请问是否继续</p> <div className={"forkfactors"}>请根据实际情况填写fork本实训的原因</div>
<Radio.Group onChange={this.onChangeRadiovalue} value={this.state.Radiovalue} className={"ml20 mt20 mb20"} style={{ width: "100%" }}>
<Radio style={radioStyle} value={1}>
实训内容升级
</Radio>
<Radio style={radioStyle} value={2}>
课堂教学使用
</Radio>
<Radio style={radioStyle} value={3}>
实践课程使用
</Radio>
<Radio style={radioStyle} value={4}>
其它原因
</Radio>
{this.state.Radiovalue === 4 ?
<TextArea className={this.state.TextAreaintshow===true?"bor-red mt10":"mt10"} rows={4} style={{ width: '85%', marginLeft: '30px' }} onInput={this.changeTextArea}/>: null}
{this.state.TextAreaintshow===true?<div className={"color-red ml30"}>不能为空</div>:""}
</Radio.Group>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
<a onClick={this.hideForkvisible} className="task-btn fl">取消</a> <a onClick={this.hideForkvisible} className="task-btn fl">取消</a>

@ -160,3 +160,9 @@ a:active{text-decoration:none;}
.mlbanner36{ .mlbanner36{
margin-left: 36px; margin-left: 36px;
} }
.forkfactors{
text-align: center;
color: #999999;
}
Loading…
Cancel
Save