64 lines
1.6 KiB
64 lines
1.6 KiB
/*
|
|
* @Description:
|
|
* @Author: tangjiang
|
|
* @Github:
|
|
* @Date: 2019-12-01 10:18:35
|
|
* @LastEditors: tangjiang
|
|
* @LastEditTime: 2019-12-03 09:11:50
|
|
*/
|
|
import './index.scss';
|
|
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import MyMonacoEditor from '../../components/myMonacoEditor';
|
|
import ControlSetting from '../../components/controlSetting';
|
|
import actions from '../../../../redux/actions';
|
|
|
|
function RightPane (props, ref) {
|
|
|
|
const {
|
|
// identifier,
|
|
onSubmitForm,
|
|
saveOjFormCode
|
|
} = props;
|
|
|
|
// 代码改变时,保存
|
|
const handleCodeChange = (code) => {
|
|
// 保存用户输入的代码
|
|
saveOjFormCode(code);
|
|
}
|
|
// 启动调试代码
|
|
// const handleDebuggerCode = (value) => {
|
|
// console.log('调用的代码调试====', value);
|
|
// }
|
|
return (
|
|
<div className={'right_pane_code_wrap'}>
|
|
<MyMonacoEditor language={props.language} code={props.code} onCodeChange={handleCodeChange}/>
|
|
<ControlSetting
|
|
// identifier={identifier}
|
|
inputValue={props.input}
|
|
onSubmitForm={onSubmitForm}
|
|
// onDebuggerCode={handleDebuggerCode}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const mapStateToProps = (state) => {
|
|
const { ojForm, testCases, code, identifier } = state.ojFormReducer;
|
|
return {
|
|
code,
|
|
identifier,
|
|
language: ojForm.language,
|
|
input: (testCases[0] && testCases[0].input) || '',
|
|
|
|
}
|
|
};
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
// 保存提交的代码值
|
|
saveOjFormCode: (value) => dispatch(actions.saveOjFormCode(value)),
|
|
});
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(RightPane);
|