add jupyter url

chromesetting
tangjiang 5 years ago
parent 7df1d3c4c7
commit 287b80b1e9

@ -615,6 +615,11 @@ class App extends Component {
<Route path="/shixuns/new" component={Newshixuns}> <Route path="/shixuns/new" component={Newshixuns}>
</Route> </Route>
{/* jupyter */}
<Route path="/tasks/:identifier/jupyter/"
component={JupyterTPI}
/>
<Route path="/tasks/:stageId" component={IndexWrapperComponent}/> <Route path="/tasks/:stageId" component={IndexWrapperComponent}/>
<Route path="/shixuns/:shixunId" component={TPMIndexComponent}> <Route path="/shixuns/:shixunId" component={TPMIndexComponent}>
@ -702,10 +707,6 @@ class App extends Component {
(props) => (<Developer {...this.props} {...props} {...this.state} />) (props) => (<Developer {...this.props} {...props} {...this.state} />)
}/> }/>
<Route path="/jupytertpi"
component={JupyterTPI}
/>
<Route exact path="/" <Route exact path="/"
// component={ShixunsHome} // component={ShixunsHome}
render={ render={

@ -52,6 +52,7 @@ export function initAxiosInterceptors(props) {
//proxy="http://47.96.87.25:48080" //proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net" proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net" proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net/"
//proxy="http://192.168.2.63:3001" //proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

@ -1,11 +1,14 @@
.banner-wrap{ .banner-wrap{
width: 100%; width: 100%;
height: 300px; height: 300px;
background-image: url(/static/media/path.e39ba7de.png); // background-image: url(/static/media/path.e39ba7de.png);
background-color: #000a4f; // background: #000a4f url(../../images/oj//oj_banner.jpg) none center;
/* background-size: cover; */ // background-color: #000a4f;
background-position: center; // /* background-size: cover; */
background-repeat: no-repeat; // background-position: center;
// background-repeat: no-repeat;
background: rgb(0, 1, 35) url(../../images/oj/oj_banner.jpg) no-repeat center;
background-size: cover;
} }
.developer-list{ .developer-list{

@ -4,17 +4,25 @@
* @Github: * @Github:
* @Date: 2019-12-11 08:35:23 * @Date: 2019-12-11 08:35:23
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-11 09:13:09 * @LastEditTime: 2019-12-12 09:26:17
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React, { useEffect } from 'react';
import SplitPane from 'react-split-pane'; import SplitPane from 'react-split-pane';
import { Button } from 'antd'; import { Button } from 'antd';
import {
connect
} from 'react-redux';
import UserInfo from '../../developer/components/userInfo'; import UserInfo from '../../developer/components/userInfo';
import actions from '../../../redux/actions';
function JupyterTPI (props) { function JupyterTPI (props) {
useEffect(() => {
// 获取数据集
// 获取jupyter地址
}, []);
return ( return (
<div className="jupyter_area"> <div className="jupyter_area">
<div className="jupyter_header"> <div className="jupyter_header">
@ -44,4 +52,21 @@ function JupyterTPI (props) {
); );
} }
export default JupyterTPI; const mapStateToProps = (state) => {
const {jupyter_tpi_url, jupyter_data_set, jupyter_identifier} = state.jupyterReducer;
return {
url: jupyter_tpi_url,
dataSets: jupyter_data_set,
identifier: jupyter_identifier
};
}
const mapDispatchToProps = (dispatch) => ({
getJupyterTpiDataSet: (identifier) => dispatch(actions.getJupyterTpiDataSet(identifier)),
getJupyterTpiUrl: (identifier) => dispatch(actions.getJupyterTpiUrl(identifier))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(JupyterTPI);

@ -50,6 +50,10 @@ const types = {
SAVE_USER_INFO: 'SAVE_USER_INFO', // 只在用户信息 SAVE_USER_INFO: 'SAVE_USER_INFO', // 只在用户信息
SAVE_HACK_IDENTIFIER: 'SAVE_HACK_IDENTIFIER', // 用户界面跑到编辑界面需要用的id值 SAVE_HACK_IDENTIFIER: 'SAVE_HACK_IDENTIFIER', // 用户界面跑到编辑界面需要用的id值
SAVE_EDITOR_CODE: 'SAVE_EDITOR_CODE', // 保存详情页面中编辑时的代码 SAVE_EDITOR_CODE: 'SAVE_EDITOR_CODE', // 保存详情页面中编辑时的代码
/*** jupyter */
GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集
GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url
SAVE_JUPYTER_IDENTIFIER: 'SAVE_JUPYTER_IDENTIFIER', // 保存jupyter identifier
} }
export default types; export default types;

@ -62,6 +62,11 @@ import {
getUserInfoForNew getUserInfoForNew
} from './user'; } from './user';
import {
getJupyterTpiDataSet,
getJupyterTpiUrl
} from './jupyter';
export default { export default {
toggleTodo, toggleTodo,
getOJList, getOJList,
@ -103,6 +108,9 @@ export default {
restoreInitialCode, restoreInitialCode,
getUserInfoForNew, getUserInfoForNew,
saveUserCodeForInterval, saveUserCodeForInterval,
saveEditorCodeForDetail saveEditorCodeForDetail,
// jupyter
getJupyterTpiDataSet,
getJupyterTpiUrl
// isUpdateCodeCtx // isUpdateCodeCtx
} }

@ -0,0 +1,38 @@
/*
* @Description: jupyter tpi 相关内容
* @Author: tangjiang
* @Github:
* @Date: 2019-12-12 09:01:30
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-12 09:30:53
*/
import types from "./actionTypes";
import { fetchJupyterTpiDataSet, fetchJupyterTpiUrl } from "../../services/jupyterServer";
// 获取 jupyter tpi 数据集
export const getJupyterTpiDataSet = (identifier) => {
return (dispatch) => {
fetchJupyterTpiDataSet(identifier).then(res => {
if (res.data.status === 401) return; // 用户未登录
console.log('数据集:', res);
});
}
}
// 获取 jupyter tpi 地址
export const getJupyterTpiUrl = (identifier) => {
return (dispatch) => {
fetchJupyterTpiUrl(identifier).then(res => {
if (res.data.status === 401) return; // 用户未登录
console.log('获取url', res);
})
}
}
// 保存 jupyter identifer
export const saveJupyterIdentifier = (identifier) => {
return {
type: types.SAVE_JUPYTER_IDENTIFIER,
payload: identifier
}
}

@ -13,6 +13,7 @@ import ojListReducer from './ojListReducer';
import ojForUserReducer from './ojForUserReducer'; import ojForUserReducer from './ojForUserReducer';
import commonReducer from './commonReducer'; import commonReducer from './commonReducer';
import userReducer from './userReducer'; import userReducer from './userReducer';
import jupyterReducer from './jupyterReducer';
export default combineReducers({ export default combineReducers({
testReducer, testReducer,
@ -20,5 +21,6 @@ export default combineReducers({
ojListReducer, ojListReducer,
ojForUserReducer, ojForUserReducer,
commonReducer, commonReducer,
userReducer userReducer,
jupyterReducer
}); });

@ -0,0 +1,41 @@
/*
* @Description:
* @Author: tangjiang
* @Github:
* @Date: 2019-12-12 09:01:39
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-12 09:29:49
*/
import types from "../actions/actionTypes";
const initState = {
jupyter_tpi_url: '',
jupyter_data_set: [],
jupyter_identifier: ''
};
const JupyterReducer = (state = initState, action) => {
switch (action.type) {
case types.GET_JUPYTER_DATA_SETS:
return {
...state,
jupyter_data_set: action.payload
}
case types.GET_JUPYTER_TPI_URL:
return {
...state,
jupyter_tpi_url: action.payload
}
case types.SAVE_JUPYTER_IDENTIFIER:
return {
...state,
jupyter_identifier: action.payload
}
default:
return {
...state
}
}
}
export default JupyterReducer;

@ -0,0 +1,20 @@
/*
* @Description: jupyter相关接口
* @Author: tangjiang
* @Github:
* @Date: 2019-12-12 09:07:07
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-12 09:10:58
*/
import axios from 'axios';
// 获取数据集
export async function fetchJupyterTpiDataSet (identifier) {
const url = `/shixuns/${identifier}/jupyter_data_sets.json`;
return axios.get(url);
}
// 获取 tpi url
export async function fetchJupyterTpiUrl (params) {
const url = `/jupyters/get_info_with_tpi.json`;
return axios.get(url, { params });
}
Loading…
Cancel
Save