|
|
|
@ -12,9 +12,9 @@ import types from '../actions/actionTypes';
|
|
|
|
|
const init = {
|
|
|
|
|
ojForm: {
|
|
|
|
|
name: '', // 任务名称
|
|
|
|
|
language: '',
|
|
|
|
|
language: 'C',
|
|
|
|
|
description: '',
|
|
|
|
|
difficult: '',
|
|
|
|
|
difficult: '1',
|
|
|
|
|
sub_discipline_id: '', // 方向
|
|
|
|
|
// category: '',
|
|
|
|
|
// openOrNot: 1,
|
|
|
|
@ -114,7 +114,7 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
switch (action.type) {
|
|
|
|
|
case types.VALIDATE_OJ_FORM:
|
|
|
|
|
case types.VALIDATE_OJ_FORM:
|
|
|
|
|
// 验证成功后,调用后台接口
|
|
|
|
|
return returnState(state, ojForm, ojFormValidate);
|
|
|
|
|
case types.SAVE_OJ_FORM_CODE:
|
|
|
|
@ -278,7 +278,7 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
// 更新验证消息
|
|
|
|
|
const curIOjTestValidate = state.testCasesValidate.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, {input});
|
|
|
|
|
return Object.assign({}, tc, { input });
|
|
|
|
|
}
|
|
|
|
|
return tc;
|
|
|
|
|
});
|
|
|
|
@ -294,20 +294,20 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
testCases: [...curITestValues]
|
|
|
|
|
}
|
|
|
|
|
case types.TEST_CASE_OUTPUT_CHANGE:
|
|
|
|
|
const { output } = action.payload;
|
|
|
|
|
// 更新验证消息
|
|
|
|
|
const curOOjTestValidate = state.testCasesValidate.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, {output});
|
|
|
|
|
}
|
|
|
|
|
return tc;
|
|
|
|
|
});
|
|
|
|
|
let curOTestValues = state.testCases.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, { output: action.payload.value })
|
|
|
|
|
}
|
|
|
|
|
return tc;
|
|
|
|
|
});
|
|
|
|
|
const { output } = action.payload;
|
|
|
|
|
// 更新验证消息
|
|
|
|
|
const curOOjTestValidate = state.testCasesValidate.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, { output });
|
|
|
|
|
}
|
|
|
|
|
return tc;
|
|
|
|
|
});
|
|
|
|
|
let curOTestValues = state.testCases.map((tc, i) => {
|
|
|
|
|
if (i === action.payload.index) {
|
|
|
|
|
return Object.assign({}, tc, { output: action.payload.value })
|
|
|
|
|
}
|
|
|
|
|
return tc;
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
testCasesValidate: [...curOOjTestValidate],
|
|
|
|
@ -355,7 +355,7 @@ const ojFormReducer = (state = initialState, action) => {
|
|
|
|
|
console.log(_p.tag_discipline_id);
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
ojForm: Object.assign({}, state.ojForm, {difficult: _p.difficult, sub_discipline_id: _p.sub_discipline_id}),
|
|
|
|
|
ojForm: Object.assign({}, state.ojForm, { difficult: _p.difficult, sub_discipline_id: _p.sub_discipline_id }),
|
|
|
|
|
tag_discipline_id: _p.tag_discipline_id || []
|
|
|
|
|
}
|
|
|
|
|
case types.SET_SEARCH_PARAMS:
|
|
|
|
|