|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-11-20 16:40:32
|
|
|
|
|
* @LastEditors: tangjiang
|
|
|
|
|
* @LastEditTime: 2019-12-02 19:22:30
|
|
|
|
|
* @LastEditTime: 2019-12-04 15:36:26
|
|
|
|
|
*/
|
|
|
|
|
import { Base64 } from 'js-base64';
|
|
|
|
|
import types from '../actions/actionTypes';
|
|
|
|
@ -147,7 +147,7 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
const index = state.testCases.findIndex((item) => item.position === position);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
state.testCases.splice(index, 1); // 删除当前元素
|
|
|
|
|
state.ojTestCaseValidate.splice(index, 1); // 删除测试用例对应的校验
|
|
|
|
|
state.testCasesValidate.splice(index, 1); // 删除测试用例对应的校验
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
...state
|
|
|
|
@ -218,12 +218,12 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
case types.VALIDATE_TEST_CODE_ARRS:
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
ojTestCaseValidate: action.payload
|
|
|
|
|
testCasesValidate: action.payload
|
|
|
|
|
}
|
|
|
|
|
case types.TEST_CASE_INPUT_CHANGE:
|
|
|
|
|
const { input } = action.payload;
|
|
|
|
|
// 更新验证消息
|
|
|
|
|
const curIOjTestValidate = state.ojTestCaseValidate.map((tc, i) => {
|
|
|
|
|
const curIOjTestValidate = state.testCasesValidate.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, {input});
|
|
|
|
|
}
|
|
|
|
@ -237,13 +237,13 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
ojTestCaseValidate: [...curIOjTestValidate],
|
|
|
|
|
testCasesValidate: [...curIOjTestValidate],
|
|
|
|
|
testCases: [...curITestValues]
|
|
|
|
|
}
|
|
|
|
|
case types.TEST_CASE_OUTPUT_CHANGE:
|
|
|
|
|
const { output } = action.payload;
|
|
|
|
|
// 更新验证消息
|
|
|
|
|
const curOOjTestValidate = state.ojTestCaseValidate.map((tc, i) => {
|
|
|
|
|
const curOOjTestValidate = state.testCasesValidate.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, {output});
|
|
|
|
|
}
|
|
|
|
@ -257,7 +257,7 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
ojTestCaseValidate: [...curOOjTestValidate],
|
|
|
|
|
testCasesValidate: [...curOOjTestValidate],
|
|
|
|
|
testCases: [...curOTestValues]
|
|
|
|
|
}
|
|
|
|
|
case types.UPDATE_TEST_AND_VALIDATE: // 保存或更新测试用例值
|
|
|
|
|