Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

chromesetting
daiao 5 years ago
commit 59f0cf51cf

@ -4,10 +4,10 @@
* @Github: * @Github:
* @Date: 2019-11-27 16:02:36 * @Date: 2019-11-27 16:02:36
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 10:47:44 * @LastEditTime: 2019-12-19 19:47:32
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { Tabs, Button, Icon } from 'antd'; import { Tabs, Button, Icon } from 'antd';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import InitTabCtx from '../initTabCtx'; import InitTabCtx from '../initTabCtx';
@ -23,10 +23,11 @@ const ControlSetting = (props) => {
submitLoading, submitLoading,
identifier, identifier,
excuteState, excuteState,
showOrHideControl,
commitRecordDetail, commitRecordDetail,
changeLoadingState, changeLoadingState,
changeSubmitLoadingStatus, changeSubmitLoadingStatus,
showOrHideControl, changeShowOrHideControl,
// debuggerCode, // debuggerCode,
// startDebuggerCode, // 外部存入 // startDebuggerCode, // 外部存入
onDebuggerCode, onDebuggerCode,
@ -44,10 +45,14 @@ const ControlSetting = (props) => {
setDefaultActiveKey(key); setDefaultActiveKey(key);
} }
useEffect(() => {
setShowTextResult(props.showOrHideControl);
}, [props]);
// 显示/隐藏tab // 显示/隐藏tab
const handleShowControl = () => { const handleShowControl = () => {
setShowTextResult(!showTextResult); setShowTextResult(!showTextResult);
showOrHideControl(!showTextResult); changeShowOrHideControl(!showTextResult);
} }
// 调试代码 // 调试代码
@ -55,7 +60,7 @@ const ControlSetting = (props) => {
// console.log(formRef.current.handleTestCodeFormSubmit); // console.log(formRef.current.handleTestCodeFormSubmit);
// 调出控制台界面 // 调出控制台界面
setShowTextResult(true); setShowTextResult(true);
showOrHideControl(true); changeShowOrHideControl(true);
formRef.current.handleTestCodeFormSubmit(() => { formRef.current.handleTestCodeFormSubmit(() => {
setDefaultActiveKey('2'); setDefaultActiveKey('2');
}); });
@ -131,19 +136,20 @@ const ControlSetting = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const {commonReducer, ojForUserReducer} = state; const {commonReducer, ojForUserReducer} = state;
const {loading, excuteState, submitLoading } = commonReducer; const {loading, excuteState, submitLoading, showOrHideControl } = commonReducer;
const { commitRecordDetail } = ojForUserReducer; const { commitRecordDetail } = ojForUserReducer;
return { return {
loading, loading,
submitLoading, submitLoading,
excuteState, excuteState,
showOrHideControl,
// identifier: user_program_identifier, // identifier: user_program_identifier,
commitRecordDetail // 提交详情 commitRecordDetail // 提交详情
}; };
}; };
// changeSubmitLoadingStatus // changeSubmitLoadingStatus
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
showOrHideControl: (flag) => dispatch(actions.showOrHideControl(flag)), changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)),
changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag)), changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag)),
changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)), changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)),
debuggerCode: (identifier, values) => dispatch(actions.debuggerCode(identifier, values)), debuggerCode: (identifier, values) => dispatch(actions.debuggerCode(identifier, values)),

