合并aliyun

yslnewtiku
杨树林 5 years ago
commit 60fdfcffbb

File diff suppressed because one or more lines are too long

@ -27,7 +27,7 @@ function onMessageByLocalStorage(eventName, callback) {
} }
window.addEventListener("storage", function(ev) { window.addEventListener("storage", function(ev) {
const cb = localStorageMap[ev.key]; const cb = localStorageMap[ev.key];
console.log('storage event:', ev) // console.log('storage event:', ev)
if (cb) { if (cb) {
cb(JSON.parse(ev.newValue)) cb(JSON.parse(ev.newValue))
} }

@ -728,9 +728,12 @@ class CoursesBanner extends Component {
<Breadcrumb.Item className={"pointer"}> <Breadcrumb.Item className={"pointer"}>
<Tooltip visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false} <Tooltip visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
placement="topLeft" placement="topLeft"
title={<pre>{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?<span>您有{coursedata.teacher_applies_count}条新的加入申请<a className={"daishenp"} onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}><span style={{ title={<pre>{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?<span>您有{coursedata.teacher_applies_count}条新的加入申请<a className={"daishenp"} onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>
color:"#FFA804" <span style={{
}}>待审批</span></a></span>:""}</pre>}> color:"#FFA804"
}}>
待审批
</span></a></span>:""}</pre>}>
<span className="color-grey-c font-16" onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}> <span className="color-grey-c font-16" onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<span className={"mr10"}>教师</span> <span className={"mr10"}>教师</span>
<span className={"mr10"}>{coursedata.teacher_count}</span> <span className={"mr10"}>{coursedata.teacher_count}</span>

@ -34,6 +34,7 @@ class NewShixunModel extends Component{
getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sorts)=>{ getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sorts)=>{
let newsort=sorts; let newsort=sorts;
let no_jupyter=undefined;
if(this.props.type==="shixuns"&&type==="mine"){ if(this.props.type==="shixuns"&&type==="mine"){
if(this.props&&this.props.user.course_name===undefined){ if(this.props&&this.props.user.course_name===undefined){
newsort="created_at"; newsort="created_at";
@ -41,6 +42,12 @@ class NewShixunModel extends Component{
newsort="publish_time"; newsort="publish_time";
} }
} }
if(this.props.type==="shixuns"){
if(this.props&&this.props.user.course_name===undefined){
}else{
no_jupyter=1;
}
}
this.setState({ this.setState({
isspinning:true isspinning:true
}) })
@ -51,6 +58,7 @@ class NewShixunModel extends Component{
}else{ }else{
url="/subject_lists.json"; url="/subject_lists.json";
} }
axios.get(url,{params:{ axios.get(url,{params:{
page:page, page:page,
type:type, type:type,
@ -59,7 +67,8 @@ class NewShixunModel extends Component{
order:order, order:order,
diff:diff, diff:diff,
limit:limit, limit:limit,
sort:newsort sort:newsort,
no_jupyter:no_jupyter
}}).then((response) => { }}).then((response) => {
if(response.data){ if(response.data){
if(pagetype===undefined){ if(pagetype===undefined){

@ -388,7 +388,6 @@ class TPMIndex extends Component {
let url = window.location.href; let url = window.location.href;
let flag = url.indexOf("add_file")>-1; let flag = url.indexOf("add_file")>-1;
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
{/*头部*/} {/*头部*/}

@ -88,6 +88,15 @@ function JupyterTPI (props) {
const [myIdentifier, setMyIdentifier] = useState(''); const [myIdentifier, setMyIdentifier] = useState('');
const [renderCtx, setRenderCtx] = useState(() => (emptyCtx)); const [renderCtx, setRenderCtx] = useState(() => (emptyCtx));
let newHandletype=false
const newHandle = function (event) {
if(newHandletype===false){
newHandletype=true
saveJupyterTpi(event);
setTimeout(()=>{newHandletype=false},500)
}
}
// 保存代码 // 保存代码
const addEventListeners = () => { const addEventListeners = () => {
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
@ -95,12 +104,10 @@ function JupyterTPI (props) {
if(e){ if(e){
if(e.data){ if(e.data){
if(e.data==="jupytermessage"){ if(e.data==="jupytermessage"){
saveJupyterTpi(); newHandle()
} }
} }
} }
}) })
} }

@ -15,7 +15,8 @@ import {
fetchSyncJupyterCode, fetchSyncJupyterCode,
fetchreset_with_tpi, fetchreset_with_tpi,
fetchSaveJupyterTpi, fetchSaveJupyterTpi,
fetactive_with_tpi fetactive_with_tpi,
timeinfo_with_tpis
} from "../../services/jupyterServer"; } from "../../services/jupyterServer";
// 获取 jupyter 相关信息 // 获取 jupyter 相关信息
@ -76,7 +77,9 @@ export const getJupyterTpiUrl = (obj) => {
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;
addjypertime(Date.now() +3600 * 1000) dispatch(updataspinning(false))
setTimeout(()=>{ dispatch(addjypertime(Date.now() +3600 * 1000))},500)
// timeinfo_with_tpi(id,dispatch)
dispatch({ dispatch({
type: types.GET_JUPYTER_TPI_URL, type: types.GET_JUPYTER_TPI_URL,
payload: { payload: {
@ -106,7 +109,7 @@ export const syncJupyterCode = (identifier, msg) => {
const {status} = res.data const {status} = res.data
if (status === 0) { if (status === 0) {
message.success(msg); message.success(msg);
updataspinning(false) dispatch(updataspinning(false))
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 300); }, 300);
@ -131,7 +134,7 @@ export const reset_with_tpi = (identifier, msg) => {
const {status} = res.data const {status} = res.data
if (status === 0) { if (status === 0) {
message.success(msg); message.success(msg);
updataspinning(false) dispatch(updataspinning(false))
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 300); }, 300);
@ -156,7 +159,7 @@ 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);
addjypertime(Date.now() + 900 * 1000); dispatch(addjypertime(Date.now() + 900 * 1000))
} }
} }
}) })
@ -171,6 +174,7 @@ export const changeGetJupyterUrlState = (status) => {
payload: status payload: status
} }
} }
// 保存 jupyter tpi // 保存 jupyter tpi
export const saveJupyterTpi = () => { export const saveJupyterTpi = () => {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -234,3 +238,29 @@ export const updataspinning=(type)=>{
} }
} }
// 获取重置实训后的时间
export const timeinfo_with_tpi = (identifier, dispatch) => {
debugger
const params = {
identifier: identifier
};
debugger
timeinfo_with_tpis(params).then(res => {
debugger
console.log('同步时间成功: ', res);
if (res.data.status === 401) return;
if (res.status === 200) {
const {status} = res.data
console.log(status)
// dispatch(addjypertime(Date.now() +3600 * 1000))
// setTimeout(()=>{ dispatch(addjypertime(Date.now() +3600 * 1000))},500)
// if (status === 0) {
// message.success(msg);
// dispatch(updataspinning(false))
// setTimeout(() => {
// window.location.reload();
// }, 300);
// }
}
})
}

@ -16,7 +16,7 @@ const initialState = {
publishLoading: false, // 发布 publishLoading: false, // 发布
isMySource: false, isMySource: false,
drawervisible:false, drawervisible:false,
jupytertime:Date.now() + 3600 * 1000, jupytertime:0,
spinning:false spinning:false
} }

@ -45,3 +45,10 @@ export async function fetactive_with_tpi(params) {
const url = `/jupyters/active_with_tpi.json`; const url = `/jupyters/active_with_tpi.json`;
return axios.get(url, { params }); return axios.get(url, { params });
} }
//获取tpi重置实训的time
export async function timeinfo_with_tpis(params){
const url = `/jupyters/timeinfo_with_tpi.json`;
return axios.get(url, { params });
}

@ -528,7 +528,7 @@ li.li-width15{width: 15%;text-align: left}
li.li-width7{width: 7%;text-align: left} li.li-width7{width: 7%;text-align: left}
/*-----------------------------在线课堂动态----------------------------------*/ /*-----------------------------在线课堂动态----------------------------------*/
.courseHead{width: 100%;margin-bottom:40px;background-size: 100% 100%;background-image: url("/images/educoder/course-detail.jpg");height: 240px; .courseHead{width: 100%;margin-bottom:40px;background-size: 100% 100%;background-image: url("/images/educoder/courtailsbdpicture.jpg");height: 240px;
justify-content: center;align-items: center;display: -webkit-flex; justify-content: center;align-items: center;display: -webkit-flex;
background-size: cover; background-size: cover;
background-position: center; background-position: center;

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save