From ceeabea7a379d95669d122b25efc30a1756b58e2 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Thu, 2 Jan 2020 14:26:08 +0800 Subject: [PATCH] update editor code update --- .../developer/components/myMonacoEditor/index.js | 2 +- .../src/modules/developer/recordDetail/index.js | 6 ++++-- .../developer/studentStudy/leftpane/index.js | 4 +--- .../developer/studentStudy/rightpane/index.js | 8 +++++--- public/react/src/redux/actions/ojForUser.js | 15 +++++++-------- .../react/src/redux/reducers/ojForUserReducer.js | 8 ++++---- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/public/react/src/modules/developer/components/myMonacoEditor/index.js b/public/react/src/modules/developer/components/myMonacoEditor/index.js index b37770328..930561e37 100644 --- a/public/react/src/modules/developer/components/myMonacoEditor/index.js +++ b/public/react/src/modules/developer/components/myMonacoEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 15:02:52 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 20:49:46 + * @LastEditTime : 2020-01-02 13:59:38 */ import './index.scss'; import React, { useState, useRef, useEffect } from 'react'; diff --git a/public/react/src/modules/developer/recordDetail/index.js b/public/react/src/modules/developer/recordDetail/index.js index fd93b3f2a..6675f066d 100644 --- a/public/react/src/modules/developer/recordDetail/index.js +++ b/public/react/src/modules/developer/recordDetail/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-04 08:36:21 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 21:18:39 + * @LastEditTime : 2020-01-02 13:48:02 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -57,7 +57,9 @@ function RecordDetail (props) { const handleReturn = (identifier) => { if (identifier) { saveEditorCodeForDetail(''); - props.history.push(`/myproblems/${identifier}`); + setTimeout(() => { + props.history.push(`/myproblems/${identifier}`); + }, 300); } } diff --git a/public/react/src/modules/developer/studentStudy/leftpane/index.js b/public/react/src/modules/developer/studentStudy/leftpane/index.js index ac8d89321..88c5ee9a0 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 11:33:41 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 16:03:04 + * @LastEditTime : 2020-01-02 13:51:22 // */ import './index.scss'; import React, { useState, useEffect, useMemo } from 'react'; @@ -50,8 +50,6 @@ const LeftPane = (props) => { record: (), comment: () }; - - console.log('======>>>>>>>', props); useEffect(() => { setDefaultActiveKey(userCodeTab); diff --git a/public/react/src/modules/developer/studentStudy/rightpane/index.js b/public/react/src/modules/developer/studentStudy/rightpane/index.js index ed500fb3a..bebaea1e8 100644 --- a/public/react/src/modules/developer/studentStudy/rightpane/index.js +++ b/public/react/src/modules/developer/studentStudy/rightpane/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 14:59:51 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 19:23:46 + * @LastEditTime : 2020-01-02 14:23:43 */ import React, { useState, useEffect } from 'react'; import {connect} from 'react-redux'; @@ -39,7 +39,7 @@ const RightPane = (props) => { changeLoadingState } = props; - const [editorCode, setEditorCode] = useState(editor_code || hack.code); + // const [editorCode, setEditorCode] = useState(editor_code || hack.code); const [noteClazz, setNoteClazz] = useState('editor_nodte_area'); const [noteCount] = useState(5000); // const [code, setCode] = useState(editor_code || hack.code); @@ -65,8 +65,9 @@ const RightPane = (props) => { let timer = null; // 定时器 // 代码块内容变化时 const handleCodeChange = (value) => { + // console.log('编辑器代码 ======》》》》》》》》》++++++++++', value); saveUserInputCode(value); - setEditorCode(value); + // setEditorCode(value); if (!timer) { timer = setInterval(function () { clearInterval(timer); @@ -116,6 +117,7 @@ const RightPane = (props) => { const { getFieldDecorator } = props.form; return (
+ { }); // console.log('+++', userCode); fetchUpdateCode(identifier, { - code: userCode + code: Base64.encode(userCode) }).then(res => { if (res.data.status === 401) { return; }; - dispatch({ - type: types.RESTORE_INITIAL_CODE, - payload: userCode - }); - + // dispatch({ + // type: types.RESTORE_INITIAL_CODE, + // payload: userCode + // }); setTimeout(() => { dispatch({ type: types.AUTO_UPDATE_CODE, @@ -342,7 +341,7 @@ export const getUserCommitRecord = (identifier) => { export const getUserCommitRecordDetail = (identifier) => { return (dispatch) => { fetchUserCommitRecordDetail(identifier).then(res => { - console.log('提交记录详情======》》》》', res); + // console.log('提交记录详情======》》》》', res); const { data } = res; if (data.status === 401) return; dispatch({ diff --git a/public/react/src/redux/reducers/ojForUserReducer.js b/public/react/src/redux/reducers/ojForUserReducer.js index 721c3e2cc..475d14d79 100644 --- a/public/react/src/redux/reducers/ojForUserReducer.js +++ b/public/react/src/redux/reducers/ojForUserReducer.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 13:41:48 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 21:28:28 + * @LastEditTime : 2020-01-02 14:24:09 */ import types from "../actions/actionTypes"; import { Base64 } from 'js-base64'; @@ -94,10 +94,11 @@ const ojForUserReducer = (state = initialState, action) => { pages: Object.assign({}, state.pages, { total: records_count }) } case types.SAVE_USER_CODE: - let curCode = Base64.encode(action.payload); + // console.log('save_user_code: ', action.payload); + // let curCode = Base64.encode(action.payload); return { ...state, - userCode: curCode, + userCode: action.payload, isUpdateCode: true, } case types.IS_UPDATE_CODE: @@ -136,7 +137,6 @@ const ojForUserReducer = (state = initialState, action) => { } else { curHack['code'] = ''; } - console.log(curHack); return { ...state, hack: Object.assign({}, state.hack, curHack),