/* * @Description: 学员学习 * @Author: tangjiang * @Github: * @Date: 2019-11-23 10:53:19 * @LastEditors : tangjiang * @LastEditTime : 2020-02-10 18:24:01 */ import './index.scss'; import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import SplitPane from 'react-split-pane'; import LeftPane from './leftpane'; import RightPane from './rightpane'; // import { Link } from 'react-router-dom'; // import { getImageUrl } from 'educoder' // import RightPane from '../newOrEditTask/rightpane'; import { Icon } from 'antd'; import UserInfo from '../components/userInfo'; import actions from '../../../redux/actions'; import { fromStore, CNotificationHOC} from 'educoder'; import { withRouter } from 'react-router'; function StudentStudy (props) { const [hasUpdate, setHasUpdate] = useState(true); const { hack, userInfo, // hack_identifier, // user_program_identifier, restoreInitialCode, changeUserCodeTab, changeShowOrHideControl, searchParams, saveSearchParams } = props; const { match: { params }, getUserProgramDetail, saveUserProgramIdentifier } = props; let { id, tab } = params; useEffect(() => { // 保存当前的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) { } 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) { changeUserCodeTab(tab); } }, []); useEffect(() => { const { hack = {} } = props; if (hack.modify_code && hasUpdate) { // 代码更改,提示是否需要更新代码 setHasUpdate(false); handleUpdateNotice(); } }, [props, hasUpdate, setHasUpdate]); const handleUpdateNotice = () => { console.log(props); props.confirm({ title: '提示', content: (
代码文件有更新啦
还未提交的代码,请自行保存
// 代码文件有更新啦
// 还未提交的代码,请自行保存
//