|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
import React, { useState, useRef, useEffect } from 'react';
|
|
|
|
|
import { Tabs, Button, Icon, notification } from 'antd';
|
|
|
|
|
import { Tabs, Button, Icon, notification } from 'antd';
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import InitTabCtx from '../initTabCtx';
|
|
|
|
|
import ExecResult from '../execResult';
|
|
|
|
@ -17,9 +17,8 @@ import actions from '../../../../redux/actions';
|
|
|
|
|
const { TabPane } = Tabs;
|
|
|
|
|
const ControlSetting = (props) => {
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
hack,
|
|
|
|
|
userCode,
|
|
|
|
|
const {
|
|
|
|
|
editor_code,
|
|
|
|
|
inputValue,
|
|
|
|
|
loading,
|
|
|
|
|
submitLoading,
|
|
|
|
@ -59,7 +58,7 @@ const ControlSetting = (props) => {
|
|
|
|
|
|
|
|
|
|
// 调试代码
|
|
|
|
|
const handleTestCode = (e) => {
|
|
|
|
|
if (!userCode) {
|
|
|
|
|
if (!editor_code) {
|
|
|
|
|
notification.warning({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description: '代码块内容不能为空'
|
|
|
|
@ -74,11 +73,11 @@ const ControlSetting = (props) => {
|
|
|
|
|
setDefaultActiveKey('2');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 提交
|
|
|
|
|
const handleSubmit = (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (!userCode) {
|
|
|
|
|
if (!editor_code) {
|
|
|
|
|
notification.warning({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description: '代码块内容不能为空'
|
|
|
|
@ -103,56 +102,53 @@ const ControlSetting = (props) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className="pane_control_area">
|
|
|
|
|
<div
|
|
|
|
|
className="pane_control_collapse"
|
|
|
|
|
className="pane_control_collapse"
|
|
|
|
|
onClick={handleShowControl}
|
|
|
|
|
style={{ top: showTextResult ? '-267px' : 0 }}
|
|
|
|
|
>
|
|
|
|
|
{/* <i className="iconfont icon-xiajiantou icon"></i> */}
|
|
|
|
|
<Icon type={ showTextResult ? "down" : "up" } />
|
|
|
|
|
<Icon type={showTextResult ? "down" : "up"} />
|
|
|
|
|
</div>
|
|
|
|
|
<Tabs
|
|
|
|
|
className={classNames}
|
|
|
|
|
activeKey={defaultActiveKey}
|
|
|
|
|
activeKey={defaultActiveKey}
|
|
|
|
|
tabBarStyle={{ backgroundColor: 'rgba(18,28,36,1)', color: '#fff' }}
|
|
|
|
|
onChange={handleTabChange}
|
|
|
|
|
>
|
|
|
|
|
<TabPane tab={'自定义测试用例'} key={'1'} style={{ height: '280px', overflowY: 'auto' }}>
|
|
|
|
|
<InitTabCtx
|
|
|
|
|
inputValue={inputValue}
|
|
|
|
|
<InitTabCtx
|
|
|
|
|
inputValue={inputValue}
|
|
|
|
|
wrappedComponentRef={(form) => formRef.current = form}
|
|
|
|
|
onDebuggerCode={handleDebuggerCode}
|
|
|
|
|
/>
|
|
|
|
|
</TabPane>
|
|
|
|
|
<TabPane tab={'代码执行结果'} key={'2'} style={{ height: '280px', overflowY: 'auto' }}>
|
|
|
|
|
<ExecResult
|
|
|
|
|
<ExecResult
|
|
|
|
|
excuteState={excuteState}
|
|
|
|
|
excuteDetail={commitTestRecordDetail}
|
|
|
|
|
/>
|
|
|
|
|
</TabPane>
|
|
|
|
|
</Tabs>
|
|
|
|
|
<div className="pane_control_opts">
|
|
|
|
|
<Button
|
|
|
|
|
type="link"
|
|
|
|
|
style={{ color: '#fff' }}
|
|
|
|
|
// onClick={handleShowControl}
|
|
|
|
|
<Button
|
|
|
|
|
type="link"
|
|
|
|
|
style={{ color: '#fff' }}
|
|
|
|
|
>
|
|
|
|
|
控制台
|
|
|
|
|
{/* <Icon type={ showTextResult ? "down" : "up" } /> */}
|
|
|
|
|
控制台
|
|
|
|
|
</Button>
|
|
|
|
|
<p>
|
|
|
|
|
<Button ghost
|
|
|
|
|
<Button ghost
|
|
|
|
|
loading={loading}
|
|
|
|
|
style={{ marginRight: '10px', color: '#28BD8B', borderColor: '#28BD8B' }}
|
|
|
|
|
style={{ marginRight: '10px', color: '#28BD8B', borderColor: '#28BD8B' }}
|
|
|
|
|
onClick={handleTestCode}
|
|
|
|
|
disabled={!identifier}
|
|
|
|
|
>调试代码</Button>
|
|
|
|
|
<Button
|
|
|
|
|
<Button
|
|
|
|
|
loading={submitLoading}
|
|
|
|
|
type="primary"
|
|
|
|
|
onClick={handleSubmit}
|
|
|
|
|
>
|
|
|
|
|
{/* {props.identifier ? '更新' : '提交'} */}
|
|
|
|
|
提交
|
|
|
|
|
>
|
|
|
|
|
提交
|
|
|
|
|
</Button>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
@ -161,12 +157,12 @@ const ControlSetting = (props) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
|
const {commonReducer, ojForUserReducer} = state;
|
|
|
|
|
const {loading, excuteState, submitLoading, showOrHideControl } = commonReducer;
|
|
|
|
|
const { commitTestRecordDetail, hack, userCode } = ojForUserReducer;
|
|
|
|
|
const { commonReducer, ojForUserReducer } = state;
|
|
|
|
|
const { loading, excuteState, submitLoading, showOrHideControl } = commonReducer;
|
|
|
|
|
const { commitTestRecordDetail, hack, editor_code } = ojForUserReducer;
|
|
|
|
|
return {
|
|
|
|
|
hack,
|
|
|
|
|
userCode,
|
|
|
|
|
editor_code,
|
|
|
|
|
loading,
|
|
|
|
|
submitLoading,
|
|
|
|
|
excuteState,
|
|
|
|
|