oj判断滚动

video_transcode
杨树明 5 years ago
parent 2e691ff55d
commit cb00793295

@ -77,7 +77,7 @@ function InitTabCtx (props, ref) {
const _handleTestCodeFormSubmit = (cb) => { const _handleTestCodeFormSubmit = (cb) => {
const {form} = props; const {form} = props;
form.validateFields((err, values) => { form.validateFieldsAndScroll((err, values) => {
if (!err) { // 表单验证通过时,调用测试接口 if (!err) { // 表单验证通过时,调用测试接口
cb && cb(); // 调用回调函数,切换 tab cb && cb(); // 调用回调函数,切换 tab
onDebuggerCode && onDebuggerCode(values); onDebuggerCode && onDebuggerCode(values);

@ -1,7 +1,7 @@
/* /*
* @Description: 显示tab中的内容 * @Description: 显示tab中的内容
* @Author: tangjiang * @Author: tangjiang
* @Date: 2019-11-18 10:43:03 * @Date: 2019-11-18 10:43:03
* @Last Modified by: tangjiang * @Last Modified by: tangjiang
* @Last Modified time: 2019-11-18 11:35:12 * @Last Modified time: 2019-11-18 11:35:12
*/ */
@ -31,7 +31,7 @@ const renderUserCase = (ctx, position, props) => {
})(<TextArea rows={5} />) })(<TextArea rows={5} />)
} }
</FormItem> </FormItem>
{/* <FormItem {/* <FormItem
className={'input_area flex_r'} className={'input_area flex_r'}
label="输出"> label="输出">
{ {
@ -76,7 +76,7 @@ class InitTabCtx extends PureComponent {
handleTestCodeFormSubmit = (cb) => { handleTestCodeFormSubmit = (cb) => {
const {form, debuggerCode} = this.props; const {form, debuggerCode} = this.props;
console.log(debuggerCode); console.log(debuggerCode);
form.validateFields((err, values) => { form.validateFieldsAndScroll((err, values) => {
if (!err) { // 表单验证通过时,调用测试接口 if (!err) { // 表单验证通过时,调用测试接口
cb && cb(); // 调用回调函数,切换 tab cb && cb(); // 调用回调函数,切换 tab
console.log('表单值:', values); console.log('表单值:', values);

@ -1,7 +1,7 @@
/* /*
* @Description: * @Description:
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-12-01 09:17:07 * @Date: 2019-12-01 09:17:07
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-02 16:33:35 * @LastEditTime: 2019-12-02 16:33:35
@ -46,10 +46,10 @@ const maps = {
function EditTab (props, ref) { function EditTab (props, ref) {
const { const {
form, form,
ojForm, ojForm,
position, position,
testCases, testCases,
addTestCase, addTestCase,
deleteTestCase, deleteTestCase,
@ -90,10 +90,10 @@ function EditTab (props, ref) {
// 向外暴露的方法 // 向外暴露的方法
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
validateForm () { validateForm () {
props.form.validateFields((err, values) => { props.form.validateFieldsAndScroll((err, values) => {
if (!err) { if (!err) {
getFormData(() => { getFormData(() => {
return values; return values;
}); });
} else { } else {
return; return;
@ -133,8 +133,8 @@ function EditTab (props, ref) {
return ( return (
<AddTestDemo <AddTestDemo
key={`key_${i}`} key={`key_${i}`}
onSubmitTest={handleSubmitTest} onSubmitTest={handleSubmitTest}
onDeleteTest={handleDeleteTest} onDeleteTest={handleDeleteTest}
testCase={item} testCase={item}
testCaseValidate={testCasesValidate[i]} testCaseValidate={testCasesValidate[i]}
index={i} index={i}
@ -171,9 +171,9 @@ function EditTab (props, ref) {
return ( return (
<div className={'editor_area'}> <div className={'editor_area'}>
<Form <Form
hideRequiredMark={true} hideRequiredMark={true}
className={'editor_form'} className={'editor_form'}
ref={formRef}> ref={formRef}>
<FormItem <FormItem
className={`input_area flex_60`} className={`input_area flex_60`}
@ -188,7 +188,7 @@ function EditTab (props, ref) {
})(<Input placeholder="请输入任务名称"/>) })(<Input placeholder="请输入任务名称"/>)
} }
</FormItem> </FormItem>
<FormItem <FormItem
className={`input_area flex_40`} className={`input_area flex_40`}
label={<span>{myLabel(jcLabel['language'])}</span>} label={<span>{myLabel(jcLabel['language'])}</span>}

@ -1,7 +1,7 @@
/* /*
* @Description: 显示tab中的内容 * @Description: 显示tab中的内容
* @Author: tangjiang * @Author: tangjiang
* @Date: 2019-11-18 10:43:03 * @Date: 2019-11-18 10:43:03
* @Last Modified by: tangjiang * @Last Modified by: tangjiang
* @Last Modified time: 2019-11-18 11:35:12 * @Last Modified time: 2019-11-18 11:35:12
*/ */
@ -31,7 +31,7 @@ const renderUserCase = (ctx, position, props) => {
})(<TextArea rows={5} />) })(<TextArea rows={5} />)
} }
</FormItem> </FormItem>
{/* <FormItem {/* <FormItem
className={'input_area flex_r'} className={'input_area flex_r'}
label="输出"> label="输出">
{ {
@ -76,7 +76,7 @@ class InitTabCtx extends PureComponent {
handleTestCodeFormSubmit = (cb) => { handleTestCodeFormSubmit = (cb) => {
const {form, debuggerCode} = this.props; const {form, debuggerCode} = this.props;
// console.log(debuggerCode); // console.log(debuggerCode);
form.validateFields((err, values) => { form.validateFieldsAndScroll((err, values) => {
if (!err) { // 表单验证通过时,调用测试接口 if (!err) { // 表单验证通过时,调用测试接口
cb && cb(); // 调用回调函数,切换 tab cb && cb(); // 调用回调函数,切换 tab
// console.log('表单值:', values); // console.log('表单值:', values);

@ -1,7 +1,7 @@
/* /*
* @Description: * @Description:
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-27 14:59:51 * @Date: 2019-11-27 14:59:51
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-02 14:23:43 * @LastEditTime : 2020-01-02 14:23:43
@ -18,10 +18,10 @@ import { Input, Form, Button } from 'antd';
const { TextArea } = Input; const { TextArea } = Input;
const FormItem = Form.Item; const FormItem = Form.Item;
const RightPane = (props) => { const RightPane = (props) => {
const { const {
identifier, identifier,
submitInput, submitInput,
submitUserCode, submitUserCode,
input, input,
hack, hack,
@ -53,7 +53,7 @@ const RightPane = (props) => {
// } // }
// }, [hack, editor_code]); // }, [hack, editor_code]);
const handleSubmitForm = () => { const handleSubmitForm = () => {
// 提交时, 先调用提交接口,提交成功后,循环调用测评接口 // 提交时, 先调用提交接口,提交成功后,循环调用测评接口
// saveOpacityType('submit'); // saveOpacityType('submit');
@ -101,9 +101,9 @@ const RightPane = (props) => {
props.form.resetFields(); props.form.resetFields();
setNoteClazz('editor_nodte_area'); setNoteClazz('editor_nodte_area');
} }
const handleSubmitNote = () => { const handleSubmitNote = () => {
props.form.validateFields((err, values) => { props.form.validateFieldsAndScroll((err, values) => {
if (!err) { if (!err) {
changeLoadingState(true); changeLoadingState(true);
addNotes(identifier, values, function () { addNotes(identifier, values, function () {
@ -121,7 +121,7 @@ const RightPane = (props) => {
<MyMonacoEditor <MyMonacoEditor
notice={notice} notice={notice}
identifier={identifier} identifier={identifier}
language={hack.language} language={hack.language}
code={editor_code || hack.code} code={editor_code || hack.code}
hadCodeUpdate={hadCodeUpdate} hadCodeUpdate={hadCodeUpdate}
onCodeChange={handleCodeChange} onCodeChange={handleCodeChange}
@ -129,11 +129,11 @@ const RightPane = (props) => {
onRestoreInitialCode={handleRestoreInitialCode} onRestoreInitialCode={handleRestoreInitialCode}
/> />
<span <span
className="iconfont icon-biji student_notes" className="iconfont icon-biji student_notes"
onClick={handleClickNote} onClick={handleClickNote}
></span> ></span>
{/* <div className="student_notes"> {/* <div className="student_notes">
<TextArea rows={5} /> <TextArea rows={5} />
</div> */} </div> */}
@ -153,7 +153,7 @@ const RightPane = (props) => {
rows="5" rows="5"
/>) />)
} }
</FormItem> </FormItem>
<FormItem style={{ textAlign: 'right' }}> <FormItem style={{ textAlign: 'right' }}>
<Button loading={loading} style={{ marginRight: '10px' }} onClick={handleCancelNote}>取消</Button> <Button loading={loading} style={{ marginRight: '10px' }} onClick={handleCancelNote}>取消</Button>
@ -161,8 +161,8 @@ const RightPane = (props) => {
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
<ControlSetting <ControlSetting
identifier={identifier} identifier={identifier}
inputValue={input} inputValue={input}
onDebuggerCode={handleDebuggerCode} onDebuggerCode={handleDebuggerCode}
@ -174,10 +174,10 @@ const RightPane = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const { const {
user_program_identifier, user_program_identifier,
hack, hack,
userTestInput, userTestInput,
editor_code, editor_code,
notice, notice,
hadCodeUpdate hadCodeUpdate
} = state.ojForUserReducer; } = state.ojForUserReducer;
@ -192,7 +192,7 @@ const mapStateToProps = (state) => {
hadCodeUpdate, hadCodeUpdate,
editor_code, editor_code,
input: userTestInput, input: userTestInput,
submitInput: hack.input, submitInput: hack.input,
identifier: user_program_identifier identifier: user_program_identifier
}; };
} }

Loading…
Cancel
Save