/* * @Description: 右侧代码块控制台 * @Author: tangjiang * @Github: * @Date: 2019-11-27 16:02:36 * @LastEditors: tangjiang * @LastEditTime: 2019-12-19 10:47:44 */ import './index.scss'; import React, { useState, useRef } from 'react'; import { Tabs, Button, Icon } from 'antd'; import { connect } from 'react-redux'; import InitTabCtx from '../initTabCtx'; import ExecResult from '../execResult'; import actions from '../../../../redux/actions'; const { TabPane } = Tabs; const ControlSetting = (props) => { const { inputValue, loading, submitLoading, identifier, excuteState, commitRecordDetail, changeLoadingState, changeSubmitLoadingStatus, showOrHideControl, // debuggerCode, // startDebuggerCode, // 外部存入 onDebuggerCode, // updateCode, onSubmitForm } = props; const [defaultActiveKey, setDefaultActiveKey] = useState('1'); // 当前选中的tab const [showTextResult, setShowTextResult] = useState(false); // 是否点击控制台按钮 const formRef = useRef(null); const classNames = `control_tab ${showTextResult ? 'move_up move_up_final' : 'move_down_final'}`; // 切换tab const handleTabChange = (key) => { setDefaultActiveKey(key); } // 显示/隐藏tab const handleShowControl = () => { setShowTextResult(!showTextResult); showOrHideControl(!showTextResult); } // 调试代码 const handleTestCode = (e) => { // console.log(formRef.current.handleTestCodeFormSubmit); // 调出控制台界面 setShowTextResult(true); showOrHideControl(true); formRef.current.handleTestCodeFormSubmit(() => { setDefaultActiveKey('2'); }); } // 提交 const handleSubmit = (e) => { e.preventDefault(); changeSubmitLoadingStatus(true); onSubmitForm && onSubmitForm(); } // 处理调度代码 const handleDebuggerCode = (values) => { // 改变状态值 changeLoadingState(true); // 调用代码保存接口, 成功后再调用调试接口 // updateCode(identifier, values, 'debug'); // 调用调试接口 // debuggerCode(identifier, values); onDebuggerCode(values); } return (