update test cases

chromesetting
tangjiang 5 years ago
parent 806630e1e4
commit 74586f166a

@ -140,16 +140,26 @@ const NewOrEditTask = (props) => {
) : (
<Button type="primary" onClick={imitationChallenge}>模拟挑战</Button>
);
// 更新
// const updateBtn = isPublish
// ? ''
// : (
// <Button
// type="primary"
// loading={submitLoading}
// onClick={handleSubmitForm}
// >更新</Button>
// );
return (
<React.Fragment>
<Button
type="primary"
loading={submitLoading}
onClick={handleSubmitForm}
>更新</Button>
<Button
type="primary"
loading={submitLoading}
onClick={handleSubmitForm}
>更新</Button>
{pubButton}
{challengeBtn}
{/* <Button type="primary" onClick={startChallenge}>模拟挑战</Button> */}
</React.Fragment>
)
}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-21 09:19:38
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-10 19:37:35
* @LastEditTime: 2019-12-13 11:58:46
*/
import './index.scss';
import React, { useState } from 'react';
@ -16,7 +16,7 @@ const { TextArea } = Input;
const FormItem = Form.Item;
const AddTestDemo = (props) => {
const {
// key,
key,
onSubmitTest,
onDeleteTest,
testCase,
@ -138,7 +138,7 @@ const AddTestDemo = (props) => {
return (
<Collapse className={'collapse_area'} activeKey={isOpen?'1':''} onChange={() => handleChangeCollapse()}>
<Panel header={`测试用例${testCase.position}`} extra={genExtra()} key="1">
<Panel header={`测试用例${props.index + 1}`} extra={genExtra()} key="1">
<Form>
<FormItem
label={<span className={'label_text'}>输入</span>}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:35:40
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-09 10:22:03
* @LastEditTime: 2019-12-13 11:39:52
*/
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.bubble.css';
@ -185,6 +185,7 @@ class EditTab extends React.Component {
};
const renderTestCase = () => {
return this.props.testCases.map((item, i) => {
console.log(111);
return <AddTestDemo
key={`${i}`}
isOpen={openTestCodeIndex.includes(i)}

@ -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;

Loading…
Cancel
Save