|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-11-23 10:53:19
|
|
|
|
|
* @LastEditors: tangjiang
|
|
|
|
|
* @LastEditTime: 2019-12-13 16:15:45
|
|
|
|
|
* @LastEditTime: 2019-12-13 16:46:31
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
@ -25,20 +25,23 @@ function StudentStudy (props) {
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
userInfo,
|
|
|
|
|
hack_identifier
|
|
|
|
|
hack_identifier,
|
|
|
|
|
user_program_identifier,
|
|
|
|
|
restoreInitialCode
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
// 是否更新
|
|
|
|
|
const [isUpdate, setIsUpdate] = useState(true);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const {
|
|
|
|
|
match: { params },
|
|
|
|
|
getUserProgramDetail,
|
|
|
|
|
saveUserProgramIdentifier
|
|
|
|
|
} = props;
|
|
|
|
|
const {
|
|
|
|
|
match: { params },
|
|
|
|
|
getUserProgramDetail,
|
|
|
|
|
saveUserProgramIdentifier
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
let { id } = params;
|
|
|
|
|
let { id } = params;
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// 保存当前的id
|
|
|
|
|
saveUserProgramIdentifier(id);
|
|
|
|
|
// startProgramQuestion(id);
|
|
|
|
@ -60,7 +63,7 @@ function StudentStudy (props) {
|
|
|
|
|
okText: '立即更新',
|
|
|
|
|
cancelText: '稍后再说',
|
|
|
|
|
onOk () {
|
|
|
|
|
|
|
|
|
|
restoreInitialCode(id, '更新成功');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -126,11 +129,12 @@ function StudentStudy (props) {
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
|
const { userInfo } = state.userReducer;
|
|
|
|
|
const { hack_identifier } = state.ojForUserReducer;
|
|
|
|
|
const { hack_identifier, user_program_identifier } = state.ojForUserReducer;
|
|
|
|
|
return {
|
|
|
|
|
userInfo,
|
|
|
|
|
user_program_identifier,
|
|
|
|
|
hack_identifier
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
@ -139,7 +143,9 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
|
|
// 调用编程题详情
|
|
|
|
|
getUserProgramDetail: (id) => dispatch(actions.getUserProgramDetail(id)),
|
|
|
|
|
saveUserProgramIdentifier: (id) => dispatch(actions.saveUserProgramIdentifier(id)),
|
|
|
|
|
saveEditorCodeForDetail: (code) => dispatch(actions.saveEditorCodeForDetail(code))
|
|
|
|
|
saveEditorCodeForDetail: (code) => dispatch(actions.saveEditorCodeForDetail(code)),
|
|
|
|
|
// 恢复初始代码
|
|
|
|
|
restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default withRouter(connect(
|
|
|
|
|