|
|
|
@ -18,10 +18,10 @@ import RightPane from './rightpane';
|
|
|
|
|
import { Icon } from 'antd';
|
|
|
|
|
import UserInfo from '../components/userInfo';
|
|
|
|
|
import actions from '../../../redux/actions';
|
|
|
|
|
import { fromStore, CNotificationHOC} from 'educoder';
|
|
|
|
|
import { fromStore, CNotificationHOC } from 'educoder';
|
|
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
|
|
|
|
|
|
function StudentStudy (props) {
|
|
|
|
|
function StudentStudy(props) {
|
|
|
|
|
|
|
|
|
|
const [hasUpdate, setHasUpdate] = useState(true);
|
|
|
|
|
const {
|
|
|
|
@ -48,18 +48,18 @@ function StudentStudy (props) {
|
|
|
|
|
// 保存当前的id
|
|
|
|
|
saveUserProgramIdentifier(id);
|
|
|
|
|
// startProgramQuestion(id);
|
|
|
|
|
// console.log("getUserProgramDetail(id)");
|
|
|
|
|
// console.log(id);
|
|
|
|
|
// console.log(id.charAt(id.length-1));
|
|
|
|
|
try {
|
|
|
|
|
if(id.charAt(id.length-1)==="?"){
|
|
|
|
|
id = id.substring(0, id.length - 1);
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
// console.log("getUserProgramDetail(id)");
|
|
|
|
|
// console.log(id);
|
|
|
|
|
// console.log(id.charAt(id.length-1));
|
|
|
|
|
try {
|
|
|
|
|
if (id.charAt(id.length - 1) === "?") {
|
|
|
|
|
id = id.substring(0, id.length - 1);
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getUserProgramDetail(id);
|
|
|
|
|
getUserProgramDetail(id);
|
|
|
|
|
const $searchs = window.location.search && window.location.search.substring(1);
|
|
|
|
|
if ($searchs) {
|
|
|
|
|
const $params = $searchs.split('&') || [];
|
|
|
|
@ -68,7 +68,7 @@ function StudentStudy (props) {
|
|
|
|
|
const keys = item.split('=');
|
|
|
|
|
obj[keys[0]] = keys[1];
|
|
|
|
|
});
|
|
|
|
|
saveSearchParams({searchParams: $searchs, curPage: obj['pages']});
|
|
|
|
|
saveSearchParams({ searchParams: $searchs, curPage: obj['pages'] });
|
|
|
|
|
}
|
|
|
|
|
if (tab) {
|
|
|
|
|
changeUserCodeTab(tab);
|
|
|
|
@ -76,16 +76,15 @@ function StudentStudy (props) {
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const { hack = {} } = props;
|
|
|
|
|
if (hack.modify_code && hasUpdate) { // 代码更改,提示是否需要更新代码
|
|
|
|
|
if (hack && hack.modify_code && hasUpdate) { // 代码更改,提示是否需要更新代码
|
|
|
|
|
setHasUpdate(false);
|
|
|
|
|
handleUpdateNotice();
|
|
|
|
|
}
|
|
|
|
|
}, [props, hasUpdate, setHasUpdate]);
|
|
|
|
|
}, [hack, hasUpdate]);
|
|
|
|
|
|
|
|
|
|
const handleUpdateNotice = () => {
|
|
|
|
|
console.log(props);
|
|
|
|
|
props.confirm({
|
|
|
|
|
console.log(props);
|
|
|
|
|
props.confirm({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: (
|
|
|
|
|
<p>
|
|
|
|
@ -93,10 +92,10 @@ function StudentStudy (props) {
|
|
|
|
|
还未提交的代码,请自行保存
|
|
|
|
|
</p>
|
|
|
|
|
),
|
|
|
|
|
onOk () {
|
|
|
|
|
onOk() {
|
|
|
|
|
restoreInitialCode(id, '更新成功');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// Modal.confirm({
|
|
|
|
|
// title: '提示',
|
|
|
|
|
// content: (
|
|
|
|
@ -141,7 +140,7 @@ function StudentStudy (props) {
|
|
|
|
|
{(mygetHelmetapi &&mygetHelmetapi.name) || ''}
|
|
|
|
|
</span>
|
|
|
|
|
</div> */}
|
|
|
|
|
<UserInfo userInfo={userInfo}/>
|
|
|
|
|
<UserInfo userInfo={userInfo} />
|
|
|
|
|
<div className={'study_name'}>
|
|
|
|
|
<span>{hack.name}</span>
|
|
|
|
|
</div>
|
|
|
|
@ -152,11 +151,11 @@ function StudentStudy (props) {
|
|
|
|
|
onClick={() => handleClickEditor(hack.identifier)}
|
|
|
|
|
className={`quit-btn`}
|
|
|
|
|
>
|
|
|
|
|
<Icon type="form" className="quit-icon"/> 编辑
|
|
|
|
|
<Icon type="form" className="quit-icon" /> 编辑
|
|
|
|
|
</span>
|
|
|
|
|
{/* to="/problems" */}
|
|
|
|
|
<span onClick={handleClickQuit} className="quit-btn">
|
|
|
|
|
<Icon type="poweroff" className="quit-icon"/> 退出
|
|
|
|
|
<Icon type="poweroff" className="quit-icon" /> 退出
|
|
|
|
|
</span>
|
|
|
|
|
{/* <Button type="link" icon="form" className='quit-btn'>
|
|
|
|
|
<Link to="/problems">编辑</Link>
|
|
|
|
@ -185,7 +184,7 @@ function StudentStudy (props) {
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
|
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 {
|
|
|
|
|
hack,
|
|
|
|
|