diff --git a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
index 4dd21860e..5a5fffdf9 100644
--- a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
+++ b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
@@ -404,4 +404,418 @@ a.white-btn.use_scope-btn:hover{
.width30{
width: 30%;
-}
\ No newline at end of file
+}
+
+.newshixunheadersear{
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-pack: center;
+ justify-content: center;
+ margin: 0 auto;
+}
+.packinput .ant-input{
+ height: 55px;
+ width:663px !important;
+ font-size: 14px;
+ /*color: #681616 !important;*/
+ border-color: #E1EDF8 !important;
+ padding-left: 20px;
+}
+
+.packinput .ant-input-group-addon .ant-btn{
+ width:137px !important;
+ font-size: 18px;
+ height: 53px;
+ background:rgba(76,172,255,1);
+
+}
+.tabtitle{
+ height: 62px !important;
+ -webkit-box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15);
+ box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15);
+ border-radius: 6px;
+ background: #fff;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+.tabtitles2{
+ background: #fff;
+ height: 62px !important;
+ width: 1200px;
+}
+
+.tabtitless{
+ height: 62px !important;
+ line-height: 62px !important;
+
+}
+.tabtitle1{
+
+}
+.tabtitle2{
+ margin-left: 30px !important;
+
+}
+
+
+.counttit{
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.counttittext{
+ text-align: left;
+ width: 1200px;
+ height: 18px;
+ color: #888888;
+ font-size: 13px;
+ margin-top: 24px;
+
+
+}
+.counttittexts{
+ color: #4CACFF !important;
+ font-size: 13px;
+}
+
+.mainx{
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-pack: center;
+ justify-content: center;
+ margin-top: 17px;
+}
+.project-packages-list{
+
+}
+.project-package-item{
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-direction:column;
+ flex-direction:column;
+ margin-bottom: 20px;
+ padding: 20px;
+ background: white;
+ /* box-shadow: 1px 3px 3px 1px rgba(156,156,156,0.16); */
+
+}
+.xuxianpro{
+ height: 20px;
+ border-bottom: 1px dashed;
+ border-color: #EAEAEA;
+ margin-bottom: 18px;
+}
+.magr11{
+ margin-top: 11px;
+}
+.highlight{
+ color: #4CACFF;
+}
+.fonttext{
+ font-size: 20px;
+ font-weight:bold;
+}
+
+.fontextcolor{
+ color: #777777;
+}
+.tzbq{
+ margin-left: 68px;
+}
+.tzbqx{
+ /* margin-left: 24px; */
+}
+.bjyss{
+ background: #F8F8F8;
+}
+.zj{
+ overflow:hidden;
+ -o-text-overflow:ellipsis;
+ text-overflow:ellipsis;
+ white-space:nowrap
+}
+.ziticor{
+ color: #777777;
+ font-size: 13px;
+}
+.foohter{
+ margin-top: 20px;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-direction:row;
+ flex-direction:row;
+}
+
+.maxwidth1100{
+ max-width: 1100px;
+ overflow:hidden;
+ -o-text-overflow:ellipsis;
+ text-overflow:ellipsis;
+ white-space:nowrap;
+ font-size: 18px !important;
+ font-weight: 500;
+ color: rgba(51,51,51,1) !important;
+}
+
+
+.newshixunmodelmidfont{
+ font-size: 14px;
+ font-weight: 400;
+ color: #999999;
+ margin-top: 15px;
+ margin-left: 30px;
+ max-width: 1100px;
+ overflow: hidden;
+ -o-text-overflow: ellipsis;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+}
+
+.newshixunmodelbotfont{
+ font-size:12px;
+ font-weight:400;
+ color:rgba(102,102,102,1);
+ margin-top: 15px;
+ margin-left: 30px;
+}
+
+.newshixunlist{
+ max-height:227px;
+ width: 1200px;
+}
+
+.xuxianpro {
+ height: 20px;
+ border-bottom: 1px dashed;
+ border-color: #eaeaea;
+ margin-bottom: 18px;
+}
+
+.newshixunpd030{
+ padding: 0px 30px;
+}
+
+.pd303010{
+ padding: 30px 30px 10px;
+}
+
+.newshixunfont12{
+ font-size: 12px;
+ color: rgba(76,172,255,1);
+ line-height: 21px;
+}
+
+.newshixunmode{
+ width: 100px;
+ height: 38px;
+ border-radius: 3px;
+ /*border: 1px solid rgba(191,191,191,1);*/
+}
+
+.ntopsj {
+ position: absolute;
+ top: -4px;
+}
+
+.nyslbottomsj {
+ position: absolute;
+ bottom: -6px;
+}
+
+.inherits .ant-dropdown-menu-item{
+ cursor: inherit !important;
+}
+
+.menus{
+ width: 91px;
+ text-align: center;
+}
+
+.newshixunmodelbotfont span{
+ display: inline-block;
+ margin-right: 34px;
+}
+
+.minhegiht300{
+ min-height: 300px;
+}
+
+.newshixunlist:hover{
+ -webkit-box-shadow: 1px 6px 16px rgba(156,156,156,0.16);
+ box-shadow: 1px 6px 16px rgba(156,156,156,0.16);
+ opacity: 1;
+ border-radius: 2px;
+}
+
+.newshixun500{
+ max-width: 500px;
+ overflow: hidden;
+ -o-text-overflow: ellipsis;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.mt3 {
+ margin-top: 3px !important;
+}
+
+.highlight{
+ color: #4CACFF;
+}
+
+.newshixunbottombtn{
+ position: fixed;
+ z-index: 1000;
+ bottom: 0px;
+ width: 100%;
+ height: 63px;
+ background: rgba(255,255,255,1);
+ -webkit-box-shadow: 0px -4px 4px 0px rgba(0,0,0,0.05);
+ box-shadow: 0px -4px 4px 0px rgba(0,0,0,0.05);
+}
+
+
+.mb60shixun{
+ margin-bottom: 60px !important;
+}
+
+.padding13-30 {
+ padding: 13px 30px;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+.displaymodulat {
+ display: -ms-flexbox;
+ display: flex;
+ display: -webkit-flex;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -ms-flex-align: center;
+ align-items: center;
+}
+
+.WordNumberTextarea {
+ outline: none; /* 去掉输入字符时的默认样式 */
+ appearance: none;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ background-color: white;
+ text-shadow: none;
+ -webkit-writing-mode: horizontal-tb !important;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ resize: none; /*禁止拉伸*/
+ border: none; /*去掉默认边框*/
+ width: 100%;
+ height: 130px;
+ border: none;
+ display: block;
+}
+
+.WordNumbernote {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ text-decoration: none;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ overflow: hidden;
+ height: auto;
+ border: 1px solid rgba(234, 234, 234, 1);
+ border-radius: 0.125rem;
+ margin: 10px 10px 0px 10px;
+ padding: 10px 10px 5px 10px;
+ backgroud: rgba(234, 234, 234, 1);
+ width: 530px;
+ margin-left: 10px;
+ margin-top: 25px;
+ height: 214px !important;
+}
+
+.WordNumbernote .WordNumberTextarea {
+ outline: none;
+ appearance: none;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ background-color: white;
+ text-shadow: none;
+ -webkit-writing-mode: horizontal-tb !important;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ resize: none;
+ border: none;
+ width: 100%;
+ height: 169px !important;
+ border: none;
+ display: block;
+}
+
+.WordNumberTextarea-count {
+ display: inline-block;
+ float: right;
+ font-size: 16px;
+ color: #adadad;
+ padding-right: 0.25rem;
+}
+
+.borerinput {
+ border: 1px solid #DD1717 !important;
+}
+
+.borerinputs {
+ border: 1px solid #eee !important;
+}
+
+
+.mexertwo {
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-direction: initial;
+ flex-direction: initial;
+}
+
+.mexeheigth {
+ line-height: 40px;
+}
+
+.mexeheigth2 {
+ line-height: 40px;
+ width: 74px;
+}
+
+.minbuttionte {
+ /* display: flex; */
+ margin-top: 20px;
+ width: 100%;
+ /* align-items: center; */
+ margin-bottom: 17px;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -ms-flex-align: center;
+ align-items: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ -ms-flex-direction: initial;
+ flex-direction: initial;
+}
+
+.initialflex{
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-direction:initial;
+ flex-direction:initial;
+}
+
+.newshixunheadersear{
+ margin: 0 auto;
+}
+
+.newshixunmodels{
+ margin: 0 auto;
+}
diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css
index 89b62856d..8e479aa9b 100644
--- a/public/stylesheets/educoder/edu-main.css
+++ b/public/stylesheets/educoder/edu-main.css
@@ -674,7 +674,7 @@ input.radio-width90{ width: 90px; }
.ringauto{width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 50%;background-color: #F4FAFF;margin-right:5px;}
/*-------------------个人主页:右侧提示区域--------------------------*/
-.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:30px;z-index: 10;}
+.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:80px;z-index: 10;}
.-task-sidebar div{height: 40px;line-height: 40px;box-sizing: border-box;width:40px;background:#4CACFF;color:#fff;font-size:20px;text-align:center;margin-bottom:5px;border-radius: 4px;}
.-task-sidebar div i{ color:#fff;}
.-task-sidebar div i:hover{color: #fff!important;}
From c4c71de5ea0aebd4c0caa6dab4ead810b54b8245 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 10 Dec 2019 14:52:31 +0800
Subject: [PATCH 010/157] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/tpm/TPMsettings/Configuration.js | 33 +
.../tpm/TPMsettings/LearningSettings.js | 33 +
.../tpm/TPMsettings/Shixuninformation.js | 33 +
.../modules/tpm/TPMsettings/TPMsettings.js | 1567 +++++++++--------
4 files changed, 887 insertions(+), 779 deletions(-)
create mode 100644 public/react/src/modules/tpm/TPMsettings/Configuration.js
create mode 100644 public/react/src/modules/tpm/TPMsettings/LearningSettings.js
create mode 100644 public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js
new file mode 100644
index 000000000..393e0659c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
new file mode 100644
index 000000000..393e0659c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
new file mode 100644
index 000000000..060f71f9c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index 94e1ec3c1..b189cb4f3 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -1,13 +1,29 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
-import MonacoEditor from 'react-monaco-editor';
+import {
+ Input,
+ Select,
+ Radio,
+ Checkbox,
+ Popconfirm,
+ message,
+ Modal,
+ Icon,
+ DatePicker,
+ Breadcrumb,
+ Upload,
+ Button,
+ notification,
+ Tooltip,
+ Tabs
+} from 'antd';
-//MonacoDiffEditor 对比模式
-import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+import Shixuninformation from './Shixuninformation';
-// import "antd/dist/antd.css";
+import Configuration from './Configuration';
+
+import LearningSettings from './LearningSettings';
-import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
@@ -15,15 +31,13 @@ import axios from 'axios';
import './css/TPMsettings.css';
-import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
-
-let origin = getUrl();
+import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
let path = getUrl("/editormd/lib/")
const $ = window.$;
-const { TabPane } = Tabs;
+const {TabPane} = Tabs;
let timeout;
@@ -31,66 +45,65 @@ let currentValue;
const Option = Select.Option;
-const RadioGroup = Radio.Group;
const confirm = Modal.confirm;
// 处理整点 半点
// 取传入时间往后的第一个半点
export function handleDateStrings(dateString) {
- if (!dateString) return dateString;
- const ar = dateString.split(':')
- if (ar[1] == '00' || ar[1] == '30') {
- return dateString
- }
- const miniute = parseInt(ar[1]);
- if (miniute < 30 || miniute == 60) {
- return [ar[0], '30'].join(':')
- }
- if (miniute < 60) {
- // 加一个小时
- const tempStr = [ar[0], '00'].join(':');
- const format = "YYYY-MM-DD HH:mm";
- const _moment = moment(tempStr, format)
- _moment.add(1, 'hours')
- return _moment.format(format)
- }
-
- return dateString
+ if (!dateString) return dateString;
+ const ar = dateString.split(':')
+ if (ar[1] == '00' || ar[1] == '30') {
+ return dateString
+ }
+ const miniute = parseInt(ar[1]);
+ if (miniute < 30 || miniute == 60) {
+ return [ar[0], '30'].join(':')
+ }
+ if (miniute < 60) {
+ // 加一个小时
+ const tempStr = [ar[0], '00'].join(':');
+ const format = "YYYY-MM-DD HH:mm";
+ const _moment = moment(tempStr, format)
+ _moment.add(1, 'hours')
+ return _moment.format(format)
+ }
+
+ return dateString
}
// 恢复数据
-function md_rec_data(k,mdu,id, editor){
- if(window.sessionStorage.getItem(k+mdu) !== null){
- editor.setValue(window.sessionStorage.getItem(k+mdu));
- md_clear_data(k,mdu,id);
+function md_rec_data(k, mdu, id, editor) {
+ if (window.sessionStorage.getItem(k + mdu) !== null) {
+ editor.setValue(window.sessionStorage.getItem(k + mdu));
+ md_clear_data(k, mdu, id);
}
}
// 保存数据
-function md_add_data(k,mdu,d){
- window.sessionStorage.setItem(k+mdu,d);
+function md_add_data(k, mdu, d) {
+ window.sessionStorage.setItem(k + mdu, d);
}
// 清空保存的数据
-function md_clear_data(k,mdu,id){
- window.sessionStorage.removeItem(k+mdu);
- var id1 = "#e_tip_"+id;
- var id2 = "#e_tips_"+id;
- if(k == 'content'){
+function md_clear_data(k, mdu, id) {
+ window.sessionStorage.removeItem(k + mdu);
+ var id1 = "#e_tip_" + id;
+ var id2 = "#e_tips_" + id;
+ if (k == 'content') {
$(id2).html("");
- }else{
+ } else {
$(id1).html("");
}
}
-function md_elocalStorage(editor,mdu,id){
- if (window.sessionStorage){
- var oc = window.sessionStorage.getItem('content'+mdu);
- if(oc !== null ){
- $("#e_tips_"+id).data('editor', editor);
- var h = '您上次有已保存的数据,是否
恢复 ? /
不恢复';
- $("#e_tips_"+id).html(h);
+function md_elocalStorage(editor, mdu, id) {
+ if (window.sessionStorage) {
+ var oc = window.sessionStorage.getItem('content' + mdu);
+ if (oc !== null) {
+ $("#e_tips_" + id).data('editor', editor);
+ var h = '您上次有已保存的数据,是否
恢复 ? /
不恢复';
+ $("#e_tips_" + id).html(h);
}
- setInterval(function() {
+ setInterval(function () {
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
@@ -98,27 +111,27 @@ function md_elocalStorage(editor,mdu,id){
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
- if(editor.getValue().trim() != ""){
- md_add_data("content",mdu,editor.getValue());
- var id1 = "#e_tip_"+id;
- var id2 = "#e_tips_"+id;
+ if (editor.getValue().trim() != "") {
+ md_add_data("content", mdu, editor.getValue());
+ var id1 = "#e_tip_" + id;
+ var id2 = "#e_tips_" + id;
- $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
+ $(id1).html(" 数据已于 " + h + ':' + m + ':' + s + " 保存 ");
$(id2).html("");
}
- },10000);
+ }, 10000);
- }else{
- $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
+ } else {
+ $("#e_tip_" + id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
-function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
+function create_editorMD(id, width, high, placeholder, imageUrl, initValue, callback) {
var editorName = window.editormd(id, {
width: width,
height: high,
path: path, // "/editormd/lib/"
- markdown : initValue,
+ markdown: initValue,
syncScrolling: "single",
tex: true,
tocm: true,
@@ -173,8 +186,8 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
}
-function updatamakedown(id){
- setTimeout(()=>{
+function updatamakedown(id) {
+ setTimeout(() => {
var shixunDescr = window.editormd.markdownToHTML(id, {
htmlDecode: "style,script,iframe",
taskList: true,
@@ -182,34 +195,36 @@ function updatamakedown(id){
flowChart: true,
sequenceDiagram: true
});
- $("#"+id+" p:first").addClass("ReactMarkdown");
+ $("#" + id + " p:first").addClass("ReactMarkdown");
$('#collaborators_list_info').show()
}, 200)
}
function range(start, end) {
- const result = [];
- for (let i = start; i < end; i++) {
- result.push(i);
- }
- return result;
+ const result = [];
+ for (let i = start; i < end; i++) {
+ result.push(i);
+ }
+ return result;
}
+
function disabledDateTime() {
- return {
- // disabledHours: () => range(0, 24).splice(4, 20),
- disabledMinutes: () => range(1, 30).concat(range(31, 60)),
- // disabledSeconds: () => [0, 60],
- };
+ return {
+ // disabledHours: () => range(0, 24).splice(4, 20),
+ disabledMinutes: () => range(1, 30).concat(range(31, 60)),
+ // disabledSeconds: () => [0, 60],
+ };
}
function disabledDate(current) {
- return current && current < moment().endOf('day').subtract(1, 'days');
+ return current && current < moment().endOf('day').subtract(1, 'days');
}
+
export default class TPMsettings extends Component {
constructor(props) {
super(props)
this.state = {
- fileList: [],
+ fileList: [],
commandLine: 0,
Openpublic: 0,
settingsData: undefined,
@@ -222,7 +237,7 @@ export default class TPMsettings extends Component {
can_copy: undefined,
task_pass: undefined,
test_set_permission: undefined,
- code_edit_permission: undefined,
+ code_edit_permission: undefined,
hide_code: undefined,
code_hidden: undefined,
forbid_copy: undefined,
@@ -232,11 +247,11 @@ export default class TPMsettings extends Component {
scopetype: false,
departmentslist: undefined,
description: '',
- evaluate_script:undefined,
+ evaluate_script: undefined,
standard_scripts: undefined,
choice_main_type: "",
choice_small_type: [],
- choice_standard_scripts:undefined,
+ choice_standard_scripts: undefined,
editordescriptios: undefined,
editorevaluate_scripts: undefined,
choice_standard_scriptssum: undefined,
@@ -252,31 +267,32 @@ export default class TPMsettings extends Component {
evaluate_scripttype: false,
exec_timetype: false,
traineetype: false,
- standard_scriptsModal:false,
- standard_scriptsModals:false,
- SelectTheCommandtype:false,
- multi_webssh:false,
- status:0,
- opers:false,
- operss:false,
- testscripttiptype:false,
- opersss:false,
- operateshixunstype:false,
- opening_time:"",
- opensmail:false,
- scope_partmenttype:false,
- newuse_scope:undefined,
- scope_partments:0,
- shixun_service_configs:undefined,
- shixun_service_configlist:undefined,
+ standard_scriptsModal: false,
+ standard_scriptsModals: false,
+ SelectTheCommandtype: false,
+ multi_webssh: false,
+ status: 0,
+ opers: false,
+ operss: false,
+ testscripttiptype: false,
+ opersss: false,
+ operateshixunstype: false,
+ opening_time: "",
+ opensmail: false,
+ scope_partmenttype: false,
+ newuse_scope: undefined,
+ scope_partments: 0,
+ shixun_service_configs: undefined,
+ shixun_service_configlist: undefined,
pod_exist_time: undefined,
pod_exist_timetype: false,
- shixunmemoMDvalue:"",
- language:"",
- deleteisnot:true
+ shixunmemoMDvalue: "",
+ language: "",
+ deleteisnot: true
}
}
- descriptionMD=(initValue, id)=> {
+
+ descriptionMD = (initValue, id) => {
this.contentChanged = false;
const placeholder = "";
@@ -285,7 +301,7 @@ export default class TPMsettings extends Component {
const imageUrl = `/api/attachments.json`;
// 创建editorMd
- const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
+ const description_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue, () => {
setTimeout(() => {
description_editormd.resize()
description_editormd.cm && description_editormd.cm.refresh()
@@ -304,7 +320,7 @@ export default class TPMsettings extends Component {
window.description_editormd = description_editormd;
}
- evaluate_scriptMD=(initValue, id)=> {
+ evaluate_scriptMD = (initValue, id) => {
this.contentChanged = false;
const placeholder = "";
// amp;
@@ -312,7 +328,7 @@ export default class TPMsettings extends Component {
const imageUrl = `/api/attachments.json`;
// 创建editorMd
- const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
+ const evaluate_script_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue, () => {
setTimeout(() => {
evaluate_script_editormd.resize()
evaluate_script_editormd.cm && evaluate_script_editormd.cm.refresh()
@@ -333,16 +349,15 @@ export default class TPMsettings extends Component {
}
-
componentDidMount() {
- let id=this.props.match.params.shixunId;
+ let id = this.props.match.params.shixunId;
- let Url=`/shixuns/`+id+`/settings.json`;
+ let Url = `/shixuns/` + id + `/settings.json`;
- axios.get(Url).then((response)=> {
+ axios.get(Url).then((response) => {
// alert(response.data.shixun.choice_standard_scripts)
- if(response.status===200){
+ if (response.status === 200) {
this.setState({
shixunsID: id,
settingsData: response.data,
@@ -355,10 +370,10 @@ export default class TPMsettings extends Component {
task_pass: response.data.shixun.task_pass,
test_set_permission: response.data.shixun.test_set_permission,
hide_code: response.data.shixun.hide_code,
- code_edit_permission: response.data.shixun.code_edit_permission,
+ code_edit_permission: response.data.shixun.code_edit_permission,
code_hidden: response.data.shixun.code_hidden,
is_secret_repository: response.data.shixun.is_secret_repository,
- init_is_secret_repository: response.data.shixun.is_secret_repository,
+ init_is_secret_repository: response.data.shixun.is_secret_repository,
forbid_copy: response.data.shixun.forbid_copy,
vnc: response.data.shixun.vnc,
vnc_evaluate: response.data.shixun.vnc_evaluate,
@@ -369,15 +384,15 @@ export default class TPMsettings extends Component {
choice_main_type: response.data.shixun.choice_main_type,
choice_small_type: response.data.shixun.choice_small_type,
choice_standard_scripts: response.data.shixun.choice_standard_scripts,
- standard_scripts:response.data.shixun.standard_scripts,
- multi_webssh:response.data.shixun.multi_webssh,
- status:response.data.shixun.status,
- opening_time:response.data.shixun.opening_time,
- newuse_scope:response.data.shixun.use_scope,
+ standard_scripts: response.data.shixun.standard_scripts,
+ multi_webssh: response.data.shixun.multi_webssh,
+ status: response.data.shixun.status,
+ opening_time: response.data.shixun.opening_time,
+ newuse_scope: response.data.shixun.use_scope,
scope_partments: response.data.shixun.scope_partment.length,
- shixunmemoMDvalue:response.data.shixun.evaluate_script,
- shixun_service_configs:response.data.shixun.shixun_service_configs,
- shixun_service_configlist:response.data.shixun.shixun_service_configs,
+ shixunmemoMDvalue: response.data.shixun.evaluate_script,
+ shixun_service_configs: response.data.shixun.shixun_service_configs,
+ shixun_service_configlist: response.data.shixun.shixun_service_configs,
})
// if(response.data.status===403){
@@ -389,13 +404,13 @@ export default class TPMsettings extends Component {
// }
- if(response.data.shixun.multi_webssh===true){
+ if (response.data.shixun.multi_webssh === true) {
this.setState({
- SelectTheCommandtype:true
+ SelectTheCommandtype: true
})
- }else{
+ } else {
this.setState({
- SelectTheCommandtype:false
+ SelectTheCommandtype: false
})
}
if (response.data.shixun.scope_partment.length > 0) {
@@ -429,53 +444,52 @@ export default class TPMsettings extends Component {
let departmentsUrl = `/shixuns/departments.json`;
axios.get(departmentsUrl).then((response) => {
if (response.status === 200) {
- if (response.data.message === undefined) {
- this.setState({
- departmentslist: response.data.shools_name
- });
- }
- }
+ if (response.data.message === undefined) {
+ this.setState({
+ departmentslist: response.data.shools_name
+ });
+ }
+ }
}).catch((error) => {
console.log(error)
});
-
}
- SelectshixunCommand=(e)=>{
+ SelectshixunCommand = (e) => {
// console.log( e.target.value)
- const webssh = e.target.value
- if (webssh == 2) {
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: true,
- multi_webssh:false
- });
- } else {
- if (this.state.init_is_secret_repository && !this.state.vnc && this.state.is_secret_repository == true) {
- this.confirmDeleteSecretRepo({
- onOk: () => {
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: false,
- multi_webssh:false
- });
- }
- })
- } else {
- if (!this.state.vnc) {
- this.setState({
- is_secret_repository: false,
- })
- }
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: false,
- multi_webssh:false
- });
- }
- }
+ const webssh = e.target.value
+ if (webssh == 2) {
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: true,
+ multi_webssh: false
+ });
+ } else {
+ if (this.state.init_is_secret_repository && !this.state.vnc && this.state.is_secret_repository == true) {
+ this.confirmDeleteSecretRepo({
+ onOk: () => {
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: false,
+ multi_webssh: false
+ });
+ }
+ })
+ } else {
+ if (!this.state.vnc) {
+ this.setState({
+ is_secret_repository: false,
+ })
+ }
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: false,
+ multi_webssh: false
+ });
+ }
+ }
// this.setState({
// webssh: webssh,
@@ -493,13 +507,13 @@ export default class TPMsettings extends Component {
// }
}
- SelectOpenpublic=(e)=>{
+ SelectOpenpublic = (e) => {
this.setState({
Openpublic: e.target.value
});
}
- can_copy=(e)=>{
+ can_copy = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -512,7 +526,7 @@ export default class TPMsettings extends Component {
}
- task_pass=(e)=>{
+ task_pass = (e) => {
let sum = ""
if (e.target.checked === false) {
@@ -525,7 +539,7 @@ export default class TPMsettings extends Component {
});
}
- test_set_permission=(e)=>{
+ test_set_permission = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -538,7 +552,7 @@ export default class TPMsettings extends Component {
}
- hide_code=(e)=>{
+ hide_code = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -551,11 +565,11 @@ export default class TPMsettings extends Component {
}
code_edit_permission = (e) => {
- this.setState({
- code_edit_permission: e.target.checked
- })
+ this.setState({
+ code_edit_permission: e.target.checked
+ })
}
- code_hidden=(e)=>{
+ code_hidden = (e) => {
let sum = ""
if (e.target.checked === false) {
sum = 0
@@ -568,33 +582,32 @@ export default class TPMsettings extends Component {
}
confirmDeleteSecretRepo = ({title, onOk}) => {
- confirm({
- title: title ||
-
已创建的私密版本库及其内容,将在“保存”时被删除。
-
是否确认取消勾选?
-
,
- okText: '确定',
- cancelText: '取消',
- onOk: () => {
- this.setState({ is_secret_repository: false })
- onOk && onOk()
- },
- onCancel() {
- },
- });
+ confirm({
+ title: title ||
+
已创建的私密版本库及其内容,将在“保存”时被删除。
+
是否确认取消勾选?
+
,
+ okText: '确定',
+ cancelText: '取消',
+ onOk: () => {
+ this.setState({is_secret_repository: false})
+ onOk && onOk()
+ },
+ onCancel() {
+ },
+ });
}
is_secret_repository = (e) => {
- const checked = e.target.checked
- if (!checked) {
- if (this.state.init_is_secret_repository) {
- this.confirmDeleteSecretRepo({
- })
- } else {
- this.setState({ is_secret_repository: false })
- }
- } else {
- this.setState({ is_secret_repository: true })
- }
+ const checked = e.target.checked
+ if (!checked) {
+ if (this.state.init_is_secret_repository) {
+ this.confirmDeleteSecretRepo({})
+ } else {
+ this.setState({is_secret_repository: false})
+ }
+ } else {
+ this.setState({is_secret_repository: true})
+ }
}
forbid_copy = (e) => {
let sum = ""
@@ -607,48 +620,48 @@ export default class TPMsettings extends Component {
forbid_copy: sum,
});
}
- shixun_vnc_evaluate=(e) => {
- this.setState({
+ shixun_vnc_evaluate = (e) => {
+ this.setState({
vnc_evaluate: e.target.checked,
});
-
+
}
- shixun_vnc=(e)=>{
+ shixun_vnc = (e) => {
// let sum = ""
// if (e.target.checked === false) {
// sum = 0
// } else if (e.target.checked === true) {
// sum = 1
// }
- const vnc = e.target.checked;
- if (!vnc) {
- if (this.state.init_is_secret_repository && this.state.webssh != 2 && this.state.is_secret_repository == true) {
- this.confirmDeleteSecretRepo({
- onOk: () => {
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- })
- } else {
- if (this.state.webssh != 2) {
- this.setState({
- is_secret_repository: false
- })
- }
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- } else {
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
+ const vnc = e.target.checked;
+ if (!vnc) {
+ if (this.state.init_is_secret_repository && this.state.webssh != 2 && this.state.is_secret_repository == true) {
+ this.confirmDeleteSecretRepo({
+ onOk: () => {
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ })
+ } else {
+ if (this.state.webssh != 2) {
+ this.setState({
+ is_secret_repository: false
+ })
+ }
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ } else {
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
}
shixunsname = (e) => {
// let {shixunsstatus}=this.state;
@@ -657,58 +670,58 @@ export default class TPMsettings extends Component {
// }
this.setState({
name: e.target.value,
- shixunnametype:false
+ shixunnametype: false
})
}
bigClass = (value) => {
- // choice_main_type
- // choice_small_type
- let {settingsData,shixun_service_configs,choice_main_type,choice_small_type}=this.state;
-
- let list=[]
- list.push(choice_main_type)
- choice_small_type.map((item,key)=>{
- list.push(item)
- })
-
- let newshixun_service_configs=shixun_service_configs;
-
- let newshixun_service_configsagin=[]
-
- newshixun_service_configs.map((item,key)=>{
- list.map((its,index)=>{
- if(item.mirror_repository_id===its){
- newshixun_service_configsagin.push(item)
- }
- })
- })
-
-
- settingsData.shixun.main_type.some((item,key)=> {
- if (item.id === value) {
- newshixun_service_configsagin[0]={
- mirror_repository_id:value,
- name:item.type_name,
- cpu_limit:1,
- lower_cpu_limit:0.1,
- memory_limit:1024,
- request_limit:10
- }
- return true
- }
- }
- )
- let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
+ // choice_main_type
+ // choice_small_type
+ let {settingsData, shixun_service_configs, choice_main_type, choice_small_type} = this.state;
+
+ let list = []
+ list.push(choice_main_type)
+ choice_small_type.map((item, key) => {
+ list.push(item)
+ })
+
+ let newshixun_service_configs = shixun_service_configs;
+
+ let newshixun_service_configsagin = []
+
+ newshixun_service_configs.map((item, key) => {
+ list.map((its, index) => {
+ if (item.mirror_repository_id === its) {
+ newshixun_service_configsagin.push(item)
+ }
+ })
+ })
+
+
+ settingsData.shixun.main_type.some((item, key) => {
+ if (item.id === value) {
+ newshixun_service_configsagin[0] = {
+ mirror_repository_id: value,
+ name: item.type_name,
+ cpu_limit: 1,
+ lower_cpu_limit: 0.1,
+ memory_limit: 1024,
+ request_limit: 10
+ }
+ return true
+ }
+ }
+ )
+ let url = `/shixuns/get_mirror_script.json?mirror_id=` + value;
axios.get(url).then((response) => {
if (response.status === 200) {
// console.log(response.data)
this.setState({
choice_main_type: value,
- standard_scripts:response.data,
- choice_standard_scripts:null,
- shixun_service_configs:newshixun_service_configsagin,
- shixun_service_configlist:newshixun_service_configsagin,
+ standard_scripts: response.data,
+ choice_standard_scripts: null,
+ shixun_service_configs: newshixun_service_configsagin,
+ shixun_service_configlist: newshixun_service_configsagin,
})
}
}).catch((error) => {
@@ -716,98 +729,97 @@ export default class TPMsettings extends Component {
});
-
}
- Deselectlittle=(value)=>{
+ Deselectlittle = (value) => {
- let {shixun_service_configs,choice_small_type}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- let newchoice_small_type=choice_small_type;
+ let {shixun_service_configs, choice_small_type} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ let newchoice_small_type = choice_small_type;
- newshixun_service_configs.some((item,key)=> {
- if (item.mirror_repository_id === value) {
- newshixun_service_configs.splice(key, 1)
- return true
- }
- }
- )
+ newshixun_service_configs.some((item, key) => {
+ if (item.mirror_repository_id === value) {
+ newshixun_service_configs.splice(key, 1)
+ return true
+ }
+ }
+ )
- newchoice_small_type.some((item,key)=> {
- if (item === value) {
- newchoice_small_type.splice(key, 1)
- return true
- }
- }
- )
+ newchoice_small_type.some((item, key) => {
+ if (item === value) {
+ newchoice_small_type.splice(key, 1)
+ return true
+ }
+ }
+ )
- this.setState({
- choice_small_type: newchoice_small_type,
- shixun_service_configs:newshixun_service_configs,
- shixun_service_configlist:newshixun_service_configs,
- })
- }
+ this.setState({
+ choice_small_type: newchoice_small_type,
+ shixun_service_configs: newshixun_service_configs,
+ shixun_service_configlist: newshixun_service_configs,
+ })
+ }
littleClass = (value) => {
- let {settingsData,shixun_service_configs,choice_small_type,choice_main_type}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- let newchoice_small_type=choice_small_type;
- // if(Array.isArray(value)===true){
- // value.map((item,key)=>{
- // settingsData.shixun.small_type.some((items,keys)=> {
- // if (items.id === item) {
- // newshixun_service_configs.push({
- // mirror_repository_id:value,
- // name:items.type_name,
- // cpu_limit:1,
- // lower_cpu_limit:0.1,
- // memory_limit:1024,
- // request_limit:10
- // })
- // return true
- // }
- // }
- // )
- // })
- // }
-
- let list=[]
- list.push(choice_main_type)
- choice_small_type.map((item,key)=>{
- list.push(item)
- })
-
- let newshixun_service_configsagin=[]
-
- newshixun_service_configs.map((item,key)=>{
- list.map((its,index)=>{
- if(item.mirror_repository_id===its){
- newshixun_service_configsagin.push(item)
- }
- })
- })
-
- settingsData.shixun.small_type.some((items,keys)=> {
- if (items.id === value) {
- newshixun_service_configsagin.push({
- mirror_repository_id:value,
- name:items.type_name,
- cpu_limit:1,
- lower_cpu_limit:0.1,
- memory_limit:1024,
- request_limit:10
- })
- return true
- }
- }
- )
-
- newchoice_small_type.push(value)
+ let {settingsData, shixun_service_configs, choice_small_type, choice_main_type} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ let newchoice_small_type = choice_small_type;
+ // if(Array.isArray(value)===true){
+ // value.map((item,key)=>{
+ // settingsData.shixun.small_type.some((items,keys)=> {
+ // if (items.id === item) {
+ // newshixun_service_configs.push({
+ // mirror_repository_id:value,
+ // name:items.type_name,
+ // cpu_limit:1,
+ // lower_cpu_limit:0.1,
+ // memory_limit:1024,
+ // request_limit:10
+ // })
+ // return true
+ // }
+ // }
+ // )
+ // })
+ // }
+
+ let list = []
+ list.push(choice_main_type)
+ choice_small_type.map((item, key) => {
+ list.push(item)
+ })
+
+ let newshixun_service_configsagin = []
+
+ newshixun_service_configs.map((item, key) => {
+ list.map((its, index) => {
+ if (item.mirror_repository_id === its) {
+ newshixun_service_configsagin.push(item)
+ }
+ })
+ })
+
+ settingsData.shixun.small_type.some((items, keys) => {
+ if (items.id === value) {
+ newshixun_service_configsagin.push({
+ mirror_repository_id: value,
+ name: items.type_name,
+ cpu_limit: 1,
+ lower_cpu_limit: 0.1,
+ memory_limit: 1024,
+ request_limit: 10
+ })
+ return true
+ }
+ }
+ )
+
+ newchoice_small_type.push(value)
this.setState({
choice_small_type: newchoice_small_type,
- shixun_service_configs:newshixun_service_configsagin,
- shixun_service_configlist:newshixun_service_configsagin,
+ shixun_service_configs: newshixun_service_configsagin,
+ shixun_service_configlist: newshixun_service_configsagin,
})
}
onPodExistTimeChange = (e) => {
@@ -845,8 +857,8 @@ export default class TPMsettings extends Component {
shixunScopeInput = (e) => {
let {scope_partment} = this.state;
let datalist = scope_partment;
- if (datalist===undefined) {
- datalist=[]
+ if (datalist === undefined) {
+ datalist = []
}
datalist.push(e)
@@ -867,42 +879,41 @@ export default class TPMsettings extends Component {
// });
// }
submit_edit_shixun = () => {
- if (this.saving == true) return;
+ if (this.saving == true) return;
this.saving = true;
- if(this.state.status===-1){
- this.props.showSnackbar("该实训已被删除,保存失败!");
- return
- }
+ if (this.state.status === -1) {
+ this.props.showSnackbar("该实训已被删除,保存失败!");
+ return
+ }
let {
name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate,
- evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
- opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository, code_edit_permission
+ evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc, multi_webssh,
+ opening_time, shixunmemoMDvalue, shixun_service_configlist, is_secret_repository, code_edit_permission
} = this.state;
- let newshixun_service_configlist = shixun_service_configlist.map(v => {
- let v1 = Object.assign({},v);
- delete v1.name;
- return v1
- });
+ let newshixun_service_configlist = shixun_service_configlist.map(v => {
+ let v1 = Object.assign({}, v);
+ delete v1.name;
+ return v1
+ });
// let operateauthority=
- // this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
- // this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
+ // this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+ // this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
const description_editormd = this.description_editormd.getValue();
let evaluate_script_editormd;
- if(this.state.status==0||this.state.status==1||this.state.status==2&&this.props.identity===1){
+ if (this.state.status == 0 || this.state.status == 1 || this.state.status == 2 && this.props.identity === 1) {
// evaluate_script_editormd = this.evaluate_script_editormd.getValue();
evaluate_script_editormd = shixunmemoMDvalue
- }else{
+ } else {
evaluate_script_editormd = evaluate_script;
}
-
if (name === "") {
this.setState({
shixunnametype: true
@@ -930,9 +941,9 @@ export default class TPMsettings extends Component {
}, 1000);
return
}
- if(use_scope===1){
+ if (use_scope === 1) {
- if(scope_partment===undefined||scope_partment.length===0){
+ if (scope_partment === undefined || scope_partment.length === 0) {
this.setState({
scope_partmenttype: true
})
@@ -970,50 +981,50 @@ export default class TPMsettings extends Component {
let id = this.props.match.params.shixunId;
- let newmulti_webssh=multi_webssh;
+ let newmulti_webssh = multi_webssh;
- if(newmulti_webssh===null){
- newmulti_webssh=false
+ if (newmulti_webssh === null) {
+ newmulti_webssh = false
}
- //exec_time: exec_time,
+ //exec_time: exec_time,
let Url = `/shixuns/` + id + `.json`;
let data = {
- shixun:{
-
- name: name,
- webssh: webssh,
- use_scope: use_scope,
- can_copy: can_copy,
- vnc: vnc===null?undefined:vnc,
- vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate,
- test_set_permission: test_set_permission,
- code_hidden: code_hidden,
- code_edit_permission: code_edit_permission,
- trainee: trainee,
- task_pass: task_pass,
- hide_code: hide_code,
- forbid_copy: forbid_copy,
- multi_webssh:newmulti_webssh,
- opening_time:opening_time,
- mirror_script_id:choice_standard_scriptssum===undefined?choice_standard_scripts:choice_standard_scriptssum,
- },
- shixun_info:{
- description: description_editormd,
- evaluate_script: evaluate_script_editormd,
- },
- is_secret_repository: is_secret_repository,
- main_type: choice_main_type,
- small_type: choice_small_type,
- scope_partment: scope_partment,
- shixun_service_configs:newshixun_service_configlist
+ shixun: {
+
+ name: name,
+ webssh: webssh,
+ use_scope: use_scope,
+ can_copy: can_copy,
+ vnc: vnc === null ? undefined : vnc,
+ vnc_evaluate: vnc_evaluate === null ? undefined : vnc_evaluate,
+ test_set_permission: test_set_permission,
+ code_hidden: code_hidden,
+ code_edit_permission: code_edit_permission,
+ trainee: trainee,
+ task_pass: task_pass,
+ hide_code: hide_code,
+ forbid_copy: forbid_copy,
+ multi_webssh: newmulti_webssh,
+ opening_time: opening_time,
+ mirror_script_id: choice_standard_scriptssum === undefined ? choice_standard_scripts : choice_standard_scriptssum,
+ },
+ shixun_info: {
+ description: description_editormd,
+ evaluate_script: evaluate_script_editormd,
+ },
+ is_secret_repository: is_secret_repository,
+ main_type: choice_main_type,
+ small_type: choice_small_type,
+ scope_partment: scope_partment,
+ shixun_service_configs: newshixun_service_configlist
}
axios.put(Url, data).then((response) => {
// console.log(response)
- this.saving = false;
- if(response.status){
+ this.saving = false;
+ if (response.status) {
if (response.data.status === -1) {
this.props.showSnackbar(response.data.message);
return
@@ -1024,7 +1035,7 @@ export default class TPMsettings extends Component {
}).catch((error) => {
console.log(error)
- this.saving = false;
+ this.saving = false;
})
@@ -1052,13 +1063,11 @@ export default class TPMsettings extends Component {
}
-
-
shixunsclose = () => {
let id = this.props.match.params.shixunId;
let cul = `/shixuns/` + id + `/close.json`;
axios.post(cul).then((response) => {
- if(response.data.status===1){
+ if (response.data.status === 1) {
this.props.showSnackbar("操作成功");
this.setState({
operateshixunstype: false,
@@ -1071,12 +1080,12 @@ export default class TPMsettings extends Component {
})
}
- shixunsdel= () => {
+ shixunsdel = () => {
let id = this.props.match.params.shixunId;
- let cul = `/shixuns/` + id +`.json`;
+ let cul = `/shixuns/` + id + `.json`;
axios.delete(cul).then((response) => {
- if(response.data.status===1){
+ if (response.data.status === 1) {
this.props.showSnackbar("操作成功");
this.setState({
operateshixunstype: false,
@@ -1125,7 +1134,7 @@ export default class TPMsettings extends Component {
axios.get(trl).then((response) => {
// this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD");
this.setState({
- shixunmemoMDvalue:response.data.shixun_script
+ shixunmemoMDvalue: response.data.shixun_script
})
}).catch((error) => {
console.log(error)
@@ -1158,168 +1167,168 @@ export default class TPMsettings extends Component {
})
}
- setlanguagewrite = (e)=>{
- this.setState({
- languagewrite: e.target.value
- })
- }
-
- setsystemenvironment = (e) => {
- this.setState({
- systemenvironment: e.target.value
- })
- }
-
- settestcoderunmode = (e) => {
- this.setState({
- testcoderunmode: e.target.value
- })
-
- }
-
- sendsure_apply = () => {
- let {languagewrite,systemenvironment,testcoderunmode} = this.state;
- // console.log("点击确定")
- // console.log("languagewrite"+languagewrite);
- // console.log("systemenvironment"+systemenvironment);
- // console.log("testcoderunmode"+testcoderunmode);
-
- // let attachment_ids = undefined
- // if (this.state.fileList) {
- // attachment_ids = this.state.fileList.map(item => {
- // return item.response ? item.response.id : item.id
- // })
- // }
- if(languagewrite === undefined || languagewrite === "" ){
- // this.props.showNotification(`请填写该镜像是基于什么语言`);
- this.setState({
- languagewritetype:true
- })
- return
- }
- if(systemenvironment === undefined || systemenvironment === ""){
- // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
- this.setState({
- systemenvironmenttype:true
- })
- return;
-
- }
- if(testcoderunmode === undefined || testcoderunmode === "") {
- // this.props.showNotification(`请填写该镜像中测试代码运行方式`);
- this.setState({
- testcoderunmodetype:true
- })
- return;
- }
- var attachment_ids=undefined;
- if (this.state.fileList) {
- attachment_ids = this.state.fileList.map(item => {
- return item.response ? item.response.id : item.id
- })
- }
-
- if( attachment_ids === undefined || attachment_ids.length===0){
-
- // notification.open(
- // {
- // message: '提示',
- // description:
- // '请上传附件!',
- //
- // }
- // )
- this.setState({
- attachmentidstype:true
- })
- return;
- }
- // console.log("attachment_ids"+attachment_ids);
-
- // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids);
-
- var data={
- language:languagewrite,
- runtime:systemenvironment,
- run_method:testcoderunmode,
- attachment_id:attachment_ids[0],
- }
- var url =`/shixuns/apply_shixun_mirror.json`;
- axios.post(url,data
- ).then((response) => {
-
- try {
- if (response.data) {
- // const { id } = response.data;
- // if (id) {
- if(this.state.file !== undefined){
- console.log("549");
- // this.deleteAttachment(this.state.file);
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }else {
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }
- // this.props.showNotification('提交成功!');
- notification.open(
- {
- message: '提示',
- description:
- '提交成功!',
-
- }
- )
- this.sendhideModaly()
- // this.props.history.push(`/courses/${cid}/graduation_topics`);
- // }
- }
- }catch (e) {
-
- }
-
- })
-
- }
-
- sendhideModaly = () => {
- this.setState({
- postapplyvisible: false,
- })
- if(this.state.file !== undefined){
- console.log("580");
- // this.deleteAttachment(this.state.file);
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }else {
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }
- }
+ setlanguagewrite = (e) => {
+ this.setState({
+ languagewrite: e.target.value
+ })
+ }
+
+ setsystemenvironment = (e) => {
+ this.setState({
+ systemenvironment: e.target.value
+ })
+ }
+
+ settestcoderunmode = (e) => {
+ this.setState({
+ testcoderunmode: e.target.value
+ })
+
+ }
+
+ sendsure_apply = () => {
+ let {languagewrite, systemenvironment, testcoderunmode} = this.state;
+ // console.log("点击确定")
+ // console.log("languagewrite"+languagewrite);
+ // console.log("systemenvironment"+systemenvironment);
+ // console.log("testcoderunmode"+testcoderunmode);
+
+ // let attachment_ids = undefined
+ // if (this.state.fileList) {
+ // attachment_ids = this.state.fileList.map(item => {
+ // return item.response ? item.response.id : item.id
+ // })
+ // }
+ if (languagewrite === undefined || languagewrite === "") {
+ // this.props.showNotification(`请填写该镜像是基于什么语言`);
+ this.setState({
+ languagewritetype: true
+ })
+ return
+ }
+ if (systemenvironment === undefined || systemenvironment === "") {
+ // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
+ this.setState({
+ systemenvironmenttype: true
+ })
+ return;
+
+ }
+ if (testcoderunmode === undefined || testcoderunmode === "") {
+ // this.props.showNotification(`请填写该镜像中测试代码运行方式`);
+ this.setState({
+ testcoderunmodetype: true
+ })
+ return;
+ }
+ var attachment_ids = undefined;
+ if (this.state.fileList) {
+ attachment_ids = this.state.fileList.map(item => {
+ return item.response ? item.response.id : item.id
+ })
+ }
+
+ if (attachment_ids === undefined || attachment_ids.length === 0) {
+
+ // notification.open(
+ // {
+ // message: '提示',
+ // description:
+ // '请上传附件!',
+ //
+ // }
+ // )
+ this.setState({
+ attachmentidstype: true
+ })
+ return;
+ }
+ // console.log("attachment_ids"+attachment_ids);
+
+ // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids);
+
+ var data = {
+ language: languagewrite,
+ runtime: systemenvironment,
+ run_method: testcoderunmode,
+ attachment_id: attachment_ids[0],
+ }
+ var url = `/shixuns/apply_shixun_mirror.json`;
+ axios.post(url, data
+ ).then((response) => {
+
+ try {
+ if (response.data) {
+ // const { id } = response.data;
+ // if (id) {
+ if (this.state.file !== undefined) {
+ console.log("549");
+ // this.deleteAttachment(this.state.file);
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ } else {
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ }
+ // this.props.showNotification('提交成功!');
+ notification.open(
+ {
+ message: '提示',
+ description:
+ '提交成功!',
+
+ }
+ )
+ this.sendhideModaly()
+ // this.props.history.push(`/courses/${cid}/graduation_topics`);
+ // }
+ }
+ } catch (e) {
+
+ }
+
+ })
+
+ }
+
+ sendhideModaly = () => {
+ this.setState({
+ postapplyvisible: false,
+ })
+ if (this.state.file !== undefined) {
+ console.log("580");
+ // this.deleteAttachment(this.state.file);
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ } else {
+ this.setState({
+ file: undefined,
+ deleteisnot: true,
+ languagewrite: "",
+ systemenvironment: "",
+ testcoderunmode: "",
+ fileList: []
+ })
+ }
+ }
yeshidemodel = () => {
this.setState({
@@ -1330,30 +1339,30 @@ export default class TPMsettings extends Component {
SelectScput = (value, e) => {
this.setState({
choice_standard_scriptssum: value,
- language:e.props.name,
- choice_standard_scripts: {id:e.props.value,value:""},
- standard_scriptsModal:true
+ language: e.props.name,
+ choice_standard_scripts: {id: e.props.value, value: ""},
+ standard_scriptsModal: true
})
}
- hidestandard_scriptsModal=()=>{
+ hidestandard_scriptsModal = () => {
this.setState({
- standard_scriptsModal:false,
- standard_scriptsModals:false
+ standard_scriptsModal: false,
+ standard_scriptsModals: false
})
}
- get_mirror_script=()=>{
- let {choice_standard_scriptssum}=this.state;
+ get_mirror_script = () => {
+ let {choice_standard_scriptssum} = this.state;
let id = this.props.match.params.shixunId;
let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum;
axios.get(pul).then((response) => {
- if(response.status===200){
+ if (response.status === 200) {
// this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
this.setState({
- standard_scriptsModal:false,
- standard_scriptsModals:true,
- shixunmemoMDvalue:response.data.content
+ standard_scriptsModal: false,
+ standard_scriptsModals: true,
+ shixunmemoMDvalue: response.data.content
})
}
@@ -1363,192 +1372,192 @@ export default class TPMsettings extends Component {
}
- SelectTheCommandonChange=(e)=>{
+ SelectTheCommandonChange = (e) => {
this.setState({
- multi_webssh:e.target.checked
+ multi_webssh: e.target.checked
})
}
- bigopen=()=>{
+ bigopen = () => {
this.setState({
- opers:true
+ opers: true
})
}
- bigopens=()=>{
+ bigopens = () => {
this.setState({
- opers:false,
- operss:false,
- opersss:false,
- opensmail:false
+ opers: false,
+ operss: false,
+ opersss: false,
+ opensmail: false
})
}
- bigopensmal=(e)=>{
+ bigopensmal = (e) => {
this.setState({
- opensmail:true
+ opensmail: true
})
}
- sbigopen=(e)=>{
+ sbigopen = (e) => {
this.setState({
- operss:true
+ operss: true
})
}
- sbigopens=()=>{
+ sbigopens = () => {
this.setState({
- operss:false
+ operss: false
})
}
- sbigopenss=(e)=>{
+ sbigopenss = (e) => {
this.setState({
- opersss:true
+ opersss: true
})
}
- sbigopensss=()=>{
+ sbigopensss = () => {
this.setState({
- opersss:false
+ opersss: false
})
}
- testscripttip=(val)=>{
- if(val===0){
+ testscripttip = (val) => {
+ if (val === 0) {
this.setState({
- testscripttiptype:true
+ testscripttiptype: true
})
- }else if(val===1){
+ } else if (val === 1) {
this.setState({
- testscripttiptype:false
+ testscripttiptype: false
})
}
}
- operateshixuns=(value)=>{
+ operateshixuns = (value) => {
this.setState({
- operateshixunstype:true,
- delType:value
+ operateshixunstype: true,
+ delType: value
})
}
- hideoperateshixuns=()=>{
+ hideoperateshixuns = () => {
this.setState({
- operateshixunstype:false
+ operateshixunstype: false
})
}
- onChangeTimePicker =(value, dateString)=> {
+ onChangeTimePicker = (value, dateString) => {
+ this.setState({
+ opening_time: dateString === "" ? "" : moment(handleDateStrings(dateString))
+ })
+ }
+
+ getshixunmemoMDvalue = (value, e) => {
+
this.setState({
- opening_time: dateString=== ""?"":moment(handleDateStrings(dateString))
+ shixunmemoMDvalue: value
})
}
- getshixunmemoMDvalue=(value, e)=>{
+ setConfigsInputs = (e, keys, str) => {
+
+ let {shixun_service_configs} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ newshixun_service_configs.map((item, key) => {
+ if (key === keys) {
+ switch (str) {
+ case 1:
+ item.cpu_limit = e.target.value
+ break;
+ case 2:
+ item.lower_cpu_limit = e.target.value
+ break;
+ case 3:
+ item.memory_limit = e.target.value
+ break;
+ case 4:
+ item.request_limit = e.target.value
+ break;
+ }
+ }
+ })
this.setState({
- shixunmemoMDvalue:value
+ shixun_service_configs: newshixun_service_configs,
+ shixun_service_configlist: newshixun_service_configs,
})
+
+ }
+
+ handleChange = (info) => {
+ let {fileList} = this.state;
+
+ if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
+ console.log("handleChange1");
+
+ // if(fileList.length===0){
+ let fileLists = info.fileList;
+ this.setState({
+ fileList: fileLists,
+ deleteisnot: false
+ });
+ // }
+ }
}
- setConfigsInputs=(e,keys,str)=>{
-
- let {shixun_service_configs}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- newshixun_service_configs.map((item,key)=>{
- if(key===keys){
- switch (str) {
- case 1:
- item.cpu_limit=e.target.value
- break;
- case 2:
- item.lower_cpu_limit=e.target.value
- break;
- case 3:
- item.memory_limit=e.target.value
- break;
- case 4:
- item.request_limit=e.target.value
- break;
- }
- }
- })
-
- this.setState({
- shixun_service_configs:newshixun_service_configs,
- shixun_service_configlist:newshixun_service_configs,
- })
-
- }
-
- handleChange = (info) => {
- let {fileList}=this.state;
-
- if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
- console.log("handleChange1");
-
- // if(fileList.length===0){
- let fileLists = info.fileList;
- this.setState({ fileList:fileLists,
- deleteisnot:false});
- // }
- }
- }
-
- onAttachmentRemove = (file) => {
- if(!file.percent || file.percent == 100){
- confirm({
- title: '确定要删除这个附件吗?',
- okText: '确定',
- cancelText: '取消',
- // content: 'Some descriptions',
- onOk: () => {
- console.log("665")
- this.deleteAttachment(file)
- },
- onCancel() {
- console.log('Cancel');
- },
- });
- return false;
- }
-
- }
-
- deleteAttachment = (file) => {
- console.log(file);
- let id=file.response ==undefined ? file.id : file.response.id
- const url = `/attachments/${id}.json`
- axios.delete(url, {
- })
- .then((response) => {
- if (response.data) {
- const { status } = response.data;
- if (status == 0) {
- // console.log('--- success')
-
- this.setState((state) => {
-
- const index = state.fileList.indexOf(file);
- const newFileList = state.fileList.slice();
- newFileList.splice(index, 1);
- return {
- fileList: newFileList,
- deleteisnot:true
- };
- });
- }
- }
- })
- .catch(function (error) {
- console.log(error);
- });
- }
-
-
-
- render() {
+ onAttachmentRemove = (file) => {
+ if (!file.percent || file.percent == 100) {
+ confirm({
+ title: '确定要删除这个附件吗?',
+ okText: '确定',
+ cancelText: '取消',
+ // content: 'Some descriptions',
+ onOk: () => {
+ console.log("665")
+ this.deleteAttachment(file)
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ return false;
+ }
+
+ }
+
+ deleteAttachment = (file) => {
+ console.log(file);
+ let id = file.response == undefined ? file.id : file.response.id
+ const url = `/attachments/${id}.json`
+ axios.delete(url, {})
+ .then((response) => {
+ if (response.data) {
+ const {status} = response.data;
+ if (status == 0) {
+ // console.log('--- success')
+
+ this.setState((state) => {
+
+ const index = state.fileList.indexOf(file);
+ const newFileList = state.fileList.slice();
+ newFileList.splice(index, 1);
+ return {
+ fileList: newFileList,
+ deleteisnot: true
+ };
+ });
+ }
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+
+ render() {
let {
postapplyvisible,
postapplytitle,
@@ -1560,7 +1569,7 @@ export default class TPMsettings extends Component {
name,
settingsData,
webssh,
- is_secret_repository,
+ is_secret_repository,
use_scope,
shixunsID,
can_copy,
@@ -1572,10 +1581,10 @@ export default class TPMsettings extends Component {
test_set_permission,
hide_code,
forbid_copy,
- code_edit_permission,
+ code_edit_permission,
code_hidden,
vnc,
- vnc_evaluate,
+ vnc_evaluate,
scopetype,
scope_partment,
departmentslist,
@@ -1591,9 +1600,9 @@ export default class TPMsettings extends Component {
scope_partmenttype,
newuse_scope,
scope_partments,
- shixunmemoMDvalue,delType,
- shixun_service_configs,
- fileList,
+ shixunmemoMDvalue, delType,
+ shixun_service_configs,
+ fileList,
} = this.state;
let options;
@@ -1605,65 +1614,65 @@ export default class TPMsettings extends Component {
)
})
}
- const uploadProps = {
- width: 600,
- fileList,
- multiple: true,
- // https://github.com/ant-design/ant-design/issues/15505
- // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
- // showUploadList: false,
- action: `${getUploadActionUrl()}`,
- onChange: this.handleChange,
- onRemove: this.onAttachmentRemove,
- beforeUpload: (file, fileList) => {
- if (this.state.fileList.length >= 1) {
- return false
- }
- // console.log('beforeUpload', file.name);
- const isLt150M = file.size / 1024 / 1024 < 50;
- if (!isLt150M) {
- // this.props.showNotification(`文件大小必须小于50MB`);
- notification.open(
- {
- message: '提示',
- description:
- '文件大小必须小于50MB',
-
- }
- )
- }
- if(this.state.file !== undefined){
- console.log("763")
- this.setState({
- file:file
- })
- }else {
- this.setState({
- file:file
- })
- }
-
- console.log("handleChange2");
- return isLt150M;
- },
- }
+ const uploadProps = {
+ width: 600,
+ fileList,
+ multiple: true,
+ // https://github.com/ant-design/ant-design/issues/15505
+ // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
+ // showUploadList: false,
+ action: `${getUploadActionUrl()}`,
+ onChange: this.handleChange,
+ onRemove: this.onAttachmentRemove,
+ beforeUpload: (file, fileList) => {
+ if (this.state.fileList.length >= 1) {
+ return false
+ }
+ // console.log('beforeUpload', file.name);
+ const isLt150M = file.size / 1024 / 1024 < 50;
+ if (!isLt150M) {
+ // this.props.showNotification(`文件大小必须小于50MB`);
+ notification.open(
+ {
+ message: '提示',
+ description:
+ '文件大小必须小于50MB',
+
+ }
+ )
+ }
+ if (this.state.file !== undefined) {
+ console.log("763")
+ this.setState({
+ file: file
+ })
+ } else {
+ this.setState({
+ file: file
+ })
+ }
+
+ console.log("handleChange2");
+ return isLt150M;
+ },
+ }
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
- let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+ let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false;
const operations =
;
return (
-
-
-
- Content of tab 1
-
-
- Content of tab 2
-
-
- Content of tab 3
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
}
From c43e9722dc0e3198649aff6081b1a141963a2fc5 Mon Sep 17 00:00:00 2001
From: guange
Date: Tue, 10 Dec 2019 15:55:01 +0800
Subject: [PATCH 011/157] .
---
app/controllers/jupyters_controller.rb | 43 ++++++++++++++++++++++++++
app/controllers/main_controller.rb | 19 ------------
2 files changed, 43 insertions(+), 19 deletions(-)
create mode 100644 app/controllers/jupyters_controller.rb
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
new file mode 100644
index 000000000..25b7279fd
--- /dev/null
+++ b/app/controllers/jupyters_controller.rb
@@ -0,0 +1,43 @@
+class JupytersController < ApplicationController
+
+ def open
+ #打开tpm - juypter接口
+ shixun = Shixun.find(3575)
+ shixun_tomcat = edu_setting('cloud_bridge')
+ uri = "#{shixun_tomcat}/bridge/jupyter/get"
+ tpiID = "tpm#{shixun.id}"
+ params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
+
+
+ logger.info "test_juypter: uri->#{uri}, params->#{params}"
+
+ res = uri_post uri, params
+
+ logger.info "test_juypter: #{res}"
+
+ render plain: "https://#{res['port']}.jupyter.educoder.net/data/workspace/myshixun_#{tpiID}/01.ipynb"
+ end
+
+ def open1
+ ## 打开tpi
+ game = Game.find(0)
+ shixun = game.myshixun.shixun
+ shixun_tomcat = edu_setting('cloud_bridge')
+ uri = "#{shixun_tomcat}/bridge/jupyter/get"
+ params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
+ res = uri_post uri, params
+
+ logger.info "test_juypter: #{res}"
+
+ if res && res['code'].to_i != 0
+ raise("实训云平台繁忙(繁忙等级:99)")
+ end
+ end
+
+
+ def test
+ render plain: 'test'
+ end
+
+
+end
\ No newline at end of file
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
index 1ca65afa3..0e2628c3e 100644
--- a/app/controllers/main_controller.rb
+++ b/app/controllers/main_controller.rb
@@ -2,23 +2,4 @@ class MainController < ApplicationController
def index
render file: 'public/react/build/index.html', :layout => false
end
-
-
-
- def test_juypter
- #打开tpm - juypter接口
- shixun = Shixun.find(3575)
- shixun_tomcat = edu_setting('cloud_bridge')
- uri = "#{shixun_tomcat}/bridge/jupyter/get"
- params = {tpiID: "tpm#{shixun.id}", :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
-
-
- logger.info "test_juypter: uri->#{uri}, params->#{params}"
-
- res = uri_post uri, params
-
- logger.info "test_juypter: #{res}"
-
- render plain: res.to_json
- end
end
\ No newline at end of file
From df9eb560a130f395cd2f729e9f898103bf230e4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 10 Dec 2019 15:56:51 +0800
Subject: [PATCH 012/157] =?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/newshixuns/Newshixuns.js | 26 +++++++------------
.../modules/tpm/newshixuns/css/Newshixuns.css | 4 +++
2 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
index 098d2b78a..7dcb1fa51 100644
--- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js
+++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
@@ -419,9 +419,9 @@ class Newshixuns extends Component {
- {this.state.Radiovalue === "2" ? "" :
@@ -429,7 +429,7 @@ class Newshixuns extends Component {
{getFieldDecorator('selectleft', {
rules: [{required: true, message: '请选择主类别'}],
})(
-
- }
+
- {this.state.Radiovalue === "2" ? "" :
@@ -499,17 +499,9 @@ class Newshixuns extends Component {
- }
+
- {/**/}
- {/* */}
- {/*
*/}
- {/*
取消*/}
- {/*
*/}
- {/**/}
@@ -629,7 +621,7 @@ class Newshixuns extends Component {
diff --git a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
index 5a5fffdf9..5dadbfa6d 100644
--- a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
+++ b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
@@ -819,3 +819,7 @@ a.white-btn.use_scope-btn:hover{
.newshixunmodels{
margin: 0 auto;
}
+
+.backgroundFFF{
+ background: #FFF !important;
+}
\ No newline at end of file
From d5446c54e064b7370e1695db1928927d026910c5 Mon Sep 17 00:00:00 2001
From: guange
Date: Tue, 10 Dec 2019 15:56:56 +0800
Subject: [PATCH 013/157] .
---
config/routes.rb | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/config/routes.rb b/config/routes.rb
index ec16d85fa..680fe674f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,8 +9,14 @@ Rails.application.routes.draw do
get 'auth/qq/callback', to: 'oauth/qq#create'
get 'auth/failure', to: 'oauth/base#auth_failure'
-
- get 'test_juypter', to: 'main#test_juypter'
+ resources :jupyters do
+ collection do
+ get :open
+ get :open1
+ get :test
+ end
+ end
+
resources :edu_settings
scope '/api' do
@@ -38,6 +44,9 @@ Rails.application.routes.draw do
end
end
+
+
+
resources :hacks, path: :problems, param: :identifier do
collection do
get :unpulished_list
From b352ec635e52d76d9ef7c43949467ed4e1c56d21 Mon Sep 17 00:00:00 2001
From: guange
Date: Tue, 10 Dec 2019 16:25:52 +0800
Subject: [PATCH 014/157] .
---
app/controllers/jupyters_controller.rb | 41 ++++++++++++++++++++++++--
config/routes.rb | 1 +
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index 25b7279fd..0200ee639 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -1,8 +1,12 @@
+require 'net/http'
+
class JupytersController < ApplicationController
+ before_action :shixun
+
def open
#打开tpm - juypter接口
- shixun = Shixun.find(3575)
+ shixun = @shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = "tpm#{shixun.id}"
@@ -15,7 +19,7 @@ class JupytersController < ApplicationController
logger.info "test_juypter: #{res}"
- render plain: "https://#{res['port']}.jupyter.educoder.net/data/workspace/myshixun_#{tpiID}/01.ipynb"
+ render plain: "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
def open1
@@ -38,6 +42,39 @@ class JupytersController < ApplicationController
def test
render plain: 'test'
end
+
+ def save()
+ # 保存01.ipy
+
+ author_name = current_user.real_name
+ author_email = current_user.git_mail
+ message = "User submitted"
+
+ src_url = URI("https://47519.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_tpm3575/01.ipynb?download=true")
+ response = Net::HTTP.get_response(src_url)
+
+ if response.code != 200
+ raise("获取文件内容失败:#{response.code}")
+ end
+
+ content = response.body
+
+ c = GitService.update_file(repo_path: @shixun.repo_path,
+ file_path: "01.ipynb",
+ message: message,
+ content: content,
+ author_name: author_name,
+ author_email: author_email)
+
+ render plain: 'save: #{c.size}'
+
+ end
+
+
+ private
+ def shixun
+ @shixun = Shixun.find(3575)
+ end
end
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 680fe674f..e6258430a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -14,6 +14,7 @@ Rails.application.routes.draw do
get :open
get :open1
get :test
+ get :save
end
end
From 989f9e809b55165c37abbb530f0f66eec1d0e62c Mon Sep 17 00:00:00 2001
From: guange
Date: Tue, 10 Dec 2019 16:28:13 +0800
Subject: [PATCH 015/157] .
---
app/controllers/jupyters_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index 0200ee639..2bf8798df 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -53,7 +53,7 @@ class JupytersController < ApplicationController
src_url = URI("https://47519.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_tpm3575/01.ipynb?download=true")
response = Net::HTTP.get_response(src_url)
- if response.code != 200
+ if response.code.to_i != 200
raise("获取文件内容失败:#{response.code}")
end
From 7fec5efededd172b8ecd153bca475d1ca41298b1 Mon Sep 17 00:00:00 2001
From: guange
Date: Tue, 10 Dec 2019 16:35:33 +0800
Subject: [PATCH 016/157] .
---
app/controllers/jupyters_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index 2bf8798df..de7d7296c 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -24,7 +24,7 @@ class JupytersController < ApplicationController
def open1
## 打开tpi
- game = Game.find(0)
+ game = Game.find(2170160)
shixun = game.myshixun.shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
From 6e955236cd09c376edf220cba32606169837668e Mon Sep 17 00:00:00 2001
From: guange
Date: Tue, 10 Dec 2019 16:37:08 +0800
Subject: [PATCH 017/157] .
---
app/controllers/jupyters_controller.rb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb
index de7d7296c..1712c60be 100644
--- a/app/controllers/jupyters_controller.rb
+++ b/app/controllers/jupyters_controller.rb
@@ -28,7 +28,9 @@ class JupytersController < ApplicationController
shixun = game.myshixun.shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
- params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
+
+ tpiID = game.myshixun.id
+ params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params
logger.info "test_juypter: #{res}"
@@ -36,6 +38,8 @@ class JupytersController < ApplicationController
if res && res['code'].to_i != 0
raise("实训云平台繁忙(繁忙等级:99)")
end
+
+ render plain: "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
From 83e28112b2f3c231222e87c4645571d567a035a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Tue, 10 Dec 2019 18:45:35 +0800
Subject: [PATCH 018/157] =?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/App.js | 22 +-
.../courses/coursesPublic/NewShixunModel.js | 13 +-
.../courses/coursesPublic/Newshixunmodel.css | 21 +-
public/react/src/modules/tpm/TPMBanner.js | 7 +-
public/react/src/modules/tpm/TPMChallenge.js | 115 +++---
public/react/src/modules/tpm/TPMDataset.js | 268 +++++++++++++
public/react/src/modules/tpm/TPMIndex.js | 37 +-
.../react/src/modules/tpm/component/TPMNav.js | 4 +
.../Challenges/Challengesjupyter.js | 354 ++++++++++++++++++
.../Collaborators/Collaborators.css | 124 +++++-
.../Collaborators/Collaborators.js | 121 ++++--
.../shixunchild/shixunchildCss/Challenges.css | 42 ++-
.../src/modules/tpm/shixuns/ShixunCard.js | 31 ++
.../src/modules/tpm/shixuns/ShixunsIndex.js | 2 +-
.../src/modules/tpm/tpmmodel/tpmmodel.css | 121 ++++++
public/react/src/search/SearchPage.js | 36 +-
public/react/src/search/searchc.css | 43 ++-
17 files changed, 1227 insertions(+), 134 deletions(-)
create mode 100644 public/react/src/modules/tpm/TPMDataset.js
create mode 100644 public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
create mode 100644 public/react/src/modules/tpm/tpmmodel/tpmmodel.css
diff --git a/public/react/src/App.js b/public/react/src/App.js
index 2fa9e0765..0d24db7c2 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -358,7 +358,7 @@ class App extends Component {
mydisplay:true,
})
};
-
+
disableVideoContextMenu = () => {
window.$( "body" ).on( "mousedown", "video", function(event) {
if(event.which === 3) {
@@ -577,14 +577,14 @@ class App extends Component {
{
-
+
return ()
}
}>
{
+ (props) => {
return ()
}
}>
@@ -615,7 +615,7 @@ class App extends Component {
- {/*列表页*/}
+ {/*列表页 实训项目列表*/}
@@ -637,8 +637,8 @@ class App extends Component {
()
}/>
-
- ()
}
@@ -671,7 +671,7 @@ class App extends Component {
(props)=>()
}/>
- {
return ()
@@ -679,11 +679,11 @@ class App extends Component {
}
/>
()
} />
- ()
}
@@ -703,7 +703,7 @@ class App extends Component {
(props)=>()
}
/>
-
+
@@ -825,4 +825,4 @@ moment.defineLocale('zh-cn', {
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
-export default SnackbarHOC()(App) ;
\ No newline at end of file
+export default SnackbarHOC()(App) ;
diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
index 99a8ad232..f5dfc089a 100644
--- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
+++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
@@ -536,6 +536,17 @@ class NewShixunModel extends Component{
className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]"
>
+ {
+ this.props.type==='shixuns'?
+
+ :""
+ }
+
+
@@ -681,4 +692,4 @@ export default NewShixunModel;
// {}
// )
// })}
-//