|
|
@ -4,7 +4,7 @@
|
|
|
|
* @Github:
|
|
|
|
* @Github:
|
|
|
|
* @Date: 2019-11-23 10:53:19
|
|
|
|
* @Date: 2019-11-23 10:53:19
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditTime : 2020-01-06 15:27:34
|
|
|
|
* @LastEditTime : 2020-02-10 18:24:01
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import './index.scss';
|
|
|
|
import './index.scss';
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
@ -31,7 +31,9 @@ function StudentStudy (props) {
|
|
|
|
// user_program_identifier,
|
|
|
|
// user_program_identifier,
|
|
|
|
restoreInitialCode,
|
|
|
|
restoreInitialCode,
|
|
|
|
changeUserCodeTab,
|
|
|
|
changeUserCodeTab,
|
|
|
|
changeShowOrHideControl
|
|
|
|
changeShowOrHideControl,
|
|
|
|
|
|
|
|
searchParams,
|
|
|
|
|
|
|
|
saveSearchParams
|
|
|
|
} = props;
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
const {
|
|
|
@ -47,7 +49,16 @@ function StudentStudy (props) {
|
|
|
|
saveUserProgramIdentifier(id);
|
|
|
|
saveUserProgramIdentifier(id);
|
|
|
|
// startProgramQuestion(id);
|
|
|
|
// startProgramQuestion(id);
|
|
|
|
getUserProgramDetail(id);
|
|
|
|
getUserProgramDetail(id);
|
|
|
|
|
|
|
|
const $searchs = window.location.search && window.location.search.substring(1);
|
|
|
|
|
|
|
|
if ($searchs) {
|
|
|
|
|
|
|
|
const $params = $searchs.split('&') || [];
|
|
|
|
|
|
|
|
let obj = Object.create(null);
|
|
|
|
|
|
|
|
$params.forEach(item => {
|
|
|
|
|
|
|
|
const keys = item.split('=');
|
|
|
|
|
|
|
|
obj[keys[0]] = keys[1];
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
saveSearchParams({searchParams: $searchs, curPage: obj['pages']});
|
|
|
|
|
|
|
|
}
|
|
|
|
if (tab) {
|
|
|
|
if (tab) {
|
|
|
|
changeUserCodeTab(tab);
|
|
|
|
changeUserCodeTab(tab);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -97,7 +108,7 @@ function StudentStudy (props) {
|
|
|
|
changeShowOrHideControl(false);
|
|
|
|
changeShowOrHideControl(false);
|
|
|
|
props.saveEditorCodeForDetail('');
|
|
|
|
props.saveEditorCodeForDetail('');
|
|
|
|
props.clearOjForUserReducer();
|
|
|
|
props.clearOjForUserReducer();
|
|
|
|
props.history.push(`/problems/${identifier}/edit`);
|
|
|
|
props.history.push(`/problems/${identifier}/edit?{searchParams}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 处理退出
|
|
|
|
// 处理退出
|
|
|
|
const handleClickQuit = () => {
|
|
|
|
const handleClickQuit = () => {
|
|
|
@ -106,7 +117,8 @@ function StudentStudy (props) {
|
|
|
|
// 将控制台关闭
|
|
|
|
// 将控制台关闭
|
|
|
|
changeShowOrHideControl(false);
|
|
|
|
changeShowOrHideControl(false);
|
|
|
|
props.saveEditorCodeForDetail('');
|
|
|
|
props.saveEditorCodeForDetail('');
|
|
|
|
props.history.push('/problems');
|
|
|
|
// props.history.push('/problems');
|
|
|
|
|
|
|
|
props.history.push(`/question?${searchParams}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -163,11 +175,13 @@ function StudentStudy (props) {
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
const { userInfo } = state.userReducer;
|
|
|
|
const { userInfo } = state.userReducer;
|
|
|
|
const { hack_identifier, user_program_identifier, hack } = state.ojForUserReducer;
|
|
|
|
const { hack_identifier, user_program_identifier, hack } = state.ojForUserReducer;
|
|
|
|
|
|
|
|
const { searchParams } = state.ojFormReducer;
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
hack,
|
|
|
|
hack,
|
|
|
|
userInfo,
|
|
|
|
userInfo,
|
|
|
|
user_program_identifier,
|
|
|
|
user_program_identifier,
|
|
|
|
hack_identifier
|
|
|
|
hack_identifier,
|
|
|
|
|
|
|
|
searchParams
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +196,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
|
restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)),
|
|
|
|
restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)),
|
|
|
|
changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)),
|
|
|
|
changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)),
|
|
|
|
clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()),
|
|
|
|
clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()),
|
|
|
|
changeUserCodeTab: (tab) => dispatch(actions.changeUserCodeTab(tab))
|
|
|
|
changeUserCodeTab: (tab) => dispatch(actions.changeUserCodeTab(tab)),
|
|
|
|
|
|
|
|
saveSearchParams: (params) => dispatch(actions.saveSearchParams(params))
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default withRouter(connect(
|
|
|
|
export default withRouter(connect(
|
|
|
|