update editor code update

dev_new_shixunsrepository
tangjiang 5 years ago
parent f0432f4e0e
commit ceeabea7a3

@ -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';

@ -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('');
setTimeout(() => {
props.history.push(`/myproblems/${identifier}`);
}, 300);
}
}

@ -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';
@ -51,8 +51,6 @@ const LeftPane = (props) => {
comment: (<Comment />)
};
console.log('======>>>>>>>', props);
useEffect(() => {
setDefaultActiveKey(userCodeTab);
}, [userCodeTab])

@ -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 (
<div className={'right_pane_code_wrap'}>
<MyMonacoEditor
notice={notice}
identifier={identifier}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:42:11
* @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 11:06:09
* @LastEditTime : 2020-01-02 14:17:49
*/
import types from "./actionTypes";
import { Base64 } from 'js-base64';
@ -116,16 +116,15 @@ export const saveUserCodeForInterval = (identifier, code) => {
});
// 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({

@ -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),

Loading…
Cancel
Save