update test cases

chromesetting
tangjiang 5 years ago
parent 806630e1e4
commit 74586f166a

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

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

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

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

Loading…
Cancel
Save