From 74f89610ad03952e76b6bcae5651ff02b7ce7f71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 25 Dec 2019 11:39:55 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/config/webpack.config.dev.js | 2 +-
public/react/src/modules/tpm/jupyter/index.js | 39 +++++++++++-----
.../react/src/modules/tpm/jupyter/index.scss | 44 +++++++++++++++++--
.../Challenges/Challengesjupyter.js | 44 ++++++++++++++++---
.../shixunchild/shixunchildCss/Challenges.css | 18 ++++++++
public/react/src/redux/actions/jupyter.js | 5 ++-
.../src/redux/reducers/jupyterReducer.js | 5 ++-
7 files changed, 133 insertions(+), 24 deletions(-)
diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js
index 86938e51d..4e28af31f 100644
--- a/public/react/config/webpack.config.dev.js
+++ b/public/react/config/webpack.config.dev.js
@@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl);
module.exports = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
- // devtool: "cheap-module-eval-source-map",
+ devtool: "cheap-module-eval-source-map",
// 开启调试
//devtool: "source-map", // 开启调试
// These are the "entry points" to our application.
diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js
index 4485cc1fe..6a61715a7 100644
--- a/public/react/src/modules/tpm/jupyter/index.js
+++ b/public/react/src/modules/tpm/jupyter/index.js
@@ -19,13 +19,18 @@ import actions from '../../../redux/actions';
import RightPane from './rightPane';
import MyIcon from "../../../common/components/MyIcon";
+function clearSlct() {
+ if("getSelection" in window){
+ window.getSelection().removeAllRanges();
+ }else{
+ document.selection.empty();
+ };
+}
function jsCopy(s) {
- var copyEle = document.getElementById(s);
- const range = document.createRange(); // 创造range
- window.getSelection().removeAllRanges(); //清除页面中已有的selection
- range.selectNode(copyEle); // 选中需要复制的节点
- window.getSelection().addRange(range); // 执行选中元素
- const copyStatus = document.execCommand("Copy"); // 执行copy操作
+ clearSlct();
+ const copyEle = document.getElementById(s);
+ copyEle.select();
+ const copyStatus=document.execCommand("Copy");
// 对成功与否定进行提示
copyStatuss(copyStatus)
}
@@ -66,7 +71,8 @@ function JupyterTPI (props) {
jupytertime,
active_with_tpi,
spinning,
- updataspinning
+ updataspinning,
+ jupyter_folder_name
} = props;
const emptyCtx = (
@@ -274,8 +280,8 @@ function JupyterTPI (props) {
mouseLeaveDelay={0.3}
>
-
-
{item.title}
+
+
{item.title}
{
jsCopy("file_path"+i)
@@ -382,11 +388,22 @@ function JupyterTPI (props) {
>
{/**/}
-
+
{/**/}
数据集
{/* 数据集 */}
+
{ renderCtx }
{total<20?"":
{
jupyter_data_set,
jupyter_tpi_url_state,
jupyter_data_set_count,
+ jupyter_folder_name,
jupyter_pagination,
jupyter_identifier
} = state.jupyterReducer;
@@ -425,6 +443,7 @@ const mapStateToProps = (state) => {
jupyter_tpi_url_state,
total: jupyter_data_set_count,
pagination: jupyter_pagination,
+ jupyter_folder_name:jupyter_folder_name,
jupyter_identifier,
drawervisible,
jupytertime,
diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss
index 932b0c89f..c056f019b 100644
--- a/public/react/src/modules/tpm/jupyter/index.scss
+++ b/public/react/src/modules/tpm/jupyter/index.scss
@@ -23,7 +23,11 @@
cursor: row-resize;
width: 100%;
}
-
+.filestyles{
+ color: #28b887 !important;
+ font-size: 25px !important;
+ margin-left:20px;
+}
.Resizer.horizontal:hover {
border-top: 5px solid rgba(0, 0, 0, 0.5);
border-bottom: 5px solid rgba(0, 0, 0, 0.5);
@@ -138,9 +142,9 @@
height:49px;
line-height: 49px;
background: #070F1A !important;
- border-bottom: 1px solid #17212F !important;
+ //border-bottom: 1px solid #17212F !important;
color:#FFFFFF !important;
- border-top: 1px solid #17212F !important;
+ //border-top: 1px solid #17212F !important;
}
.iconfont{
color:#28b887!important;
@@ -193,4 +197,38 @@ line-height: 50px !important;
.jupyter_data_list{
padding-left: 20px;
+
+}
+
+.bortop17212F{
+ border-top: 1px solid #17212F !important;
+}
+
+.borbottom17212F{
+ border-bottom: 1px solid #17212F !important;
+}
+
+.jupyterfilepaths{
+ color: #888 !important;
+ font-size: 16px !important;
+ padding-left: 20px;
+ background: #070F1A !important;
+}
+
+.maxnamewidth200{
+ max-width: 200px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ cursor: default;
+ width: 200px;
+}
+
+.maxnamewidth181{
+ max-width:181px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ cursor: default;
+ width: 181px;
}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index 684e24bc1..6eb9c128b 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -1,14 +1,23 @@
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder'
-import { Divider, Tooltip,Upload,Spin} from 'antd';
+import { Divider, Tooltip,Upload,Modal} from 'antd';
import LoadingSpin from '../../../../common/LoadingSpin';
import 'antd/lib/pagination/style/index.css';
import '../shixunchildCss/Challenges.css';
import axios from 'axios';
const $ = window.$;
-
+ function handleClickResetTpisync_code(id){
+ const url = `/jupyters/reset_with_tpm.json`;
+ axios.post(url,{
+ identifier:id
+ }).then((response) => {
+ if(response.data.status===0){
+ return response
+ }
+ })
+}
class Challengesjupyter extends Component {
constructor(props) {
super(props)
@@ -316,6 +325,28 @@ class Challengesjupyter extends Component {
}
}
+
+ // 重置实训
+ handleClickResetTpi = () => {
+ let id=this.props.match.params.shixunId;
+ Modal.confirm({
+ title: '重置实训',
+ content: (
+
+ 你在本文件中修改的内容将丢失,
+ 是否确定重新加载初始代码?
+
+ ),
+ okText: '确定',
+ cancelText: '取消',
+ onOk () {
+ console.log(handleClickResetTpisync_code(id))
+ },
+ onCancel() {
+
+ },
+ })
+ }
render() {
let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state;
let id = this.props.match.params.shixunId;
@@ -514,11 +545,12 @@ class Challengesjupyter extends Component {
}
-
+
+
+
diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css
index 83d8fb15d..6b055be56 100644
--- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css
+++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css
@@ -217,3 +217,21 @@
.jupyterswidth{
width: 1140px;
}
+
+.chongzhistyles{
+ color: #fff;
+ width: 85px !important;
+ height: 32px !important;
+ margin-right: 20px;
+}
+
+.chongzhistyles:hover, .chongzhistyles:focus{
+ color: #fff !important;
+ background-color: #29BD8B !important;
+ border-color: transparent;
+}
+.chongzhistyles:active, .chongzhistyles:active{
+ color: #fff !important;
+ background-color: #29BD8B !important;
+ border-color: transparent ;
+}
diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js
index 6afdea7b7..1cd6c2f11 100644
--- a/public/react/src/redux/actions/jupyter.js
+++ b/public/react/src/redux/actions/jupyter.js
@@ -52,12 +52,13 @@ export const getJupyterTpiDataSet = (identifier, params) => {
fetchJupyterTpiDataSet(identifier, params).then(res => {
if (res.data.status === 401) return; // 用户未登录
if (res.status === 200) {
- const {data_sets, data_sets_count} = res.data;
+ const {data_sets, data_sets_count,folder_name} = res.data;
dispatch({
type: types.GET_JUPYTER_DATA_SETS,
payload: {
data_sets,
- data_sets_count
+ data_sets_count,
+ folder_name,
}
});
}
diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js
index f8825fb36..75c9d374f 100644
--- a/public/react/src/redux/reducers/jupyterReducer.js
+++ b/public/react/src/redux/reducers/jupyterReducer.js
@@ -25,11 +25,12 @@ const initState = {
const JupyterReducer = (state = initState, action) => {
switch (action.type) {
case types.GET_JUPYTER_DATA_SETS:
- const { data_sets, data_sets_count } = action.payload;
+ const { data_sets, data_sets_count,folder_name} = action.payload;
return {
...state,
jupyter_data_set: data_sets,
- jupyter_data_set_count: data_sets_count
+ jupyter_data_set_count: data_sets_count,
+ jupyter_folder_name:folder_name,
}
case types.GET_JUPYTER_TPI_URL:
const {url, status, port} = action.payload;