|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-11-20 16:40:32
|
|
|
|
|
* @LastEditors: tangjiang
|
|
|
|
|
* @LastEditTime: 2019-12-09 16:30:46
|
|
|
|
|
* @LastEditTime: 2019-12-13 11:54:35
|
|
|
|
|
*/
|
|
|
|
|
import { Base64 } from 'js-base64';
|
|
|
|
|
import types from '../actions/actionTypes';
|
|
|
|
@ -146,12 +146,16 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
const { position } = action.payload;
|
|
|
|
|
// 根据 position 去查找当前元素在数组中的位置
|
|
|
|
|
const index = state.testCases.findIndex((item) => item.position === position);
|
|
|
|
|
const tempTestCase = state.testCases || [];
|
|
|
|
|
const tempTestValicate = state.testCasesValidate || [];
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
state.testCases.splice(index, 1); // 删除当前元素
|
|
|
|
|
state.testCasesValidate.splice(index, 1); // 删除测试用例对应的校验
|
|
|
|
|
tempTestCase.splice(index, 1); // 删除当前元素
|
|
|
|
|
tempTestValicate.splice(index, 1); // 删除测试用例对应的校验
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
...state
|
|
|
|
|
...state,
|
|
|
|
|
testCases: [...tempTestCase],
|
|
|
|
|
testCasesValidate: [...tempTestValicate]
|
|
|
|
|
};
|
|
|
|
|
case types.SAVE_OJ_FORM_ID:
|
|
|
|
|
state.identifier = action.payload;
|
|
|
|
|