Merge branch 'dev_jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

chromesetting
杨树林 6 years ago
commit 900fff4480

@ -763,7 +763,7 @@ class ShixunsController < ApplicationController
else else
commit = GitService.commits(repo_path: @repo_path).try(:first) commit = GitService.commits(repo_path: @repo_path).try(:first)
uid_logger("First comit########{commit}") uid_logger("First comit########{commit}")
tip_exception("开启挑战前请先在Jupyter中填写内容") if commit.blank? tip_exception("开启挑战前请先在Jupyter中填写内容并保存") if commit.blank?
commit_id = commit["id"] commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge') cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10 myshixun_identifier = generate_identifier Myshixun, 10

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 15:02:52 * @Date: 2019-11-27 15:02:52
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 19:06:48 * @LastEditTime: 2019-12-20 20:07:11
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
@ -160,7 +160,7 @@ function MyMonacoEditor (props, ref) {
</Tooltip> </Tooltip>
<Tooltip <Tooltip
placement="bottom" placement="bottom"
title="重置" title="恢复"
> >
<MyIcon <MyIcon
className="flex_normal" className="flex_normal"

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-04 08:36:21 * @Date: 2019-12-04 08:36:21
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 19:29:39 * @LastEditTime: 2019-12-20 20:05:57
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -67,7 +67,7 @@ function RecordDetail (props) {
<span>{detail.name || 'test'}</span> <span>{detail.name || 'test'}</span>
</div> </div>
<div className={'study_quit'}> <div className={'study_quit'}>
<Button> <Button style={{ visibility: identifier ? 'visible' : 'hidden'}}>
<Link to={`/myproblems/${identifier}`}>返回该题</Link> <Link to={`/myproblems/${identifier}`}>返回该题</Link>
</Button> </Button>
</div> </div>
@ -98,6 +98,7 @@ function RecordDetail (props) {
<div className="detail_ctx_header"> <div className="detail_ctx_header">
<h2 className="header_h2">提交内容</h2> <h2 className="header_h2">提交内容</h2>
<Button <Button
style={{ visibility: identifier ? 'visible' : 'hidden'}}
className={'header_btn'} className={'header_btn'}
type="primary" type="primary"
> >

@ -93,14 +93,14 @@ class Addshixuns extends Component {
</style>:""} </style>:""}
<div className="task-popup-content"> <div className="task-popup-content">
{/*<Form {...formItemLayout}>*/} <Form {...formItemLayout}>
{/* <Form.Item label="实训类型">*/} <Form.Item label="实训类型">
{/* <Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>*/} <Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>
{/* <Radio value="1">普通实训</Radio>*/} <Radio value="1">普通实训</Radio>
{/* <Radio value="2">jupyter实训</Radio>*/} <Radio value="2">jupyter实训</Radio>
{/* </Radio.Group>*/} </Radio.Group>
{/* </Form.Item>*/} </Form.Item>
{/*</Form>*/} </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} />

@ -298,7 +298,7 @@ export default class Shixuninformation extends Component {
return ( return (
<div> <div>
<div className="educontent mb200 edu-back-white padding10-20 pdb30 mb50"> <div className="educontent mb200 edu-back-white padding10-20 pdb30 mb50">
<div className="clearfix ml40"> {this.props&&this.props.is_jupyter===true?"":<div className="clearfix ml40">
<span className="color-grey-6 mt5 fl font-16 ml20" style={{minWidth: '45px'}}>复制:</span> <span className="color-grey-6 mt5 fl font-16 ml20" style={{minWidth: '45px'}}>复制:</span>
<span className="fl mt8 ml13"> <span className="fl mt8 ml13">
<Checkbox <Checkbox
@ -306,7 +306,7 @@ export default class Shixuninformation extends Component {
onChange={this.CheckboxonChange}></Checkbox> onChange={this.CheckboxonChange}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许已职业认证的教师复制该实训</label> <label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许已职业认证的教师复制该实训</label>
</span> </span>
</div> </div>}
<div className="edu-back-white mb10 ml30 mt20"> <div className="edu-back-white mb10 ml30 mt20">
<div> <div>

@ -460,7 +460,7 @@ class Newshixuns extends Component {
{getFieldDecorator('is_jupyter')( {getFieldDecorator('is_jupyter')(
<Radio.Group onChange={this.RadiovalueonChange} value={this.state.Radiovalue}> <Radio.Group onChange={this.RadiovalueonChange} value={this.state.Radiovalue}>
<Radio value="1">普通实训</Radio> <Radio value="1">普通实训</Radio>
{this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true?<Radio value="2" >Jupyter实训</Radio>:""} <Radio value="2" >Jupyter实训</Radio>
</Radio.Group>, </Radio.Group>,
)} )}
</Form.Item> </Form.Item>

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 16:35:46 * @Date: 2019-11-20 16:35:46
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 18:46:00 * @LastEditTime: 2019-12-20 19:54:09
*/ */
import types from './actionTypes'; import types from './actionTypes';
import CONST from '../../constants'; import CONST from '../../constants';
@ -135,22 +135,22 @@ export const validateOjForm = (props, type) => {
} else { } else {
// 唯一性校验 // 唯一性校验
const bool = testCases.some((item, j) => { const bool = testCases.some((item, j) => {
if (i !== j) { if (i > j && key === 'input') {
return (item[key] === value); return (item[key] === value);
} else { } else {
return false; return false;
} }
}); });
// if (bool) { if (bool) {
// hasSuccess = false; hasSuccess = false;
// validateResult = { validateResult = {
// [key]: { [key]: {
// validateStatus: 'error', validateStatus: 'error',
// errMsg: key === 'input' ? '输入值必须是唯一的' : '输出值必须是唯一的' errMsg: `与测试用例${i}的输入值重复了,请重新填写`
// } }
// }; };
// } }
} }
Object.assign(tempObj, validateResult); Object.assign(tempObj, validateResult);
}); });
@ -481,48 +481,48 @@ export const testCaseInputChange = (value, index) => {
// 测试用例输出值改变时 // 测试用例输出值改变时
export const testCaseOutputChange = (value, index) => { export const testCaseOutputChange = (value, index) => {
// const validate = emptyValidate('output', value)['output']; const validate = emptyValidate('output', value)['output'];
// return { return {
// type: types.TEST_CASE_OUTPUT_CHANGE,
// payload: {
// output: validate,
// value,
// index
// }
// }
return (dispatch, getState) => {
// 非空校验
let validate = emptyValidate('output', value)['output'];
if (!validate.errMsg) {
// 唯一性校验
const {testCases} = getState().ojFormReducer;
let _errMsg = '输出值不能为空';
const bool = testCases.some((item, i) => {
if (i !== index) {
// if (item['output'] === value) {
// _errMsg=`与测试用例${index}的输入值重复了,请重新填写`;
// }
return item['output'] === value;
} else {
return false;
}
});
if (bool) {
validate = {
validateStatus: 'error',
errMsg: _errMsg
};
}
}
dispatch({
type: types.TEST_CASE_OUTPUT_CHANGE, type: types.TEST_CASE_OUTPUT_CHANGE,
payload: { payload: {
output: validate, output: validate,
value, value,
index index
} }
});
} }
// return (dispatch, getState) => {
// // 非空校验
// let validate = emptyValidate('output', value)['output'];
// if (!validate.errMsg) {
// // 唯一性校验
// const {testCases} = getState().ojFormReducer;
// let _errMsg = '';
// const bool = testCases.some((item, i) => {
// if (i !== index) {
// // if (item['output'] === value) {
// // _errMsg=`与测试用例${index}的输入值重复了,请重新填写`;
// // }
// return item['output'] === value;
// } else {
// return false;
// }
// });
// if (bool) {
// validate = {
// validateStatus: 'error',
// errMsg: _errMsg
// };
// }
// }
// dispatch({
// type: types.TEST_CASE_OUTPUT_CHANGE,
// payload: {
// output: validate,
// value,
// index
// }
// });
// }
} }
// // 调试代码时,更改对应的状态值 // // 调试代码时,更改对应的状态值

Loading…
Cancel
Save