修复测试用例问题

dev_forge
tangjiang 5 years ago
parent 951edd6d11
commit 83679cb3cc

@ -374,6 +374,7 @@ class DeveloperHome extends React.PureComponent {
// console.log('name has click', record);
// 先调用start接口获取返回的 identifier, 再跳转到开启编辑
if (this.isLogin()) {
// console.log(record);
this.props.startProgramQuestion(record.identifier, this.props);
}
}

@ -28,69 +28,10 @@ const NewOrEditTask = (props) => {
identifier,
} = props;
// console.log('props =====>>>>', props);
// const leftRef = useRef(null);
// const rightRef = useRef(null);
// const [formDate, setFormData] = useState({});
// const isNullOrUndefiendOrZero = (value) => {
// if ([undefined, null, ''].includes(value)) {
// return true;
// }
// return false;
// }
console.log('props =====>>>>', props);
// 表单提交
const handleSubmitForm = () => {
// 调用输入表单验证功能
// let hasErrorForTestCase = false;
// const tempTestCaseValidate = [];
// // 验证测试用例
// testCases.forEach(tc => {
// const obj = {};
// if (isNullOrUndefiendOrZero(tc.input)) {
// hasErrorForTestCase = true;
// obj['input'] = {
// validateStatus: 'error',
// errMsg: '输入值不能为空'
// }
// } else {
// obj['input'] = {
// validateStatus: '',
// errMsg: ''
// }
// }
// if (isNullOrUndefiendOrZero(tc.output)) {
// hasErrorForTestCase = true;
// obj['output'] = {
// validateStatus: 'error',
// errMsg: '输出值不能为空'
// }
// } else {
// obj['output'] = {
// validateStatus: '',
// errMsg: ''
// }
// }
// // 更改测试用例值
// tempTestCaseValidate.push(obj);
// });
// // 验证代码块
// if (!formValue || hasErrorForTestCase) {
// // 验证不通过时, 回滚按钮状态
// changeSubmitLoadingStatus(false);
// changePublishLoadingStatus(false);
// updateTestAndValidate({ // 测试用例
// testCaseValidate: tempTestCaseValidate
// });
// return;
// }
// console.log('调用提交接口===========》》》》》》》》》》》》');
// props.saveOjFormCode(code); // 保存代码块值
// // TODO
// // identifier 存在时
if (props.identifier) {
props.handleUpdateOjForm(props);
} else {

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-21 09:19:38
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-02 19:20:30
* @LastEditTime: 2019-12-04 15:44:12
*/
import './index.scss';
import React, { useState } from 'react';
@ -29,13 +29,14 @@ const AddTestDemo = (props) => {
// 删除操作
const handleDeletePanel = (e) => {
// console.log('点击的删除按钮')
e.preventDefault();
e.stopPropagation();
Modal.confirm({
title: '删除',
content: '确定要删除当前测试用例吗?',
okText: '确定',
cancelText: '取消',
onOk() {
console.log('确定删除');
onDeleteTest(testCase);
}
})

@ -4,14 +4,14 @@
* @Github:
* @Date: 2019-11-20 10:35:40
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-03 08:41:14
* @LastEditTime: 2019-12-04 15:49:37
*/
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.bubble.css';
import 'quill/dist/quill.snow.css';
import './index.scss';
// import 'katex/dist/katex.css';
import React, { PureComponent } from 'react';
import React from 'react';
import { Form, Input, Select, InputNumber, Button } from 'antd';
import { connect } from 'react-redux';
import AddTestDemo from './AddTestDemo';
@ -43,7 +43,7 @@ const maps = {
{ title: '私有', key: '0' }
]
}
class EditTab extends PureComponent {
class EditTab extends React.Component {
constructor (props) {
super(props);
@ -88,7 +88,7 @@ class EditTab extends PureComponent {
const scrollTop = e.target.scrollTop;
const { scrollHeight, offsetTop} = this.state;
// 滚动距离 + 元素的高度 大于 offsetTop值时 添加 fix_top 样式
console.log(tOffsetTop, tOffsetHeight, scrollTop, scrollHeight, offsetTop);
// console.log(tOffsetTop, tOffsetHeight, scrollTop, scrollHeight, offsetTop);
if ((scrollTop + tOffsetHeight > tOffsetTop) && (tOffsetTop >= offsetTop)) {
oTarget.className = `test_demo_title fix_top`;
} else if ((scrollHeight + scrollTop < offsetTop) && (scrollHeight <= offsetTop)){
@ -181,8 +181,7 @@ class EditTab extends PureComponent {
deleteTestCase(obj);
};
const renderTestCase = () => {
console.log(openTestCodeIndex);
return testCases.map((item, i) => {
return this.props.testCases.map((item, i) => {
return <AddTestDemo
key={`${i}`}
isOpen={openTestCodeIndex.includes(i)}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:42:11
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 10:54:50
* @LastEditTime: 2019-12-04 15:50:54
*/
import types from "./actionTypes";
import { Base64 } from 'js-base64';
@ -32,6 +32,7 @@ export const startProgramQuestion = (id, props) => {
payload: identifier
});
// 跳转至开启编程
debugger;
props.history.push(`/myproblems/${identifier}`);
// Redirect.to
}

@ -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: // 保存或更新测试用例值

Loading…
Cancel
Save