添加代码更新提示

chromesetting
tangjiang 5 years ago
parent ae4a4a2f99
commit a99b4d3aac

@ -4,10 +4,10 @@
* @Github:
* @Date: 2019-11-23 10:53:19
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-11 17:35:49
* @LastEditTime: 2019-12-12 19:08:24
*/
import './index.scss';
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import SplitPane from 'react-split-pane';
import LeftPane from './leftpane';
@ -15,18 +15,22 @@ import RightPane from './rightpane';
// import { Link } from 'react-router-dom';
// import { getImageUrl } from 'educoder'
// import RightPane from '../newOrEditTask/rightpane';
import { Icon } from 'antd';
import { Icon, Modal } from 'antd';
import UserInfo from '../components/userInfo';
import actions from '../../../redux/actions';
import { fromStore} from 'educoder';
import { withRouter } from 'react-router';
const StudentStudy = (props) => {
function StudentStudy (props) {
const {
userInfo,
hack_identifier
} = props;
// 是否更新
const [isUpdate, setIsUpdate] = useState(true);
useEffect(() => {
const {
match: { params },
@ -35,13 +39,53 @@ const StudentStudy = (props) => {
} = props;
let { id } = params;
// console.log(id);
// 保存当前的id
saveUserProgramIdentifier(id);
// startProgramQuestion(id);
getUserProgramDetail(id);
}, []);
useEffect(() => {
console.log('=======>>>>>>>>');
const { hack = {} } = props;
if (!hack.modify_code && isUpdate) { // 代码更改,提示是否需要更新代码
setIsUpdate(false);
Modal.confirm({
title: '提示',
content: (
<p>
代码文件有更新啦 <br />
还未提交的代码请自行保存
</p>
),
okText: '立即更新',
cancelText: '稍后再说',
onOk () {
console.log('更新代码....');
}
});
}
}, [props]);
// useEffect(() => {
// const {hack} = props;
// if (!hack.modify_code) { // 代码更改,提示是否需要更新代码
// Modal.confirm({
// title: '提示',
// content: (
// <p>
// 代码文件有更新啦 <br />
// 还未提交的代码,请自行保存
// </p>
// ),
// okText: '立即更新',
// cancelText: '稍后再说',
// onOk () {
// console.log('更新代码....');
// }
// });
// }
// }, [props]);
const _hack_id = hack_identifier || fromStore('hack_identifier');
// 处理编辑

Loading…
Cancel
Save