From 91b3706d42c16430f1a54f85f58f53187ff69a7f 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 12:41:06 +0800
Subject: [PATCH 1/3] =?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/src/modules/tpm/TPMIndex.js | 18 +++++-----
.../Challenges/Challengesjupyter.js | 36 ++++++++++++-------
.../Collaborators/Collaborators.js | 4 +--
3 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js
index a8e869a3c..cf674a220 100644
--- a/public/react/src/modules/tpm/TPMIndex.js
+++ b/public/react/src/modules/tpm/TPMIndex.js
@@ -423,22 +423,24 @@ class TPMIndex extends Component {
{ this.state.is_jupyter===false?
排行榜
:""}
-
- {this.state.identity >4||this.state.identity===undefined ? "":
-
-
+
- 更多设置在这里,点击“配置”看一看~
-
-
+ 更多设置在这里,点击“配置”看一看~
+
+
}
trigger="click"
placement="top"
visible={this.state.openknows}
>
+
+
+
+ {this.state.identity >4||this.state.identity===undefined ? "":
+
配置
-
}
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index 6eb9c128b..573f30d4d 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -1,23 +1,13 @@
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder'
-import { Divider, Tooltip,Upload,Modal} from 'antd';
+import { Divider, Tooltip,Upload,Modal,Spin} 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)
@@ -326,9 +316,31 @@ class Challengesjupyter extends Component {
}
}
+ handleClickResetTpisync_code=(id)=>{
+ this.setState({
+ jupyter_url : null,
+ booljupyterurls:false,
+ })
+ const url = `/jupyters/reset_with_tpm.json`;
+ axios.get(url,{params:{
+ identifier:id
+ }}).then((response) => {
+ if(response.data.status===0){
+
+ setTimeout(()=>{
+ this.setState({
+ jupyter_url :response.data.url,
+ booljupyterurls:true,
+ })
+ },1000);
+ this.props.showNotification('重置实训成功!');
+ }
+ });
+ }
// 重置实训
handleClickResetTpi = () => {
let id=this.props.match.params.shixunId;
+ let that=this;
Modal.confirm({
title: '重置实训',
content: (
@@ -340,7 +352,7 @@ class Challengesjupyter extends Component {
okText: '确定',
cancelText: '取消',
onOk () {
- console.log(handleClickResetTpisync_code(id))
+ that.handleClickResetTpisync_code(id)
},
onCancel() {
diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js
index 0404bc0fe..1d88bf32a 100644
--- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js
+++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js
@@ -525,9 +525,9 @@ class Collaborators extends Component {
-
-
+ {Collaboratorslist&&Collaboratorslist.length===0?
请先将新的管理员通过 this.showCollaboratorsvisible("cooperation")}>"添加合作者" 加入合作者列表
-
+ :""}
{
Collaboratorslist.length === 0 ? "" : Collaboratorslist.map((item, key) => {
From bd34b956669f8c94a0454dbf209c566a91bf1a5d Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 25 Dec 2019 13:36:22 +0800
Subject: [PATCH 2/3] =?UTF-8?q?OJ=E5=88=A0=E9=99=A4=E6=B6=88=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/hacks_controller.rb | 5 +++++
app/models/hack.rb | 11 -----------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb
index cb2e67922..d2dcbe145 100644
--- a/app/controllers/hacks_controller.rb
+++ b/app/controllers/hacks_controller.rb
@@ -132,6 +132,11 @@ class HacksController < ApplicationController
def destroy
@hack.destroy
+ base_attrs = {
+ user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id,
+ parent_container_type: "HackDelete"
+ }
+ @hack.tidings.create!(base_attrs)
render_ok
end
diff --git a/app/models/hack.rb b/app/models/hack.rb
index e1b2b225e..b94eddbd2 100644
--- a/app/models/hack.rb
+++ b/app/models/hack.rb
@@ -23,8 +23,6 @@ class Hack < ApplicationRecord
scope :opening, -> {where(open_or_not: 1)}
scope :mine, -> (author_id){ where(user_id: author_id) }
- after_destroy :send_delete_tiding
-
def language
if hack_codes.count == 1
hack_codes.first.language
@@ -53,13 +51,4 @@ class Hack < ApplicationRecord
user_id == user.id || user.admin_or_business?
end
- private
- def send_delete_tiding
- base_attrs = {
- user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: User.current.id,
- parent_container_type: "HackDelete"
- }
- tidings.create!(base_attrs)
- end
-
end
From 66d0bbbda72044354496c379fdfe203249796f22 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 13:44:49 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/tpm/TPMsettings/Configuration.js | 2 +-
public/react/src/modules/tpm/jupyter/index.js | 12 ++++++------
.../tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js
index b5aafc909..c7c359b35 100644
--- a/public/react/src/modules/tpm/TPMsettings/Configuration.js
+++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js
@@ -311,7 +311,7 @@ export default class Shixuninformation extends Component {
}
- {this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>7||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>7?"":
+ {this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>2?"":
公开程度:
diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js
index 6a61715a7..96f2fd6d2 100644
--- a/public/react/src/modules/tpm/jupyter/index.js
+++ b/public/react/src/modules/tpm/jupyter/index.js
@@ -332,12 +332,12 @@ function JupyterTPI (props) {
{/*sync | poweroff */}
-
+ {/**/}
-
+ {/*
*/}