@ -4,11 +4,11 @@
* @Github: * @Github:
* @Date: 2019-11-25 17:50:33 * @Date: 2019-11-25 17:50:33
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 15:26:46 * @LastEditTime: 2019-12-19 19:32:08
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { fromStore, toStore } from 'educoder'; import { fromStore, toStore } from 'educoder';
import { Icon } from 'antd'; // import { Icon } from 'antd';
// import { Select } from 'antd'; // import { Select } from 'antd';
// const { Option } = Select; // const { Option } = Select;
const SettingDrawer = (props) => { const SettingDrawer = (props) => {

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 15:02:52 * @Date: 2019-11-27 15:02:52
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 17:52:31 * @LastEditTime: 2019-12-19 19:36:24
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
@ -146,7 +146,7 @@ function MyMonacoEditor (props, ref) {
> >
<Icon type="bell" /> <Icon type="bell" />
</Badge> </Badge>
<span onClick={handleRestoreCode} className="flex_normal">{renderRestore}</span> <span onClick={handleRestoreCode} className="flex_normal" style={{ display: identifier ? 'inline-block' : 'none'}}>{renderRestore}</span>
<MyIcon className='code-icon' type="iconshezhi" onClick={handleShowDrawer}/> <MyIcon className='code-icon' type="iconshezhi" onClick={handleShowDrawer}/>
</div> </div>
<MonacoEditor <MonacoEditor

@ -11,7 +11,8 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
// padding: 0 30px; // padding: 0 30px;
background: #000; // background: #000;
background: rgba(18,28,36,1);
color: #fff; color: #fff;
} }
.code-title, .code-title,

@ -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: 2019-12-19 17:51:19 * @LastEditTime: 2019-12-19 19:48:20
*/ */
import './index.scss'; import './index.scss';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
@ -29,7 +29,8 @@ function StudentStudy (props) {
userInfo, userInfo,
hack_identifier, hack_identifier,
// user_program_identifier, // user_program_identifier,
restoreInitialCode restoreInitialCode,
changeShowOrHideControl
} = props; } = props;
const { const {
@ -88,11 +89,14 @@ function StudentStudy (props) {
// 处理编辑 // 处理编辑
const handleClickEditor = () => { const handleClickEditor = () => {
changeShowOrHideControl(false);
props.saveEditorCodeForDetail(); props.saveEditorCodeForDetail();
props.history.push(`/problems/${_hack_id}/edit`); props.history.push(`/problems/${_hack_id}/edit`);
} }
// 处理退出 // 处理退出
const handleClickQuit = () => { const handleClickQuit = () => {
// 将控制台关闭
changeShowOrHideControl(false);
props.saveEditorCodeForDetail(); props.saveEditorCodeForDetail();
props.history.push('/problems'); props.history.push('/problems');
} }
@ -164,6 +168,7 @@ const mapDispatchToProps = (dispatch) => ({
saveEditorCodeForDetail: (code) => dispatch(actions.saveEditorCodeForDetail(code)), saveEditorCodeForDetail: (code) => dispatch(actions.saveEditorCodeForDetail(code)),
// 恢复初始代码 // 恢复初始代码
restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)), restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)),
changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag))
}); });
export default withRouter(connect( export default withRouter(connect(

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 14:59:51 * @Date: 2019-11-27 14:59:51
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 15:06:49 * @LastEditTime: 2019-12-19 19:13:05
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
@ -32,6 +32,7 @@ const RightPane = (props) => {
const [editorCode, setEditorCode] = useState(''); const [editorCode, setEditorCode] = useState('');
let initFlag = true;
useEffect(() => { useEffect(() => {
if (editor_code) { if (editor_code) {
setEditorCode(editor_code); setEditorCode(editor_code);
@ -51,8 +52,12 @@ const RightPane = (props) => {
// 代码块内容变化时 // 代码块内容变化时
const handleCodeChange = (code) => { const handleCodeChange = (code) => {
// 保存用户提交的代码块 // 保存用户提交的代码块
// console.log(code);
setEditorCode(code); setEditorCode(code);
// 第一次回填代码内容时不更新;
if (initFlag) {
initFlag = false;
return;
}
if (!timer) { if (!timer) {
timer = setInterval(() => { timer = setInterval(() => {
clearInterval(timer); clearInterval(timer);

@ -53,6 +53,13 @@ class Challenges extends Component {
ChallengesDataList: response.data, ChallengesDataList: response.data,
sumidtype: false, sumidtype: false,
}); });
if(response.data.description=== ""||response.data.description===null||response.data.description===undefined){
this.setState({
isopentitletype:"Less",
})
}
} }
} }
}).catch((error) => { }).catch((error) => {
@ -72,7 +79,7 @@ class Challenges extends Component {
let box=document.getElementById("shixunchallengesid"); let box=document.getElementById("shixunchallengesid");
if(box){ if(box){
boxoffsetHeigh=box.offsetHeight boxoffsetHeigh=box.offsetHeight
if(boxoffsetHeigh<260){ if(boxoffsetHeigh<300){
this.setState({ this.setState({
isopentitletype:"Less", isopentitletype:"Less",
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
@ -338,6 +345,7 @@ class Challenges extends Component {
} }
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return ( return (
<React.Fragment> <React.Fragment>
{AccountProfiletype===true?<AccountProfile {AccountProfiletype===true?<AccountProfile
@ -411,7 +419,7 @@ class Challenges extends Component {
{ {
` `
#shixunchallengesid{ #shixunchallengesid{
max-height: 260px; max-height: 300px;
overflow: hidden; overflow: hidden;
} }
` `
@ -431,11 +439,18 @@ class Challenges extends Component {
<div className="justify break_full_word new_li " <div className="justify break_full_word new_li "
id="challenge_editorMd_description"> id="challenge_editorMd_description">
<p id="ReactMarkdown" style={{overflow:'hidden'}}> {ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?
<div className="edu-tab-con-box clearfix edu-txt-center">
{this.props.identity < 5?<img className="newedu-nodata-img mb20"
src={getImageUrl("images/educoder/shixunnodata.png")} />:<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />}
<p className="edu-nodata-p mb80">暂时还没有相关数据哦</p>
</div>
:<p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div> <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>
} }
</p> </p>}
</div> </div>
</div> </div>

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { markdownToHTML, configShareForCustom} from 'educoder' import { markdownToHTML, configShareForCustom,getImageUrl} from 'educoder'
import { Divider, Tooltip } from 'antd'; import { Divider, Tooltip } from 'antd';
import LoadingSpin from '../../../../common/LoadingSpin'; import LoadingSpin from '../../../../common/LoadingSpin';
import 'antd/lib/pagination/style/index.css'; import 'antd/lib/pagination/style/index.css';
@ -23,7 +23,8 @@ class Challengesjupyter extends Component {
booljupyterurls:false, booljupyterurls:false,
loading:false, loading:false,
boxoffsetHeigh:0, boxoffsetHeigh:0,
opentitletype:true opentitletype:true,
isopentitletype:"Less",
} }
} }
@ -41,6 +42,11 @@ class Challengesjupyter extends Component {
ChallengesDataList: response.data, ChallengesDataList: response.data,
sumidtype: false, sumidtype: false,
}); });
if(response.data.description=== ""||response.data.description===null||response.data.description===undefined){
this.setState({
isopentitletype:"Less",
})
}
} }
} }
}).catch((error) => { }).catch((error) => {
@ -55,13 +61,15 @@ class Challengesjupyter extends Component {
let box=document.getElementById("shixunchallengesid"); let box=document.getElementById("shixunchallengesid");
if(box){ if(box){
boxoffsetHeigh=box.offsetHeight boxoffsetHeigh=box.offsetHeight
if(boxoffsetHeigh<260){ if(boxoffsetHeigh<300){
this.setState({ this.setState({
opentitletype:false, isopentitletype:"Less",
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
}) })
}else{ }else{
this.setState({ this.setState({
isopentitletype:"greater",
opentitletype:true,
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
}) })
} }
@ -229,7 +237,7 @@ class Challengesjupyter extends Component {
{ {
` `
#shixunchallengesid{ #shixunchallengesid{
max-height: 260px; max-height: 300px;
overflow: hidden; overflow: hidden;
} }
` `
@ -239,9 +247,22 @@ class Challengesjupyter extends Component {
<div className={"pd20"} id={"shixunchallengesid"}> <div className={"pd20"} id={"shixunchallengesid"}>
<p id="ReactMarkdown" style={{overflow:'hidden'}}> <p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": {/*{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":*/}
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div> {/* <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>*/}
} {/*}*/}
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?
<div className="edu-tab-con-box clearfix edu-txt-center">
{this.props.identity < 5?<img className="newedu-nodata-img mb20"
src={getImageUrl("images/educoder/shixunnodata.png")} />:<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />}
<p className="edu-nodata-p mb80">暂时还没有相关数据哦</p>
</div>
:<p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>
}
</p>}
</p> </p>
{ {
booljupyterurls===true? booljupyterurls===true?
@ -259,7 +280,7 @@ class Challengesjupyter extends Component {
} }
</div> </div>
{this.state.opentitletype===true?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> {this.state.isopentitletype==="Less"?"":this.state.opentitletype===true?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
<a className={"font-14 color-grey-9"}>阅读全文 <i className={"iconfont icon-jiantou9 font-14"}></i></a> <a className={"font-14 color-grey-9"}>阅读全文 <i className={"iconfont icon-jiantou9 font-14"}></i></a>
</Divider>:<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> </Divider>:<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
<a className={"font-14 color-grey-9"}>收起全文 <i className={"iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu- font-14"}></i></a> <a className={"font-14 color-grey-9"}>收起全文 <i className={"iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu- font-14"}></i></a>

@ -656,7 +656,7 @@ class Collaborators extends Component {
<a href={item.user.user_url} target="_blank" className="mr20 fl edu-position"> <a href={item.user.user_url} target="_blank" className="mr20 fl edu-position">
<img alt="用户头像" className="radius" height="48" src={getImageUrl("images/" + item.user.image_url)} <img alt="用户头像" className="radius" height="48" src={getImageUrl("images/" + item.user.image_url)}
width="48"/> width="48"/>
<span className={item && item.user && item.user.shixun_manager === true&&this.props.power === true ? "ml20 yslusercjz newyslusercjz" : "none "} <span className={item && item.user && item.user.shixun_manager === true? "ml20 yslusercjz newyslusercjz" : "none "}
// style={{display: this.props.power === false ? "none" : "inline-block"}} // style={{display: this.props.power === false ? "none" : "inline-block"}}
> >
<p className="yslusercjztest newyslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span> <p className="yslusercjztest newyslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span>

@ -4,12 +4,12 @@
* @Github: * @Github:
* @Date: 2019-11-27 16:30:50 * @Date: 2019-11-27 16:30:50
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-11-28 21:15:34 * @LastEditTime: 2019-12-19 19:42:10
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
// 切换控制台显示与隐藏 // 切换控制台显示与隐藏
export const showOrHideControl = (flag) => { export const changeShowOrHideControl = (flag) => {
return { return {
type: types.SHOW_OR_HIDE_CONTROL, type: types.SHOW_OR_HIDE_CONTROL,
payload: flag payload: flag

@ -52,7 +52,7 @@ import {
} from './ojForUser'; } from './ojForUser';
import { import {
showOrHideControl, changeShowOrHideControl,
changeLoadingState, changeLoadingState,
changeSubmitLoadingStatus, changeSubmitLoadingStatus,
changePublishLoadingStatus, changePublishLoadingStatus,
@ -97,7 +97,7 @@ export default {
testCaseOutputChange, testCaseOutputChange,
debuggerCode, debuggerCode,
startProgramQuestion, startProgramQuestion,
showOrHideControl, changeShowOrHideControl,
changeLoadingState, changeLoadingState,
getUserCommitRecord, getUserCommitRecord,
getUserCommitRecordDetail, getUserCommitRecordDetail,

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:41:48 * @Date: 2019-11-27 13:41:48
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 14:49:03 * @LastEditTime: 2019-12-19 20:10:39
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -38,7 +38,12 @@ const ojForUserReducer = (state = initialState, action) => {
const { hack, test_case } = action.payload; const { hack, test_case } = action.payload;
const { code }= hack; const { code }= hack;
let tempCode = Base64.decode(code) let tempCode = Base64.decode(code)
let tempDesc = JSON.parse(hack.description); let tempDesc;
try {
tempDesc = JSON.parse(hack.description);
} catch (error) {
tempDesc = hack.description;
}
Object.assign(hack, {code: tempCode, description: tempDesc}); Object.assign(hack, {code: tempCode, description: tempDesc});
return { return {
...state, ...state,

Loading…
Cancel
Save