update code

dev_tpm_ui
tangjiang 5 years ago
parent 95871b7b46
commit 1a1784e1a4

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-04 08:36:21 * @Date: 2019-12-04 08:36:21
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 14:51:42 * @LastEditTime : 2019-12-27 21:18:39
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -60,6 +60,14 @@ function RecordDetail (props) {
props.history.push(`/myproblems/${identifier}`); props.history.push(`/myproblems/${identifier}`);
} }
} }
const handleEditorCode = (identifier, code) => {
if (identifier) {
console.log(code);
saveEditorCodeForDetail(code);
props.history.push(`/myproblems/${identifier}`);
}
}
return ( return (
<div className="record_detail_area"> <div className="record_detail_area">
<div className="record_detail_header"> <div className="record_detail_header">
@ -114,9 +122,10 @@ function RecordDetail (props) {
style={{ visibility: identifier ? 'visible' : 'hidden'}} style={{ visibility: identifier ? 'visible' : 'hidden'}}
className={'header_btn'} className={'header_btn'}
type="primary" type="primary"
onClick={() => handleEditorCode(identifier, detail.code)}
> >
{/* 编辑代码 */} 编辑代码
<Link to={`/myproblems/${identifier}`}>编辑代码</Link> {/* <Link to={`/myproblems/${identifier}`}>编辑代码</Link> */}
</Button> </Button>
</div> </div>
<div className="result_code_area"> <div className="result_code_area">

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:41:48 * @Date: 2019-11-27 13:41:48
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 20:59:00 * @LastEditTime : 2019-12-27 21:28:28
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -58,7 +58,8 @@ const ojForUserReducer = (state = initialState, action) => {
...state, ...state,
hack: Object.assign({}, hack), hack: Object.assign({}, hack),
test_case: Object.assign({}, test_case), test_case: Object.assign({}, test_case),
comment_identifier: hack.identifier comment_identifier: hack.identifier,
userCode: tempCode
} }
case types.COMMIT_RECORD_DETAIL: case types.COMMIT_RECORD_DETAIL:
let result = action.payload.data; let result = action.payload.data;

Loading…
Cancel
Save