From ec4eba76ce2964b8c4ea6b853b98c9d26dba4da9 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 20 Dec 2019 19:57:09 +0800 Subject: [PATCH 1/4] update test case tip --- public/react/src/redux/actions/ojForm.js | 102 +++++++++++------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 56c7a60bb..b4d43812d 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:35:46 * @LastEditors: tangjiang - * @LastEditTime: 2019-12-20 18:46:00 + * @LastEditTime: 2019-12-20 19:54:09 */ import types from './actionTypes'; import CONST from '../../constants'; @@ -135,22 +135,22 @@ export const validateOjForm = (props, type) => { } else { // 唯一性校验 const bool = testCases.some((item, j) => { - if (i !== j) { + if (i > j && key === 'input') { return (item[key] === value); } else { return false; } }); - // if (bool) { - // hasSuccess = false; - // validateResult = { - // [key]: { - // validateStatus: 'error', - // errMsg: key === 'input' ? '输入值必须是唯一的' : '输出值必须是唯一的' - // } - // }; - // } + if (bool) { + hasSuccess = false; + validateResult = { + [key]: { + validateStatus: 'error', + errMsg: `与测试用例${i}的输入值重复了,请重新填写` + } + }; + } } Object.assign(tempObj, validateResult); }); @@ -481,48 +481,48 @@ export const testCaseInputChange = (value, index) => { // 测试用例输出值改变时 export const testCaseOutputChange = (value, index) => { - // const validate = emptyValidate('output', value)['output']; - // 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 - }; - } + const validate = emptyValidate('output', value)['output']; + return { + type: types.TEST_CASE_OUTPUT_CHANGE, + payload: { + output: validate, + value, + index } - dispatch({ - 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, + // payload: { + // output: validate, + // value, + // index + // } + // }); + // } } // // 调试代码时,更改对应的状态值 From 4d81f511ef65e26a7f5ce01c0a7f58398f41dee1 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 20 Dec 2019 20:08:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=A0=8F=20undefined=20=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/developer/components/myMonacoEditor/index.js | 4 ++-- public/react/src/modules/developer/recordDetail/index.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/developer/components/myMonacoEditor/index.js b/public/react/src/modules/developer/components/myMonacoEditor/index.js index 1ef918c59..261818092 100644 --- a/public/react/src/modules/developer/components/myMonacoEditor/index.js +++ b/public/react/src/modules/developer/components/myMonacoEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 15:02:52 * @LastEditors: tangjiang - * @LastEditTime: 2019-12-20 19:06:48 + * @LastEditTime: 2019-12-20 20:07:11 */ import './index.scss'; import React, { useState, useRef, useEffect } from 'react'; @@ -160,7 +160,7 @@ function MyMonacoEditor (props, ref) { {detail.name || 'test'}
-
@@ -98,6 +98,7 @@ function RecordDetail (props) {

提交内容