Merge branches 'dev_new_shixunsrepository' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

 Conflicts:
	public/react/src/AppConfig.js
dev_new_shixunsrepository
杨树明 5 years ago
commit ceda427aa8

@ -297,7 +297,7 @@ class CommonWorkAppraiseReply extends Component{
<style>{` <style>{`
.course-message .panel-comment_item .comment_orig_content { .course-message .panel-comment_item .comment_orig_content {
width: 1074px; width: 1040px;
} }
.course-message .childrenCommentsView .comment_orig_content { .course-message .childrenCommentsView .comment_orig_content {
width: 1000px; width: 1000px;

@ -55,7 +55,7 @@ class MemoDetail extends Component {
} }
} }
componentDidMount() { componentDidMount() {
window.$("html,body").animate({"scrollTop":0}) // window.$("html,body").animate({"scrollTop":0})
const { match } = this.props const { match } = this.props

@ -200,13 +200,13 @@ class ShixunsHome extends Component {
item.sub_repertoires.map((i,k)=>{ item.sub_repertoires.map((i,k)=>{
return( return(
<div className="clearfix mt20 mb5 pb10 navlistpanel-line" key={k}> <div className="clearfix mt20 mb5 pb10 navlistpanel-line" key={k}>
<p className="little-title clearfix welcome_shixun_index little-titles" <div className="little-title clearfix welcome_shixun_index little-titles"
data-id="1" data-rep-id="1" data-type="sub" data-id="1" data-rep-id="1" data-type="sub"
> >
<Link to={"/shixuns?id="+i.id+"&type=sub&palce="+item.id}> <Link to={"/shixuns?id="+i.id+"&type=sub&palce="+item.id}>
{i.name} {i.name}
</Link> </Link>
</p> </div>
{ {
i.tags.map((t,e)=>{ i.tags.map((t,e)=>{
return( return(

@ -69,6 +69,7 @@ function JupyterTPI (props) {
drawervisible, drawervisible,
reset_with_tpi, reset_with_tpi,
jupytertime, jupytertime,
endjupytertime,
active_with_tpi, active_with_tpi,
spinning, spinning,
updataspinning, updataspinning,
@ -303,7 +304,7 @@ function JupyterTPI (props) {
> >
<div className="sortinxdirection"> <div className="sortinxdirection">
<Icon type="file-text" className="jupyter_icon fl lineheighttaj filestyles" /> <Icon type="file-text" className="jupyter_icon fl lineheighttaj filestyles" />
<a className="jupyter_name ml10 maxnamewidth181 lineheighttaj colorlineheighttaj" title={item.title}>{item.title}</a> <a className="jupyter_name ml10 maxnamewidth152 lineheighttaj colorlineheighttaj" title={item.title}>{item.title}</a>
<a className={"fr color-blue lineheighttaj"} <a className={"fr color-blue lineheighttaj"}
onClick={() => { onClick={() => {
jsCopy("file_path"+i) jsCopy("file_path"+i)
@ -337,11 +338,24 @@ function JupyterTPI (props) {
cancelText: '取消', cancelText: '取消',
onOk () { onOk () {
reset_with_tpi(myIdentifier, '重置成功'); reset_with_tpi(myIdentifier, '重置成功');
// active_with_tpi(myIdentifier, '重置成功');
} }
}) })
} }
const endonFinish= () =>{
Modal.confirm({
title: '命令行连接时长提醒',
content: (
<p style={{ lineHeight: '24px' }}>
命令行即将中断需要延长使用时间吗
</p>
),
okText: '立即延长',
cancelText: '不需要',
onOk () {
active_with_tpi(myIdentifier, '延长成功');
}
})
}
return ( return (
<Spin tip="加载中..." spinning={spinning}> <Spin tip="加载中..." spinning={spinning}>
<div className="jupyter_area"> <div className="jupyter_area">
@ -351,6 +365,9 @@ function JupyterTPI (props) {
<span className="title_desc" style={{ marginTop: '10px' }}>{jupyterInfo.name}</span> <span className="title_desc" style={{ marginTop: '10px' }}>{jupyterInfo.name}</span>
<span className="title_time jupytertitle_time"> <span className="title_time jupytertitle_time">
<Countdown value={jupytertime} format="HH:mm:ss" onFinish={onFinish}/> <Countdown value={jupytertime} format="HH:mm:ss" onFinish={onFinish}/>
<span className={"Countdowntypes"}>
{endjupytertime===false?"":<Countdown value={endjupytertime} format="HH:mm:ss" onFinish={endonFinish}/>}
</span>
</span> </span>
</p> </p>
<p className="jupyter_btn"> <p className="jupyter_btn">
@ -457,7 +474,7 @@ const mapStateToProps = (state) => {
jupyter_pagination, jupyter_pagination,
jupyter_identifier jupyter_identifier
} = state.jupyterReducer; } = state.jupyterReducer;
const { loading ,drawervisible,jupytertime,spinning} = state.commonReducer; const { loading ,drawervisible,jupytertime,spinning,endjupytertime} = state.commonReducer;
return { return {
loading, loading,
jupyter_info, jupyter_info,
@ -470,6 +487,7 @@ const mapStateToProps = (state) => {
jupyter_identifier, jupyter_identifier,
drawervisible, drawervisible,
jupytertime, jupytertime,
endjupytertime,
spinning spinning
}; };
} }

@ -26,7 +26,7 @@
.filestyles{ .filestyles{
color: #28b887 !important; color: #28b887 !important;
font-size: 25px !important; font-size: 25px !important;
margin-left:20px; margin-left:48px;
} }
.Resizer.horizontal:hover { .Resizer.horizontal:hover {
border-top: 5px solid rgba(0, 0, 0, 0.5); border-top: 5px solid rgba(0, 0, 0, 0.5);
@ -230,16 +230,23 @@ line-height: 50px !important;
width: 186px; width: 186px;
} }
.maxnamewidth181{ .maxnamewidth152{
max-width:181px; max-width:152px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
cursor: default; cursor: default;
width: 181px; width: 152px;
} }
.height45lineheight45{ .height45lineheight45{
height: 45px; height: 45px;
line-height: 45px !important; line-height: 45px !important;
}
.Countdowntypes{
width:1px;
height:1px;
overflow: hidden;
display: block;
} }

@ -30,7 +30,8 @@ class Challengesjupyter extends Component {
fileList:[], fileList:[],
shuaxin:false, shuaxin:false,
showtime:false, showtime:false,
jupytertime:Date.now() +3600 * 1000 jupytertime:Date.now() +3600 * 1000,
endtimes:false
} }
} }
@ -119,10 +120,12 @@ class Challengesjupyter extends Component {
let remainingSeconds=response.data.remainingSeconds; let remainingSeconds=response.data.remainingSeconds;
// let summain=3600 * 1000; // let summain=3600 * 1000;
let sums= remainingSeconds * 1000; let sums= remainingSeconds * 1000;
let endsms=(remainingSeconds-300<0?0:remainingSeconds-300)*1000
// let sum=summain-sums; // let sum=summain-sums;
setTimeout(()=>{ setTimeout(()=>{
this.setState({ this.setState({
jupytertime:Date.now() +sums jupytertime:Date.now() +sums,
endtimes:endsms===0?Date.now() +1000:Date.now() +endsms
}) })
},500); },500);
} }
@ -436,8 +439,45 @@ class Challengesjupyter extends Component {
} }
}) })
} }
onendFinish=()=>{
let id=this.props.match.params.shixunId;
let that=this;
Modal.confirm({
title: '命令行连接时长提醒',
content: (
<p style={{ lineHeight: '24px' }}>
命令行即将中断需要延长使用时间吗
</p>
),
okText: '立即延长',
cancelText: '不需要',
onOk () {
that.onendhandleClickResetTpi(id)
}
})
}
onendhandleClickResetTpi=(id)=>{
const url = `/jupyters/active_with_tpm.json`;
axios.get(url,{params:{
identifier:id
}}).then((response) => {
if(response.data.status===0){
this.props.showNotification('延长成功!');
setTimeout(()=>{
this.setState({
jupytertime:Date.now() + 900 * 1000,
endtimes:Date.now() + 300 * 1000
})
},500);
}
});
}
render() { render() {
let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state; let{ChallengesDataList,booljupyterurls,enlarge,fileList,endtimes}=this.state;
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
//老师 //老师
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
@ -509,6 +549,7 @@ class Challengesjupyter extends Component {
<span className={"Countdowntypes"}> <span className={"Countdowntypes"}>
{/*this.state.jupytertime*/} {/*this.state.jupytertime*/}
<Countdown value={this.state.jupytertime} format="HH:mm:ss" onFinish={this.onFinish}/> <Countdown value={this.state.jupytertime} format="HH:mm:ss" onFinish={this.onFinish}/>
{endtimes===false?"":<Countdown value={endtimes} format="HH:mm:ss" onFinish={this.onendFinish}/>}
</span> </span>
<p className="clearfix mb20 edu-back-white"> <p className="clearfix mb20 edu-back-white">

@ -74,7 +74,7 @@ export const getJupyterTpiUrl = (obj) => {
const id = obj.identifier || jupyter_info.myshixun_identifier; const id = obj.identifier || jupyter_info.myshixun_identifier;
fetchJupyterTpiUrl({identifier: id}).then(res => { fetchJupyterTpiUrl({identifier: id}).then(res => {
if (res.data.status === 401) return; // 用户未登录 if (res.data.status === 401) return; // 用户未登录
console.log('获取url', res); //console.log('获取url', res);
if (res.status === 200) { if (res.status === 200) {
const { status, url = '', port } = res.data; const { status, url = '', port } = res.data;
dispatch(updataspinning(false)) dispatch(updataspinning(false))
@ -159,7 +159,8 @@ export const active_with_tpi = (identifier, msg) => {
const {status} = res.data const {status} = res.data
if (status === 0) { if (status === 0) {
message.success(msg); message.success(msg);
dispatch(addjypertime(Date.now() + 900 * 1000)) // dispatch(addjypertime(Date.now() + 900 * 1000,false))
setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800);
} }
} }
}) })
@ -224,11 +225,21 @@ export const changeshowDrawer = (type) => {
} }
} }
//增加倒计时 //增加倒计时
export const addjypertime=(time)=>{ export const addjypertime=(time,endtime)=>{
return { if(endtime===false){
type: types.CHANGE_JYPYTER_TIME, return {
payload: time type: types.CHANGE_JYPYTER_TIME,
payload: time,
endtime:false
}
}else{
return {
type: types.CHANGE_JYPYTER_TIME,
payload: time,
endtime:endtime
}
} }
} }
export const updataspinning=(type)=>{ export const updataspinning=(type)=>{
@ -262,8 +273,9 @@ export const timeinfo_with_tpi = (identifier, dispatch) => {
let remainingSeconds=res.data.remainingSeconds; let remainingSeconds=res.data.remainingSeconds;
// let summain=3600 * 1000; // let summain=3600 * 1000;
let sums= remainingSeconds * 1000; let sums= remainingSeconds * 1000;
let endsms=(remainingSeconds-300<0?0:remainingSeconds-300)*1000
// let sum=summain-sums; // let sum=summain-sums;
setTimeout(()=>{ dispatch(addjypertime(Date.now() +sums))},500); setTimeout(()=>{ dispatch(addjypertime(Date.now() +sums,endsms===0?Date.now() +1000:Date.now() +endsms))},500);
} }
} }
} }

@ -17,11 +17,12 @@ const initialState = {
isMySource: false, isMySource: false,
drawervisible:false, drawervisible:false,
jupytertime:0, jupytertime:0,
endjupytertime:false,
spinning:false spinning:false
} }
const commonReducer = (state = initialState, action) => { const commonReducer = (state = initialState, action) => {
console.log(action)
switch (action.type) { switch (action.type) {
case types.SHOW_OR_HIDE_CONTROL: case types.SHOW_OR_HIDE_CONTROL:
return { return {
@ -61,7 +62,8 @@ const commonReducer = (state = initialState, action) => {
case types.CHANGE_JYPYTER_TIME: case types.CHANGE_JYPYTER_TIME:
return { return {
...state, ...state,
jupytertime: action.payload jupytertime: action.payload,
endjupytertime:action.endtime,
} }
case types.CHANGE_UPDETA_SPIN: case types.CHANGE_UPDETA_SPIN:
return { return {

@ -45,7 +45,7 @@ const JupyterReducer = (state = initState, action) => {
jupyter_tpi_code: port jupyter_tpi_code: port
} }
case types.SAVE_JUPYTER_IDENTIFIER: case types.SAVE_JUPYTER_IDENTIFIER:
console.log('保存的jupyter_identifier', action.payload); //console.log('保存的jupyter_identifier', action.payload);
return { return {
...state, ...state,
jupyter_identifier: action.payload jupyter_identifier: action.payload

Loading…
Cancel
Save