chromesetting
杨树明 5 years ago
parent fa67691eee
commit 625a68f9c1

@ -20,7 +20,7 @@ import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
import TPMsettings from './TPMsettings/TPMsettings';
import TPMsettings from './TPMsettings/oldTPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer';
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent';

@ -33,7 +33,24 @@ const Option = Select.Option;
const RadioGroup = Radio.Group;
const confirm = Modal.confirm;
function range(start, end) {
const result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
function disabledDateTime() {
return {
// disabledHours: () => range(0, 24).splice(4, 20),
disabledMinutes: () => range(1, 30).concat(range(31, 60)),
// disabledSeconds: () => [0, 60],
};
}
function disabledDate(current) {
return current && current < moment().endOf('day').subtract(1, 'days');
}
export default class Shixuninformation extends Component {

@ -25,9 +25,9 @@ import axios from 'axios';
import TPMMDEditor from "../challengesnew/TPMMDEditor";
import Bottomsubmit from "../../modals/Bottomsubmit";
import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
import {TPMIndexHOC} from "../TPMIndexHOC";
import {getUploadActionUrl} from 'educoder';
import './css/TPMsettings.css';
@ -43,10 +43,35 @@ class Shixuninformation extends Component {
NAME_COUNT: 60,
shixunmemoMDvalue: "",
language: "java",
testscripttiptype:false
testscripttiptype:false,
shixunName:'',
trainee:undefined,
choice_small_type:[]
}
}
componentDidMount() {
}
componentDidUpdate(prevProps, prevState) {
if(prevProps.data!=this.props.data){
console.log(this.props.data)
if(this.props.data){
this.setState({
shixunName:this.props.data.shixun.name,
trainee:this.props.data.shixun.trainee,
choice_main_type:this.props.data.shixun.choice_main_type,
choice_small_type:this.props.data.shixun.choice_small_type
})
this.props.form.setFieldsValue({
name:this.props.data.shixun.name,
})
this.contentMdRef.current.setValue(this.props.data.shixun.description);
}
}
}
getshixunmemoMDvalue = (value, e) => {
@ -194,12 +219,104 @@ class Shixuninformation extends Component {
}
bigClass = (value) => {
let list=[]
list.push(this.props.data.shixun.choice_main_type)
this.props.data.shixun.choice_small_type.map((item,key)=>{
list.push(item)
})
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
let newshixun_service_configsagin=[];
newshixun_service_configs.map((item,key)=>{
list.map((its,index)=>{
if(item.mirror_repository_id===its){
newshixun_service_configsagin.push(item)
}
})
})
this.props.data.shixun.main_type.some((item,key)=> {
if (item.id === value) {
newshixun_service_configsagin[0]={
mirror_repository_id:value,
name:item.type_name,
cpu_limit:1,
lower_cpu_limit:0.1,
memory_limit:1024,
request_limit:10
}
return true
}
}
)
let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
axios.get(url).then((response) => {
if (response.status === 200) {
// console.log(response.data)
this.setState({
choice_main_type: value,
standard_scripts:response.data,
choice_standard_scripts:null,
shixun_service_configs:newshixun_service_configsagin,
shixun_service_configlist:newshixun_service_configsagin,
})
}
}).catch((error) => {
console.log(error)
});
}
littleClass = (value) => {
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
let newchoice_small_type=this.props.data.shixun.choice_small_type;
let list=[]
list.push(this.props.data.shixun.choice_main_type)
newchoice_small_type.map((item,key)=>{
list.push(item)
})
let newshixun_service_configsagin=[]
newshixun_service_configs.map((item,key)=>{
list.map((its,index)=>{
if(item.mirror_repository_id===its){
newshixun_service_configsagin.push(item)
}
})
})
this.props.data.shixun.small_type.some((items,keys)=> {
if (items.id === value) {
newshixun_service_configsagin.push({
mirror_repository_id:value,
name:items.type_name,
cpu_limit:1,
lower_cpu_limit:0.1,
memory_limit:1024,
request_limit:10
})
return true
}
}
)
newchoice_small_type.push(value)
this.setState({
choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configsagin,
shixun_service_configlist:newshixun_service_configsagin,
})
}
render() {
console.log(this.props.data)
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
console.log(operateauthority)
const {getFieldDecorator} = this.props.form;
const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state;
const {shixun_service_configs}=this.props;
let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false;
const uploadProps = {
width: 600,
fileList,
@ -246,6 +363,7 @@ class Shixuninformation extends Component {
return (
<div>
<Form>
@ -289,13 +407,14 @@ class Shixuninformation extends Component {
style={{"borderBottom": 'none'}}
className="chooseDes pr"
>
{getFieldDecorator('select', {
{getFieldDecorator('trainee', {
rules: [{required: true, message: '请选择难易度'}],
})(
<div className="with15 fl pr">
<Select placeholder="请选择难易度"
style={{width: 180}}
onChange={this.Selectthestudent}
value={this.state.trainee}
>
<Option value={1}>初级</Option>
<Option value={2}>中级</Option>
@ -319,16 +438,9 @@ class Shixuninformation extends Component {
rules: [{required: true, message: '请选择主类别'}],
})(
<div className="width100 fl mr20">
<Select placeholder="请选择主类别" value={this.props.choice_main_type === "" ? undefined : this.props.choice_main_type}
<Select placeholder="请选择主类别" value={this.state.choice_main_type === "" ? undefined : this.state.choice_main_type}
style={{width: 180}}
onChange={this.props.operateauthority?this.bigClass:""}
// onMouseEnter={this.bigopen}
// onMouseLeave={this.bigopens}
// disabled={this.props.operateauthority?false:true}
// onMouseEnter={operateauthority?this.bigopen:""}
onSelect={this.props.operateauthority?this.bigopens:""}
// open={opers}
onChange={operateauthority?this.bigClass:""}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
@ -364,16 +476,19 @@ class Shixuninformation extends Component {
})(
<div className=" fl pr mr20">
<Select placeholder="请选择小类别"
style={{width: 180}}
onChange={this.selectright}
value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type}
style={{width: 180,height:30}}
disabled={operateauthority?false:true}
onDeselect={operateauthority?this.Deselectlittle:""}
onSelect={operateauthority?this.littleClass:""}
defaultOpen={false}
>
{
newshixunlist === undefined ? "" : newshixunlist.small_type.map((item, key) => {
return (
this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => {
return(
<Option value={item.id} key={key}>
<Tooltip placement="right"
title={item.description === "" ? "无描述" : item.description}>
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} >
{item.type_name}
</Tooltip>
</Option>
@ -408,7 +523,7 @@ class Shixuninformation extends Component {
style={{"borderBottom": 'none'}}
className="chooseDes pr"
>
{getFieldDecorator('select', {
{getFieldDecorator('select123', {
rules: [{required: true, message: '请选择评测脚本'}],
})(
<div className="with15 fl pr">
@ -638,7 +753,7 @@ class Shixuninformation extends Component {
{/*</Form>*/}
</Modal>
<Bottomsubmit url={`/shixuns/${this.props.match.params.shixunId}/challenges`} onSubmits={ this.sendsure_apply}/>
<Modal
keyboard={false}
title="提示"

@ -11,17 +11,10 @@ import Configuration from './Configuration';
import LearningSettings from './LearningSettings';
import Bottomsubmit from "../../modals/Bottomsubmit";
import moment from 'moment';
import axios from 'axios';
import './css/TPMsettings.css';
import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
const {TabPane} = Tabs;
// 处理整点 半点
@ -124,7 +117,7 @@ export default class TPMsettings extends Component {
</Tabs>
</div>
<Bottomsubmit/>
</div>
);

@ -589,10 +589,10 @@ class Newshixuns extends Component {
)}
<span className="fl ml20 color-grey lineh-20">
<div>
{this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" :
{this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
<div className={"font-12"} style={{'max-width':'700px'}}>
{`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`}
{` 说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`}
{`已安装软件:${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`}
{` 说明:添加了${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`}
</div>}
</div>

Loading…
Cancel
Save