Merge branch 'dev_jupyter' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

chromesetting
guange 5 years ago
commit 5c783fe775

@ -283,7 +283,7 @@ class ApplicationController < ActionController::Base
# 测试版前端需求
logger.info("subdomain:#{request.subdomain}")
if request.subdomain == "test-newweb"
if request.subdomain != "www"
if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除
User.current = User.find 81403
elsif params[:debug] == 'student'

@ -178,6 +178,7 @@ class ChallengesController < ApplicationController
# tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新;
def update
begin
ActiveRecord::Base.transaction do
tab = params[:tab].to_i
@challenge.update_attributes(challenge_params)
@ -236,6 +237,11 @@ class ChallengesController < ApplicationController
end
end
rescue => e
logger_error("##update_challenges: ##{e.message}")
tip_exception("更新失败!")
end
end
# 参考答案的'增,删,改'

@ -1,6 +1,6 @@
class GamesController < ApplicationController
before_action :require_login, :check_auth
before_action :find_game
before_action :find_game, except: [:jupyter]
before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status]
before_action :allowed
@ -91,6 +91,19 @@ class GamesController < ApplicationController
end
end
def jupyter
# Jupyter没有challenge
@myshixun = Myshixun.find_by_identifier params[:identifier]
@shixun = @myshixun.shixun
# 判断tpm是否修改了
begin
@tpm_modified = @myshixun.repository_is_modified(@shixun.repo_path) # 判断TPM和TPI的版本库是否被改了
rescue
uid_logger("实训平台繁忙繁忙等级81")
end
end
def reset_vnc_link
begin
# 删除vnc的pod

@ -365,6 +365,31 @@ class MyshixunsController < ApplicationController
end
end
def sync_code
shixun_tomcat = edu_setting('cloud_bridge')
begin
git_myshixun_url = repo_ip_url @myshixun.repo_path
git_shixun_url = repo_ip_url @myshixun.shixun.try(:repo_path)
git_myshixun_url = Base64.urlsafe_encode64(git_myshixun_url)
git_shixun_url = Base64.urlsafe_encode64(git_shixun_url)
# todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改.
params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}",
identifier: "xinhu1ji2qu3"}
uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository"
res = uri_post uri, params
if (res && res['code'] != 0)
tip_exception("实训云平台繁忙繁忙等级95")
end
shixun_new_commit = GitService.commits(repo_path: @myshixun.shixun.repo_path).first["id"]
@myshixun.update_attributes!(commit_id: shixun_new_commit, reset_time: @myshixun.shixun.try(:reset_time))
# 更新完成后,弹框则隐藏不再提示
@myshixun.update_column(:system_tip, false)
render_ok
rescue Exception => e
tip_exception("立即更新代码失败!#{e.message}")
end
end
# -----End

@ -6,16 +6,17 @@ class ShixunsController < ApplicationController
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics]
before_action :check_account, only: [:new, :create, :shixun_exec]
before_action :check_account, only: [:new, :create, :shixun_exec, :jupyter_exec]
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy,
:add_file, :jupyter_exec]
before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish,
:shixun_members_added, :change_manager, :collaborators_delete,
@ -691,112 +692,40 @@ class ShixunsController < ApplicationController
end
end
# def shixun_exec
# if is_shixun_opening?
# tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
# end
# current_myshixun = @shixun.current_myshixun(current_user.id)
#
# min_challenges = @shixun.challenges.pluck(:id , :st)
# # 因为读写分离有延迟所以如果是重置来的请求可以先跳过重置过来的params[:reset]为1
# if current_myshixun && params[:reset] != "1"
# games = current_myshixun.games
# # 如果TPM和TPI的管卡数不相等或者关卡顺序错了说明实训被极大的改动需要重置,实训发布前打过的实训都需要重置
# if is_shixun_reset?(games, min_challenges, current_myshixun)
# # 这里页面弹框要收到 当前用户myshixun的identifier.
# tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game")
# end
#
#
# if current_myshixun.repo_name.nil?
# g = Gitlab.client
# repo_name = g.project(current_myshixun.gpid).try(:path_with_namespace)
# current_myshixun.update_column(:repo_name, repo_name)
# end
#
# # 如果存在实训,则直接进入实训
# # 如果实训允许跳关传参params[:challenge_id]跳入具体的关卡
# @current_task =
# if params[:challenge_id]
# game = games.where(challenge_id: params[:challenge_id]).take
# if @shixun.task_pass || game.status != 3
# game
# else
# current_myshixun.current_task(games)
# end
# else
# current_myshixun.current_task(games)
# end
# else
# # 如果未创建关卡一定不能开启实训否则TPI没法找到当前的关卡
# if @shixun.challenges_count == 0
# tip_exception("开启实战前请先创建实训关卡")
# end
#
# # 判断实训是否全为选择题
# is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count)
# if !is_choice_type
# commit = GitService.commits(repo_path: @repo_path).try(:first)
# uid_logger("First comit########{commit}")
# tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
# commit_id = commit["id"]
# end
#
# begin
# ActiveRecord::Base.transaction do
# begin
# myshixun_identifier = generate_identifier Myshixun, 10
# myshixun_params = {user_id: current_user.id, identifier: myshixun_identifier,
# modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
# onclick_time: Time.now, commit_id: commit_id}
# @myshixun = @shixun.myshixuns.create!(myshixun_params)
# # 其它创建关卡等操作
# challenges = @shixun.challenges
# # 之所以增加user_id是为了方便统计查询性能
# game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at]
# Game.bulk_insert(*game_attrs) do |worker|
# base_attr = {myshixun_id: @myshixun.id, user_id: @myshixun.user_id}
# challenges.each_with_index do |challenge, index|
# status = (index == 0 ? 0 : 3)
# game_identifier = generate_identifier(Game, 12)
# worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now,
# identifier: game_identifier, modify_time: challenge.modify_time))
# end
# end
# @current_task = @myshixun.current_task(@myshixun.games)
# rescue Exception => e
# logger.error("------ActiveRecord::RecordInvalid: #{e.message}")
# raise("ActiveRecord::RecordInvalid")
# end
# end
# # 如果实训是纯选择题则不需要去fork仓库以及中间层的相关操作了
# ActiveRecord::Base.transaction do
# unless is_choice_type
# # fork仓库
# cloud_bridge = edu_setting('cloud_bridge')
# project_fork(@myshixun, @repo_path, current_user.login)
# rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
# uid_logger("start openGameInstance")
# uri = "#{cloud_bridge}/bridge/game/openGameInstance"
# logger.info("end openGameInstance")
# params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
# uid_logger("openGameInstance params is #{params}")
# interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
# end
# end
# rescue Exception => e
# logger.info("shixun_exec error: #{e.message}")
# if e.message != "ActiveRecord::RecordInvalid"
# logger.error("##########project_fork error #{e.message}")
# @myshixun.destroy!
# end
# raise "实训云平台繁忙繁忙等级81"
# end
# end
# end
# gameID 及实训ID
# status: 0 , 1 申请过, 2实训关卡路径未填 3 实训标签未填, 4 实训未创建关卡
# jupyter开启挑战
def jupyter_exec
begin
if is_shixun_opening?
tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
end
current_myshixun = @shixun.current_myshixun(current_user.id)
if current_myshixun
@myshixun = current_myshixun
else
commit = GitService.commits(repo_path: @repo_path).try(:first)
uid_logger("First comit########{commit}")
tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10
ActiveRecord::Base.transaction do
@myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier,
modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
onclick_time: Time.now, commit_id: commit_id)
# fork仓库
project_fork(@myshixun, @repo_path, current_user.login)
rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
uri = "#{cloud_bridge}/bridge/game/openGameInstance"
params = {tpiID: "#{myshixun.id}", tpmGitURL: rep_url, tpiRepoName: myshixun.repo_name.split("/").last}
interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
end
end
rescue => e
uid_logger_error(e.message)
tip_exception("实训云平台繁忙繁忙等级81")
end
end
def publish
@status = 0
@position = []

@ -163,9 +163,12 @@ module ExportHelper
count_2 = common_homeworks.size
count_3 = group_homeworks.size
count_4 = tasks.size
all_user_ids = all_members.pluck(:user_id)
#实训作业
shixun_homeworks.each_with_index do |s,index|
all_student_works = s.score_student_works #该实训题的全部用户回答
all_student_works = s.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #该实训题的全部用户回答
title_no = index.to_i + 1
student_work_to_xlsx(all_student_works,s)
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30)
@ -175,7 +178,7 @@ module ExportHelper
#普通作业
common_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
@ -187,7 +190,7 @@ module ExportHelper
#分组作业
group_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@ -197,7 +200,7 @@ module ExportHelper
#毕设任务
tasks.each_with_index do |c,index|
all_student_works = c.score_graduation_works #当前用户的对该作业的回答
all_student_works = c.score_graduation_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + index.to_i + 1
graduation_work_to_xlsx(all_student_works,c,current_user)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@ -207,7 +210,7 @@ module ExportHelper
#试卷的导出
exercises.each_with_index do |c,index|
all_student_works = c.score_exercise_users #当前用户的对该作业的回答
all_student_works = c.score_exercise_users.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
get_export_users(c,course,all_student_works)
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)

@ -17,10 +17,17 @@ class SyncTrustieJob < ApplicationJob
"number": count
}
uri = URI.parse(url)
# http = Net::HTTP.new(uri.hostname, uri.port)
if api_host
http = Net::HTTP.new(uri.hostname, uri.port)
http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
Rails.logger.info("#######_________response__sync__end_____#########")
if api_host.include?("https://")
http.use_ssl = true
end
response = http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
Rails.logger.info("#######_________response__sync__end_____#########{response.body}")
end
end
end

@ -0,0 +1,7 @@
json.user do
json.partial! 'users/user', user: current_user
end
json.(@shixun, :id, :identifier, :status, :name)
json.myshixun_identifier @myshixun.identifier
json.tpm_modified @tpm_modified

@ -0,0 +1 @@
json.identifier @myshixun.identifier

@ -184,6 +184,7 @@ Rails.application.routes.draw do
post :html_content
get :open_webssh
get :challenges
post :sync_code
end
collection do
get :sigle_mul_test
@ -219,6 +220,7 @@ Rails.application.routes.draw do
get :check_test_sets
get :unlock_choose_answer
get :get_choose_answer
get :jupyter
end
collection do
@ -278,6 +280,7 @@ Rails.application.routes.draw do
post :update_permission_setting
post :update_learn_setting
get :jupyter_data_sets
get :jupyter_exec
end
resources :challenges do

@ -0,0 +1,7 @@
class ModifyTypeForTestSets < ActiveRecord::Migration[5.2]
def change
change_column :test_sets, :input, :longtext
change_column :test_sets, :output, :longtext
end
end

@ -52,6 +52,7 @@ export function initAxiosInterceptors(props) {
//proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
@ -88,7 +89,6 @@ export function initAxiosInterceptors(props) {
url = `${config.url}`;
}
}
if(`${config[0]}`!=`true`){
if (window.location.port === "3007") {
// if (url.indexOf('.json') == -1) {

@ -38,9 +38,9 @@ class VNCContainer extends Component {
}
shouldComponentUpdate () {
return false;
}
// shouldComponentUpdate () {
// return false;
// }
getSecondDrawerWidth = () => {
return $('#game_right_contents').width() - firstDrawerWidth
@ -337,11 +337,11 @@ class VNCContainer extends Component {
width={firstDrawerWidth}
closable={false}
onClose={this.onBottomDrawerClose}
visible={this.state.bottomDrawer}
visible={this.state.bottomDrawer===undefined?false:this.state.bottomDrawer}
className={'codeEvaluateDrawer'}
placement="bottom"
getContainer={false}
style={{ position: 'absolute', bottom: '25px', zIndex: 1 }}
style={{ position: 'absolute', bottom: '-25px', zIndex: 1 }}
afterVisibleChange={(visible) => {
if (visible) {
const canvas = $('.vncDisply canvas')[0]

@ -212,6 +212,7 @@ class Audit_situationComponent extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
<div className="padding20 edu-back-white mt20" style={{minHeight: '640px'}}>

@ -1,16 +1,16 @@
import React, { Component } from 'react';
import React, {Component} from 'react';
import { Redirect } from 'react-router';
import {Redirect} from 'react-router';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
import PropTypes from 'prop-types';
import { Rating ,Progress} from "@icedesign/base";
import {Rating, Progress} from "@icedesign/base";
import {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip,Rate} from 'antd';
import {Modal, Input, Radio, Pagination, message, Spin, Icon, Tooltip, Rate} from 'antd';
import AccountProfile from"../user/AccountProfile";
import AccountProfile from "../user/AccountProfile";
import 'antd/lib/pagination/style/index.css';
@ -29,34 +29,34 @@ const RadioGroup = Radio.Group;
class TPMBanner extends Component {
constructor(props) {
super(props)
this.state={
this.state = {
Forkvisible: false,
Senttothetype:false,
Senttothevcalue:undefined,
courses_count:1,
course_list:[],
pagenum:1,
publishbox:"",
publishboxstatus:0,
pages:1,
Issuevisible:false,
evaluation_set_position:[],
tag_position:[],
Forkauthentication:false,
can_fork:undefined,
certi_url:undefined,
showradios:false,
startbtn:false,
Searchvalue:"",
startshixunCombattype:false,
shixunsmessage:"",
shixunsreplace:false,
hidestartshixunsreplacevalue:"",
isIE:false,
Senttothetype: false,
Senttothevcalue: undefined,
courses_count: 1,
course_list: [],
pagenum: 1,
publishbox: "",
publishboxstatus: 0,
pages: 1,
Issuevisible: false,
evaluation_set_position: [],
tag_position: [],
Forkauthentication: false,
can_fork: undefined,
certi_url: undefined,
showradios: false,
startbtn: false,
Searchvalue: "",
startshixunCombattype: false,
shixunsmessage: "",
shixunsreplace: false,
hidestartshixunsreplacevalue: "",
isIE: false,
Forkvisibletype: false,
isSpin:false,
Senttothevcaluetype:false,
jupyterbool:false,
isSpin: false,
Senttothevcaluetype: false,
jupyterbool: false,
}
}
@ -70,46 +70,48 @@ class TPMBanner extends Component {
// });
// }
IEVersion=()=>{
IEVersion = () => {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
if(isIE) {
if (isIE) {
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
if(fIEVersion == 7) {
if (fIEVersion == 7) {
return 7;
} else if(fIEVersion == 8) {
} else if (fIEVersion == 8) {
return 8;
} else if(fIEVersion == 9) {
} else if (fIEVersion == 9) {
return 9;
} else if(fIEVersion == 10) {
} else if (fIEVersion == 10) {
return 10;
} else {
return 6;//IE版本<=7
}
} else if(isEdge) {
} else if (isEdge) {
return 'edge';//edge
} else if(isIE11) {
} else if (isIE11) {
return 11; //IE11
}else{
} else {
return -1;//不是ie浏览器
}
}
componentDidMount() {
let thiisie=this.IEVersion();
if(thiisie!=-1){
let thiisie = this.IEVersion();
if (thiisie != -1) {
this.setState({
isIE:true
isIE: true
})
}else{
} else {
this.setState({
isIE:false
isIE: false
})
}
}
/*
* Fork
* */
@ -133,7 +135,7 @@ class TPMBanner extends Component {
hideForkvisible = () => {
this.setState({
Forkvisible: false,
Forkauthentication:false
Forkauthentication: false
})
}
@ -144,9 +146,9 @@ class TPMBanner extends Component {
let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/copy.json";
axios.post(url).then((response) => {
if(response.data.status===401){
if (response.data.status === 401) {
}else{
} else {
this.setState({
Forkvisible: false,
Forkauthentication: false,
@ -163,8 +165,8 @@ class TPMBanner extends Component {
/*
* 发送至按钮
* */
Senttothe=()=>{
if(this.props.checkIfLogin()===false){
Senttothe = () => {
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
@ -183,61 +185,64 @@ class TPMBanner extends Component {
// return
// }
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/search_user_courses.json";
let url = "/shixuns/" + id + "/search_user_courses.json";
this.setState({
Senttothetype:true
Senttothetype: true
})
axios.get(url, {
params: {
page:1,
limit:10
}}).then((response) => {
page: 1,
limit: 10
}
}).then((response) => {
this.setState({
courses_count:response.data.courses_count,
course_list:response.data.course_list
courses_count: response.data.courses_count,
course_list: response.data.course_list
})
}).catch((error) => {
console.log(error)
});
}
SenttotheSearch=(value)=>{
SenttotheSearch = (value) => {
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/search_user_courses.json?search="+value;
let url = "/shixuns/" + id + "/search_user_courses.json?search=" + value;
axios.get(encodeURI(url), {
params: {
page:1,
limit:10
}}).then((response) => {
page: 1,
limit: 10
}
}).then((response) => {
this.setState({
courses_count:response.data.courses_count,
course_list:response.data.course_list,
pages:1,
Searchvalue:value
courses_count: response.data.courses_count,
course_list: response.data.course_list,
pages: 1,
Searchvalue: value
})
}).catch((error) => {
console.log(error)
});
}
onChangeSenttothevcalue=(e)=>{
onChangeSenttothevcalue = (e) => {
this.setState({
Senttothevcalue:e.target.value
Senttothevcalue: e.target.value
})
}
onChangesendeSenttothe=(pageNumber)=>{
let{Searchvalue}=this.state;
onChangesendeSenttothe = (pageNumber) => {
let {Searchvalue} = this.state;
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue;
let url = "/shixuns/" + id + "/search_user_courses.json?search=" + Searchvalue;
axios.get(url, {
params: {
page:pageNumber,
limit:10
}}).then((response) => {
page: pageNumber,
limit: 10
}
}).then((response) => {
this.setState({
courses_count:response.data.courses_count,
course_list:response.data.course_list,
courses_count: response.data.courses_count,
course_list: response.data.course_list,
pagenum: pageNumber,
pages: pageNumber
})
@ -245,27 +250,27 @@ class TPMBanner extends Component {
console.log(error)
});
}
sendeSenttothevcalue=()=>{
sendeSenttothevcalue = () => {
let {Senttothevcalue}=this.state;
let {Senttothevcalue} = this.state;
if(Senttothevcalue===undefined){
if (Senttothevcalue === undefined) {
this.setState({
Senttothevcaluetype:true
Senttothevcaluetype: true
})
return
}
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/send_to_course.json";
axios.post(url,{
course_id:Senttothevcalue
let url = "/shixuns/" + id + "/send_to_course.json";
axios.post(url, {
course_id: Senttothevcalue
}).then((response) => {
this.props.showSnackbar(response.data.message);
this.setState({
Senttothetype:false,
Searchvalue:"",
pages:1
Senttothetype: false,
Searchvalue: "",
pages: 1
})
// window.location.href = response.data.url;
// response.data.course_id
@ -277,11 +282,11 @@ class TPMBanner extends Component {
}
hideSenttothevcalue=()=>{
hideSenttothevcalue = () => {
this.setState({
Senttothetype:false,
Searchvalue:"",
pages:1
Senttothetype: false,
Searchvalue: "",
pages: 1
})
@ -291,14 +296,14 @@ class TPMBanner extends Component {
* 撤销发布按钮
* */
ModalCancel=()=>{
ModalCancel = () => {
this.setState({
Modalstype:false
Modalstype: false
})
}
ModalSave=()=>{
ModalSave = () => {
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/cancel_publish.json";
let url = "/shixuns/" + id + "/cancel_publish.json";
axios.get(url).then((response) => {
this.props.showSnackbar(response.data.message);
window.location.reload()
@ -306,12 +311,12 @@ class TPMBanner extends Component {
console.log(error)
});
}
cancel_publish=()=>{
cancel_publish = () => {
this.setState({
Modalstype:true,
Modalstopval:"是否确认撤销发布?",
ModalCancel:this.ModalCancel,
ModalSave:this.ModalSave,
Modalstype: true,
Modalstopval: "是否确认撤销发布?",
ModalCancel: this.ModalCancel,
ModalSave: this.ModalSave,
})
}
@ -319,32 +324,32 @@ class TPMBanner extends Component {
/*
* 申请发布按钮
* */
applyrelease=()=>{
applyrelease = () => {
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/publish.json";
let url = "/shixuns/" + id + "/publish.json";
axios.get(url).then((response) => {
let evaluation_set_position
if(response.data.evaluation_set_position===null){
evaluation_set_position=[]
}else{
evaluation_set_position=response.data.evaluation_set_position
if (response.data.evaluation_set_position === null) {
evaluation_set_position = []
} else {
evaluation_set_position = response.data.evaluation_set_position
}
this.setState({
Issuevisible:true,
tag_position:response.data.tag_position,
evaluation_set_position:evaluation_set_position,
publishboxstatus:response.data.status,
Issuevisible: true,
tag_position: response.data.tag_position,
evaluation_set_position: evaluation_set_position,
publishboxstatus: response.data.status,
})
}).catch((error) => {
console.log(error)
});
};
hiddenIssuevisible=(val)=>{
hiddenIssuevisible = (val) => {
this.setState({
Issuevisible:false
Issuevisible: false
})
if(val===0||val===1){
if (val === 0 || val === 1) {
window.location.reload()
}
@ -362,29 +367,30 @@ class TPMBanner extends Component {
// }
// reset_my_game
hidestartshixunsreplace=(url)=>{
hidestartshixunsreplace = (url) => {
this.setState({
isSpin:true,
isSpin: true,
})
axios.get(url).then((response) => {
if(response.status===200){
if (response.status === 200) {
// let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
// this.props.history.push(path);
message.success('重置成功,正在进入实训!');
this.startshixunCombat(response.data.shixun_identifier, 1);
this.setState({
shixunsreplace:false,
isSpin:false,
shixunsreplace: false,
isSpin: false,
})
// message.success('重置成功,正在进入实训!');
// this.startshixunCombat();
}}
}
}
).catch((error) => {
this.setState({
startbtn:false,
shixunsreplace:false,
isSpin:false
startbtn: false,
shixunsreplace: false,
isSpin: false
})
});
@ -392,16 +398,17 @@ class TPMBanner extends Component {
//开始实战按钮
startshixunCombat=(id, reset)=>{
startshixunCombat = (id, reset) => {
if(this.props.checkIfLogin()===false){
if(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true){
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
if (this.props.checkIfProfileCompleted() === false) {
this.setState({
AccountProfiletype:true
AccountProfiletype: true
})
return
}
@ -414,97 +421,172 @@ class TPMBanner extends Component {
// }
let {shixunsDetails} = this.props
if( shixunsDetails.shixun_status>1){
if (shixunsDetails.shixun_status > 1) {
this.setState({
startbtn:true,
hidestartshixunsreplacevalue:""
startbtn: true,
hidestartshixunsreplacevalue: ""
})
}else{
} else {
this.setState({
hidestartshixunsreplacevalue:""
hidestartshixunsreplacevalue: ""
})
}
let url="/shixuns/"+id+"/shixun_exec.json" ;
let url = "/shixuns/" + id + "/jupyter_exec.json";
if (reset) {
url += '?reset=' + reset
}
axios.get(url).then((response) => {
if(response.status===200){
if(response.data.status===-2){
if (response.status === 200) {
if (response.data.status === -2) {
// this.resetshixunCombat(response.data.message);
this.setState({
startbtn:false,
shixunsreplace:true,
hidestartshixunsreplacevalue:response.data.message+".json"
startbtn: false,
shixunsreplace: true,
hidestartshixunsreplacevalue: response.data.message + ".json"
})
// this.shixunexec(response.data.message+".json")
}else if(response.data.status===-1){
} else if (response.data.status === -1) {
console.log(response)
}else if(response.data.status===-3){
} else if (response.data.status === -3) {
this.setState({
shixunsmessage:response.data.message,
startshixunCombattype:true,
startbtn:false
shixunsmessage: response.data.message,
startshixunCombattype: true,
startbtn: false
})
} else {
// let path="/tasks/"+response.data.game_identifier;
// this.props.history.push(path);
// this.context.router.history.push(path);
if (response.data.status != 401) {
window.location.href = "/tasks/" + response.data.identifier+`/jupyter`;
}
}
}
}).catch((error) => {
this.setState({
startbtn: false
})
});
}else{
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
if (this.props.checkIfProfileCompleted() === false) {
this.setState({
AccountProfiletype: true
})
return
}
// if(this.props.checkIfProfessionalCertification()===false){
// this.setState({
// AccountProfiletype:true
// })
// return
// }
let {shixunsDetails} = this.props
if (shixunsDetails.shixun_status > 1) {
this.setState({
startbtn: true,
hidestartshixunsreplacevalue: ""
})
} else {
this.setState({
hidestartshixunsreplacevalue: ""
})
}
let url = "/shixuns/" + id + "/shixun_exec.json";
if (reset) {
url += '?reset=' + reset
}
axios.get(url).then((response) => {
if (response.status === 200) {
if (response.data.status === -2) {
// this.resetshixunCombat(response.data.message);
this.setState({
startbtn: false,
shixunsreplace: true,
hidestartshixunsreplacevalue: response.data.message + ".json"
})
// this.shixunexec(response.data.message+".json")
} else if (response.data.status === -1) {
console.log(response)
} else if (response.data.status === -3) {
this.setState({
shixunsmessage: response.data.message,
startshixunCombattype: true,
startbtn: false
})
} else {
// let path="/tasks/"+response.data.game_identifier;
// this.props.history.push(path);
// this.context.router.history.push(path);
if(response.data.status!=401){
window.location.href = "/tasks/"+response.data.game_identifier;
if (response.data.status != 401) {
window.location.href = "/tasks/" + response.data.game_identifier;
}
}
}
}).catch((error) => {
this.setState({
startbtn:false
startbtn: false
})
});
}
tocertification=()=>{
let{certi_url}=this.state;
}
tocertification = () => {
let {certi_url} = this.state;
this.setState({
Forkauthentication:false
Forkauthentication: false
})
window.location.href=certi_url;
window.location.href = certi_url;
}
SenttotheValue=(e)=>{
SenttotheValue = (e) => {
this.setState({
Searchvalue:e.target.value
Searchvalue: e.target.value
})
}
hidestartshixunCombattype=()=>{
hidestartshixunCombattype = () => {
this.setState({
startshixunCombattype:false
startshixunCombattype: false
})
}
hideAccountProfile=()=>{
hideAccountProfile = () => {
this.setState({
AccountProfiletype:false
AccountProfiletype: false
})
}
showonMouseOver=()=>{
showonMouseOver = () => {
$("#ratePanel").show();
this.setState({
showradios:true
showradios: true
})
}
hideonMouseOut=()=>{
hideonMouseOut = () => {
$("#ratePanel").hide();
this.setState({
showradios:false
showradios: false
})
}
@ -532,7 +614,8 @@ class TPMBanner extends Component {
hidestartshixunsreplacevalue,
Forkvisibletype,
AccountProfiletype,
isIE} = this.state;
isIE
} = this.state;
let {shixunsDetails, shixunId, star_info, star_infos} = this.props;
let challengeBtnTipText = '';
let challengeBtnText = '模拟实战';
@ -545,14 +628,14 @@ class TPMBanner extends Component {
// challengeBtnTipText = '开始学习并完成实战任务'
//
// }
if(shixunsDetails!=undefined){
if (shixunsDetails.shixun_status === 0 ) {
if (shixunsDetails != undefined) {
if (shixunsDetails.shixun_status === 0) {
challengeBtnText = '继续实战'
} else if (shixunsDetails.shixun_status === 1) {
challengeBtnText = '查看实战'
} else if (shixunsDetails.shixun_status === 3) {
challengeBtnText = '继续实战'
}else{
} else {
challengeBtnText = "开始实战"
}
}
@ -584,37 +667,40 @@ class TPMBanner extends Component {
lineHeight: '30px',
};
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
const MyRate = ({ defaultValue, ...rest }) => {
const antIcon = <Icon type="loading" style={{fontSize: 24}} spin/>;
const MyRate = ({defaultValue, ...rest}) => {
let myValue = defaultValue;
// console.log(myValue-Math.floor(myValue))
// if (myValue < Math.ceil(myValue)) {
// myValue = Math.floor(myValue) + 0.5;
// }
return <Rating {...rest} value={myValue} />;
return <Rating {...rest} value={myValue}/>;
};
//
// console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter)
return (
shixunsDetails===undefined?"":
<div className="shixunDetail">
shixunsDetails === undefined ? "" :
<div className="shixunDetail">
<div className="shixunDetail_top">
{AccountProfiletype===true?<AccountProfile
hideAccountProfile={()=>this.hideAccountProfile()}
{AccountProfiletype === true ? <AccountProfile
hideAccountProfile={() => this.hideAccountProfile()}
{...this.props}
{...this.state}
/>:""}
/> : ""}
{this.state.Modalstype===true?<Modals
{this.state.Modalstype === true ? <Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype}
/>:""}
/> : ""}
<div className="educontent clearfix">
<p className="clearfix">
@ -647,7 +733,7 @@ class TPMBanner extends Component {
{/*`*/}
{/*}*/}
{/*</style>*/}
<ul className="fl color-grey-c pathInfo" >
<ul className="fl color-grey-c pathInfo">
<li>
<span>学习人数</span>
<span className="mt10">{shixunsDetails.stu_num}</span>
@ -663,12 +749,14 @@ class TPMBanner extends Component {
</li>
</ul>
<div className="pr fl" id="commentsStar" onMouseOver={()=>this.showonMouseOver()} onMouseOut={()=>this.hideonMouseOut()}>
<div className={"color-grey-c ml15"} style={{color: "#Fff",textAlign: "center"}}>学员评分</div>
<div className="pr fl" id="commentsStar" onMouseOver={() => this.showonMouseOver()}
onMouseOut={() => this.hideonMouseOut()}>
<div className={"color-grey-c ml15"} style={{color: "#Fff", textAlign: "center"}}>学员评分</div>
<div className="rateYo">
<MyRate allowHalf defaultValue={star_info[0]} disabled/>
</div>
<div id="ratePanel" className="showratePanel" style={{"width":"530px"}} onMouseOut={()=>this.hideonMouseOut()}>
<div id="ratePanel" className="showratePanel" style={{"width": "530px"}}
onMouseOut={() => this.hideonMouseOut()}>
<div className="pr">
<span className="rateTrangle"></span>
<div className="pr clearfix ratePanelContent" style={{height: '177px'}}>
@ -744,7 +832,7 @@ class TPMBanner extends Component {
shixunsDetails.task_operation[0] === "查看实战" ? "查看我的实战光辉历史" :
shixunsDetails.task_operation[0] === "模拟实战" ? "模拟完成实战任务" : shixunsDetails.task_operation[0] === "开启挑战" ? "开始学习并完成实战任务" : ""
}>
<a onClick={()=>this.startshixunCombat(this.props.match.params.shixunId)}
<a onClick={() => this.startshixunCombat(this.props.match.params.shixunId)}
className="fr user_default_btn task-btn-orange font-18"
id="shixun_operation" data-remote="true"
>
@ -844,7 +932,7 @@ class TPMBanner extends Component {
evaluation_set_position.map((item, key) => {
return (
<span key={key}>{item}<span
style={{display: key != evaluation_set_position.length-1 ? "inline-block" : 'none'}}>,</span></span>
style={{display: key != evaluation_set_position.length - 1 ? "inline-block" : 'none'}}>,</span></span>
)
})
}
@ -859,7 +947,7 @@ class TPMBanner extends Component {
tag_position.map((item, key) => {
return (
<span key={key}>{item}<span
style={{display: key != tag_position.length-1 ? "inline-block" : 'none'}}>,</span></span>
style={{display: key != tag_position.length - 1 ? "inline-block" : 'none'}}>,</span></span>
)
})
}
@ -888,7 +976,7 @@ class TPMBanner extends Component {
<a onClick={this.Senttothe}
className="fr user_default_btn user_blue_btn mr20 font-18"
data-tip-down=""
style={{display: shixunsDetails.shixun_status === 0 || shixunsDetails.shixun_status === 3 ||shixunsDetails.shixun_status === 1 ||shixunsDetails.shixun_status === -1 ? "none" : "block"}}
style={{display: shixunsDetails.shixun_status === 0 || shixunsDetails.shixun_status === 3 || shixunsDetails.shixun_status === 1 || shixunsDetails.shixun_status === -1 ? "none" : "block"}}
data-remote="true">
<Tooltip placement="bottom" title={"以实训作业的形式发送到我的课堂"}>
发送至
@ -928,7 +1016,7 @@ class TPMBanner extends Component {
`}
</style>
<div id="search_course_list" className={courses_count > 12?"cdefault ":"cdefault "}>
<div id="search_course_list" className={courses_count > 12 ? "cdefault " : "cdefault "}>
<div className="clearfix mb20 edu-bg-light-blue edu-h270">
<ul>
<RadioGroup onChange={this.onChangeSenttothevcalue} value={Senttothevcalue}>
@ -944,7 +1032,7 @@ class TPMBanner extends Component {
</ul>
</div>
</div>
{this.state.Senttothevcaluetype===true?<div className={"color-red"}>请选择你要发送的课堂</div>:""}
{this.state.Senttothevcaluetype === true ? <div className={"color-red"}>请选择你要发送的课堂</div> : ""}
<div className="mt10 marginauto" style={{display: courses_count > 12 ? "block" : "none"}}>
<Pagination size="small" className="mb20"
showQuickJumper defaultCurrent={1} current={pages} pageSize={12}
@ -978,7 +1066,8 @@ class TPMBanner extends Component {
}
{this.props.identity < 8&&shixunsDetails.shixun_status != -1 ?<div className="fr user_default_btn user_blue_btn mr20"
{this.props.identity < 8 && shixunsDetails.shixun_status != -1 ?
<div className="fr user_default_btn user_blue_btn mr20"
style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}>
<Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}>
<span className="flex1 edu-txt-center fl font-18"
@ -996,12 +1085,12 @@ class TPMBanner extends Component {
closable={false}
footer={null}
>
{Forkvisibletype===true?
{Forkvisibletype === true ?
<Spin
tip="请等待正在复制中..."
style={{marginLeft:'38%'}}
style={{marginLeft: '38%'}}
>
</Spin>:
</Spin> :
<div>
<div className="task-popup-content"><p
className="task-popup-text-center font-16 pb20">复制将在后台执行平台将为你创建<br/>一个新的同名实训和内容请问是否继续</p>
@ -1037,7 +1126,7 @@ class TPMBanner extends Component {
</Link>
}
</div>:""}
</div> : ""}
</div>
@ -1045,9 +1134,10 @@ class TPMBanner extends Component {
</div>
<div className="alert alert-orange mb15 mt15 clearfix"
style={{display:shixunsDetails.shixun_status === 1?"block":"none"}}
>正在等待管理员的审核在审核通过前可以随时撤销发布</div>
</div>
style={{display: shixunsDetails.shixun_status === 1 ? "block" : "none"}}
>正在等待管理员的审核在审核通过前可以随时撤销发布
</div>
</div>
);
}

@ -20,7 +20,7 @@ class TPMChallenge extends Component {
}
render() {
const { loadingContent, shixun, user, match,jupyterbool
const { loadingContent, shixun, user, match,jupyterbool,is_jupyter
} = this.props;
return (
<React.Fragment>
@ -32,13 +32,15 @@ class TPMChallenge extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
{
jupyterbool===true?
is_jupyter===true?
<Challengesjupyter
{...this.props}
/>
: <Challenges
:
<Challenges
{...this.props}
/>
}

@ -15,6 +15,8 @@ class TPMChallengeContainer extends Component {
render() {
const { tpmLoading } = this.props;
const user = this.props.current_user;
// console.log("TPMChallengeContainerTPMChallengeContainer");
// console.log(this.props);
return (
<React.Fragment>
@ -22,6 +24,7 @@ class TPMChallengeContainer extends Component {
{ tpmLoading ? <div style={{ minHeight: '886px'}}></div> :
<TPMChallenge
{...this.props}
is_jupyter={this.props.is_jupyter}
>
</TPMChallenge>
}

@ -31,6 +31,7 @@ class TPMCollaborators extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
<Collaborators
{...this.props}

@ -35,7 +35,7 @@ class TPMChallengeContainer extends Component {
{...this.state}
user={user}
aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
>
</TPMCollaborators>
}

@ -89,7 +89,7 @@ class TPMDataset extends Component {
}
mysonChange = (e) => {
console.log(`全选checked = ${e.target.checked}`);
// console.log(`全选checked = ${e.target.checked}`);
if (e.target.checked === true) {
let mydata=[];
let datas=[];
@ -103,8 +103,8 @@ class TPMDataset extends Component {
selectedRowKeysdata:mydata,
selectedRowKeys: datas,
})
console.log(mydata);
console.log(datas);
// console.log(mydata);
// console.log(datas);
} else {
@ -237,6 +237,7 @@ class TPMDataset extends Component {
// 附件相关 START
handleChange = (info) => {
debugger
if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList} = this.state;
@ -256,6 +257,7 @@ class TPMDataset extends Component {
}
onAttachmentRemove = (file) => {
debugger
if(!file.percent || file.percent == 100){
confirm({
title: '确定要删除这个附件吗?',
@ -357,7 +359,7 @@ class TPMDataset extends Component {
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file, fileList) => {
debugger
if (this.state.fileList.length >= 1) {
return false
}
@ -400,6 +402,7 @@ class TPMDataset extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>

@ -38,7 +38,7 @@ class TPMRanking_listContainer extends Component {
{...this.state}
user={user}
aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
>
</TPMForklist>
}

@ -42,6 +42,7 @@ class TPMForklist extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
{ loadingContent ?
<CircularProgress size={40} thickness={3} style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> :

@ -20,6 +20,8 @@ import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
//import TPMsettings from './TPMsettings/TPMsettings';
import TPMsettings from './TPMsettings/oldTPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer';
@ -29,6 +31,7 @@ import TPMCollaboratorsComponent from './TPMCollaboratorsContainer';
import Audit_situationComponent from './Audit_situationComponent';
import TPMDataset from './TPMDataset';
import '../page/tpiPage.css'
import TPMNav from "./component/TPMNav";
const $ = window.$
//任务
@ -143,6 +146,7 @@ class TPMIndex extends Component {
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
tpmindexjupyterbool:false,
is_jupyter:false,
}
}
@ -193,7 +197,7 @@ class TPMIndex extends Component {
propaedeutics:response.data.propaedeutics,
status: response.data.shixun_status,
secret_repository: response.data.secret_repository,
is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter,
});
}
}).catch((error) => {
@ -205,7 +209,8 @@ class TPMIndex extends Component {
power: undefined,
identity: undefined,
status: undefined,
propaedeutics:undefined
propaedeutics:undefined,
is_jupyter:false,
});
});
@ -274,6 +279,7 @@ class TPMIndex extends Component {
let url = window.location.href;
let flag = url.indexOf("add_file")>-1;
// console.log(this.state.is_jupyter);
return (
<div className="newMain clearfix">
{/*头部*/}
@ -295,16 +301,16 @@ class TPMIndex extends Component {
<Switch {...this.props}>
<Route path="/shixuns/:shixunId/repository/:repoId/commits" render={
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props}
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route path="/shixuns/:shixunId/secret_repository/:repoId/commits" render={
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} secret_repository_tab={true}
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/*任务*/}
<Route exact path="/shixuns/:shixunId/challenges" render={
(props) => (<TPMChallengeComponent {...this.props} jupyterbool={true} {...this.state} {...props}
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
@ -314,24 +320,24 @@ class TPMIndex extends Component {
}></Route>
<Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props}
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route path="/shixuns/:shixunId/secret_repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true}
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<Route exact path="/shixuns/:shixunId/propaedeutics" render={
(props) => (<TPMPropaedeuticsComponent {...this.props} {...this.state} {...props}
(props) => (<TPMPropaedeuticsComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/collaborators" render={
(props) => (<TPMCollaboratorsComponent {...this.props} {...this.state} {...props}
(props) => (<TPMCollaboratorsComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
@ -340,7 +346,7 @@ class TPMIndex extends Component {
<Route path="/shixuns/:shixunId/shixun_discuss" render={
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props}
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
initForumState={(data)=>this.initForumState(data)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
@ -354,17 +360,17 @@ class TPMIndex extends Component {
{/*实训项目条目塞选*/}
<Route exact path="/shixuns/:shixunId/ranking_list" render={
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props}
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/*合作者*/}
<Route exact path="/shixuns/:shixunId/dataset" render={
(props) => (<TPMDataset {...this.props} {...this.state} {...props}
(props) => (<TPMDataset {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/audit_situation" render={
(props) => (<Audit_situationComponent {...this.props} {...this.state} {...props}
(props) => (<Audit_situationComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
@ -415,7 +421,7 @@ class TPMIndex extends Component {
}></Route>
<Route exact path="/shixuns/:shixunId" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props}
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>

@ -52,6 +52,7 @@ class TPMPropaedeutics extends Component {
shixun={shixun}
{...this.state}
{...this.props}
is_jupyter={this.props.is_jupyter}
/>
<Propaedeutics

@ -26,6 +26,7 @@ class TPMPropaedeuticsComponent extends Component {
{ tpmLoading ? <div style={{ minHeight: '886px'}}></div> :
<TPMPropaedeutics
{...this.props}
is_jupyter={this.props.is_jupyter}
>
</TPMPropaedeutics>
}

@ -38,6 +38,7 @@ class TPMRanking_list extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
<Ranking_list

@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
import TPMRanking_list from './TPMRanking_list'
import axios from 'axios';
import TPMNav from "./component/TPMNav";
class TPMRanking_listContainer extends Component {
constructor(props) {
@ -26,6 +27,8 @@ class TPMRanking_listContainer extends Component {
{...this.state}
user={user}
aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
>
</TPMRanking_list>
}

@ -35,6 +35,7 @@ class TPMRepository extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
{/* <RepositoryChooseModal {...this.props}></RepositoryChooseModal> */}
{ loadingContent ?

@ -200,6 +200,7 @@ class TPMRepositoryComponent extends Component {
{...this.state}
nameTypeMap={this.nameTypeMap}
fetchRepo={this.fetchRepo}
is_jupyter={this.props.is_jupyter}
>
</TPMRepository>
:

@ -44,6 +44,7 @@ class TPMShixunDiscuss extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
{ loadingContent ?
<CircularProgress size={40} thickness={3} style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> :

@ -33,7 +33,7 @@ class TPMShixunDiscussContainer extends Component {
{...this.state}
user={user}
aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
>
</TPMShixunDiscuss>
}

@ -33,7 +33,24 @@ const Option = Select.Option;
const RadioGroup = Radio.Group;
const confirm = Modal.confirm;
function range(start, end) {
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],
};
}
function disabledDate(current) {
return current && current < moment().endOf('day').subtract(1, 'days');
}
export default class Shixuninformation extends Component {
@ -63,7 +80,7 @@ export default class Shixuninformation extends Component {
})
}
return (
<div>
<div className="educontent mb50 edu-back-white padding10-20">
<div className="clearfix ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>复制:</span>
<span className="fl mt5">

@ -23,7 +23,7 @@ export default class Shixuninformation extends Component {
render() {
return (
<div>
<div className="educontent mb50 edu-back-white padding10-20">
1111
</div>
);

@ -25,9 +25,9 @@ import axios from 'axios';
import TPMMDEditor from "../challengesnew/TPMMDEditor";
import Bottomsubmit from "../../modals/Bottomsubmit";
import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
import {TPMIndexHOC} from "../TPMIndexHOC";
import {getUploadActionUrl} from 'educoder';
import './css/TPMsettings.css';
@ -43,9 +43,39 @@ class Shixuninformation extends Component {
NAME_COUNT: 60,
shixunmemoMDvalue: "",
language: "java",
testscripttiptype:false,
shixunName:'',
trainee:undefined,
choice_small_type:[],
simichecked:false,
}
}
componentDidMount() {
}
componentDidUpdate(prevProps, prevState) {
if(prevProps.data!=this.props.data){
if(this.props.data){
this.setState({
shixunName:this.props.data.shixun.name,
trainee:this.props.data.shixun.trainee,
choice_main_type:this.props.data.shixun.choice_main_type,
choice_small_type:this.props.data.shixun.choice_small_type,
choice_standard_scripts:this.props.data.shixun.choice_standard_scripts,
shixunmemoMDvalue:this.props.data.shixun.evaluate_script,
simichecked:this.props.data.shixun.is_secret_repository,
})
this.props.form.setFieldsValue({
name:this.props.data.shixun.name,
})
this.contentMdRef.current.setValue(this.props.data.shixun.description);
}
}
}
getshixunmemoMDvalue = (value, e) => {
@ -54,13 +84,287 @@ class Shixuninformation extends Component {
})
}
testscripttip=(val)=>{
if(val===0){
this.setState({
testscripttiptype:true
})
}else if(val===1){
this.setState({
testscripttiptype:false
})
}
}
post_apply = () => {
this.setState({
postapplyvisible: true
})
}
sendhideModaly = () => {
this.setState({
postapplyvisible: false,
})
if (this.state.file !== undefined) {
// this.deleteAttachment(this.state.file);
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
} else {
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
}
}
sendsure_apply = () => {
let {language, runtime, run_method} = this.state;
if (!language || language === "") {
// this.props.showNotification(`请填写该镜像是基于什么语言`);
this.setState({
languagewritetype: true
})
return
}
if (!runtime || runtime === "") {
// this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
this.setState({
systemenvironmenttype: true
})
return;
}
if (!run_method || run_method === "") {
// 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) {
this.setState({
attachmentidstype: true
})
return;
}
var data = {
language: language,
runtime: runtime,
run_method: run_method,
attachment_id: attachment_ids[0],
}
var url = `/shixuns/apply_shixun_mirror.json`;
axios.post(url, data
).then((response) => {
try {
if (response.data) {
if (this.state.file !== undefined) {
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
} else {
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
}
notification.open(
{
message: '提示',
description:
'提交成功!',
}
)
this.sendhideModaly()
}
} catch (e) {
}
})
}
bigClass = (value) => {
let list=[]
list.push(this.props.data.shixun.choice_main_type)
this.props.data.shixun.choice_small_type.map((item,key)=>{
list.push(item)
})
let newshixun_service_configs=this.props.data.shixun.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)
}
})
})
this.props.data.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,
})
}
}).catch((error) => {
console.log(error)
});
}
littleClass = (value) => {
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
let newchoice_small_type=this.props.data.shixun.choice_small_type;
let list=[]
list.push(this.props.data.shixun.choice_main_type)
newchoice_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)
}
})
})
this.props.data.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,
})
}
SelectScput = (value, e) => {
this.setState({
choice_standard_scriptssum: value,
language:e.props.name,
choice_standard_scripts: {id:e.props.value,value:""},
standard_scriptsModal:true
})
}
hidestandard_scriptsModal=()=>{
this.setState({
standard_scriptsModal:false,
standard_scriptsModals:false
})
}
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){
// this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
this.setState({
standard_scriptsModal:false,
standard_scriptsModals:true,
shixunmemoMDvalue:response.data.content
})
}
}).catch((error) => {
console.log(error)
})
}
simionChange=(e)=>{
this.setState({
simichecked:e.target.checked
})
}
render() {
console.log(this.props.data)
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
// console.log(operateauthority)
const {getFieldDecorator} = this.props.form;
const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state;
const {languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
// console.log("1222")
// console.log(choice_standard_scripts)
const {shixun_service_configs}=this.props;
let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false;
const uploadProps = {
width: 600,
fileList,
@ -105,8 +409,12 @@ class Shixuninformation extends Component {
},
}
return (
<div>
<div className="educontent mb50 edu-back-white padding10-20">
<Form>
<Form.Item
label="名称"
@ -148,13 +456,14 @@ class Shixuninformation extends Component {
style={{"borderBottom": 'none'}}
className="chooseDes pr"
>
{getFieldDecorator('select', {
{getFieldDecorator('trainee', {
rules: [{required: true, message: '请选择难易度'}],
})(
<div className="with15 fl pr">
<Select placeholder="请选择难易度"
style={{width: 180}}
onChange={this.Selectthestudent}
value={this.state.trainee}
>
<Option value={1}>初级</Option>
<Option value={2}>中级</Option>
@ -178,18 +487,20 @@ class Shixuninformation extends Component {
rules: [{required: true, message: '请选择主类别'}],
})(
<div className="width100 fl mr20">
<Select placeholder="请选择主类别"
<Select placeholder="请选择主类别" value={this.state.choice_main_type === "" ? undefined : this.state.choice_main_type}
style={{width: 180}}
onChange={this.selectleft}
defaultOpen={false}
onChange={operateauthority?this.bigClass:""}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{
newshixunlist === undefined ? "" : newshixunlist.main_type.map((item, key) => {
this.props.data === undefined ? "" : this.props.data.shixun.main_type.map((item, key) => {
return (
<Option value={item.id} key={key}>
<Tooltip placement="right"
title={item.description === "" ? "无描述" : item.description}>
<Option value={item.id} key={key} >
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} >
{item.type_name}
</Tooltip>
</Option>
@ -214,16 +525,20 @@ class Shixuninformation extends Component {
})(
<div className=" fl pr mr20">
<Select placeholder="请选择小类别"
style={{width: 180}}
mode="multiple"
onChange={this.selectright}
value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type}
style={{width: 180,height:30}}
disabled={operateauthority?false:true}
onDeselect={operateauthority?this.Deselectlittle:""}
onSelect={operateauthority?this.littleClass:""}
defaultOpen={false}
>
{
newshixunlist === undefined ? "" : newshixunlist.small_type.map((item, key) => {
return (
this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => {
return(
<Option value={item.id} key={key}>
<Tooltip placement="right"
title={item.description === "" ? "无描述" : item.description}>
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} >
{item.type_name}
</Tooltip>
</Option>
@ -258,27 +573,70 @@ class Shixuninformation extends Component {
style={{"borderBottom": 'none'}}
className="chooseDes pr"
>
{getFieldDecorator('select', {
{getFieldDecorator('select123', {
rules: [{required: true, message: '请选择评测脚本'}],
})(
<div className="with15 fl pr">
<Select placeholder="请选择评测脚本"
<Select placeholder="请选择选择脚本"
style={{width: 180}}
onChange={this.Selectthestudent}
>
<Option value={1}>初级</Option>
<Option value={2}>中级</Option>
<Option value={3}>中高级</Option>
<Option value={4}>高级</Option>
</Select>
className="fl"
disabled={operateauthority?false:true}
value={choice_standard_scripts === undefined||choice_standard_scripts === null ? undefined :choice_standard_scripts.id===undefined?choice_standard_scripts:choice_standard_scripts.id}
onChange={operateauthority?this.SelectScput:""}>
{
this.props.data === undefined ? "" : this.props.data.shixun.standard_scripts.map((item, key) => {
return (
<Option value={parseInt(item.id)} name={item.scptname} key={key}>{item.scptname}</Option>
)
})
}
</Select>
</div>
)}
<span className="fl ml20 color-blue">
使用自定义脚本
<span className={"color-grey ml10"}>
<span className={"color-grey ml10"} onClick={()=>this.testscripttip(0)}>
<Icon type="exclamation-circle"/>
</span>
<div className="invite-tip clearfix none " id="test_script_tip"
style={{top: '33px', left: '-15px',width: '450px',zIndex: '10',display: this.state.testscripttiptype===true?'block':"none"}}>
<style>
{
`
.top-black-trangle{
right: auto;
left: 0px;
}
`
}
</style>
<span className="top-black-trangle"></span>
<div className="padding20 invitecontent clearfix">
<p className="font-12 edu-txt-left">
使用自定义模板平台无法自动更新脚本请在关卡创建完后手动更新脚本中的必填参<br/>
数和以下2个数组元素<br/>
challengeProgramNames<br/>
sourceClassNames<br/><br/>
示例有2个关卡的实训<br/><br/>
各关卡的待编译文件为<br/>
src/step1/HelloWorld.java<br/>
src/step2/Other.java<br/><br/>
各关卡的编译后生成的执行文件为<br/>
step1.HelloWorld<br/>
step2.Other<br/><br/>
则数组元素更新如下<br/>
challengeProgramNames=("src/step1/<br/>
HelloWorld.java" "src/step2/Other.java")<br/>
sourceClassNames=("step1.HelloWorld<br/>
" "step2.Other")<br/><br/>
其它参数可按实际需求定制
</p>
</div>
<p className="inviteTipbtn with100 fl">
<a onClick={()=>this.testscripttip(1)}>知道了</a>
</p>
</div>
</span>
</Form.Item>
@ -290,7 +648,7 @@ class Shixuninformation extends Component {
<div className="fl" style={{border: '1px solid #ccc'}}>
<MonacoEditor
height="450"
width="1100"
width="1150"
language={this.state.language}
value={shixunmemoMDvalue}
options={{
@ -306,7 +664,7 @@ class Shixuninformation extends Component {
<span className="ant-form-text mt20" >私密版本库
<Checkbox>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
<Checkbox onChange={this.simionChange} value={this.state.simichecked}>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
</span>
{this.props.identity<3?<div className="edu-back-white padding40-20 mb20">
@ -371,6 +729,38 @@ class Shixuninformation extends Component {
}
</style> : ""}
<Modal
keyboard={false}
title="提示"
visible={this.state.standard_scriptsModal}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16">原有脚本将被新的脚本覆盖无法撤销</p>
<p className="task-popup-text-center font-16">是否确认执行覆盖操作</p>
</div>
<div className="task-popup-submit clearfix mt10">
<a onClick={()=>this.hidestandard_scriptsModal()} className="task-btn fl">取消</a>
<a className="task-btn task-btn-orange fr" onClick={()=>this.get_mirror_script()}>确定</a>
</div>
</Modal>
<Modal
keyboard={false}
title="提示"
visible={this.state.standard_scriptsModals}
closable={false}
footer={null}
>
<div className="task-popup-content"><p className="task-popup-text-center font-16">评测脚本生成成功</p></div>
<div className="task-popup-sure clearfix">
<a className="task-btn task-btn-orange" onClick={()=>this.hidestandard_scriptsModal()} >确定</a>
</div>
</Modal>
<Modal
keyboard={false}
title="申请新建"
@ -449,30 +839,10 @@ class Shixuninformation extends Component {
</div>
{/*</Form>*/}
</Modal>
<Modal
keyboard={false}
title="提示"
visible={postapplytitle}
closable={false}
footer={null}
>
<div>
<div className="task-popup-content"><p
className="task-popup-text-center font-16"><span
className="font-17 mt10">新建申请已提交请等待管理员的审核</span></p>
<li className="font-14 mt15 color-grey-6 edu-txt-center">我们将在1-2个工作日内与您联系
</li>
</div>
<div className="task-popup-OK clearfix">
<a className="task-btn task-btn-orange"
onClick={this.yeshidemodel}>知道啦</a>
<Bottomsubmit url={`/shixuns/${this.props.match.params.shixunId}/challenges`} onSubmits={ this.sendsure_apply}/>
</div>
</div>
</Modal>
</div>
);
}
}

@ -11,17 +11,10 @@ import Configuration from './Configuration';
import LearningSettings from './LearningSettings';
import Bottomsubmit from "../../modals/Bottomsubmit";
import moment from 'moment';
import axios from 'axios';
import './css/TPMsettings.css';
import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
const {TabPane} = Tabs;
// 处理整点 半点
@ -90,11 +83,23 @@ export default class TPMsettings extends Component {
render() {
return (
<div>
<div className="educontent mt30 mb50 edu-back-white padding10-20">
<div>
<style>
{
`
.ant-tabs-bar{
width: 1200px;
margin: 0 auto;
background: #fff;
border-bottom: 0px;
margin-top: 30px!important;
}
`
}
</style>
<Tabs tabBarExtraContent={
<div className={"mb20"}>
<div className={"mb20 mr20"}>
<Button type="primary" ghost className={"Permanentban"}>
永久关闭
</Button>
@ -124,9 +129,6 @@ export default class TPMsettings extends Component {
</Tabs>
</div>
<Bottomsubmit/>
</div>
);
}
}

@ -5,7 +5,7 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom";
class TPMNav extends Component {
render() {
const { user, match, shixun, secret_repository } = this.props;
const { user, match, shixun, secret_repository,is_jupyter} = this.props;
let isAdminOrCreator = false;
if (user) {
isAdminOrCreator = user.admin || user.manager
@ -15,6 +15,8 @@ class TPMNav extends Component {
// console.log(this.props.propaedeutics)
const challengesPath = `/shixuns/${shixunId}/challenges`;
// console.log(match.path)
// console.log("TPMNavTPMNavTPMNav");
// console.log(is_jupyter);
return (
<div className="bor-bottom-greyE clearfix pl20 pr20 pt40 pb20 edu-back-white challengeNav">
<Link
@ -28,8 +30,15 @@ class TPMNav extends Component {
>背景知识</Link>
}
{ this.props.identity >4||this.props.identity===undefined ?"":<Link to={`/shixuns/${shixunId}/repository`}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>}
{ this.props.identity >4||this.props.identity===undefined ?"":
(this.props.is_jupyter===false?
<Link to={`/shixuns/${shixunId}/repository`}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>
:"")
}
{this.props.identity >4||this.props.identity===undefined ?"": secret_repository && <Link to={`/shixuns/${shixunId}/secret_repository`}
className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>}
@ -37,8 +46,13 @@ class TPMNav extends Component {
className={`${match.url.indexOf('collaborators') != -1 ? 'active' : ''} fl mr40`}>合作者</Link>
{/*jupyter*/}
{
this.props.is_jupyter===true?
<Link to={`/shixuns/${shixunId}/dataset`}
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link>
:""
}
<Link to={`/shixuns/${shixunId}/shixun_discuss`}
className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link>

@ -265,7 +265,7 @@ class Newshixuns extends Component {
{
message: '提示',
description:
'提交成功!',
'新建申请已提交,请等待管理员审核。',
}
)
@ -589,10 +589,12 @@ class Newshixuns extends Component {
)}
<span className="fl ml20 color-grey lineh-20">
<div>
{this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" :
{this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
<div className={"font-12"} style={{'max-width':'700px'}}>
{`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`}
{` 说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`}
{`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`已安装软件:`+this.state.mainvalues}`}
{`${this.state.subvalues===undefined||this.state.subvalues=== ""?"":this.state.mainvalues===undefined||this.state.mainvalues=== ""?`已安装软件:`+this.state.subvalues:this.state.subvalues}`}
{`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`说明:添加了`+this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues=== ""?"":
this.state.mainvalues===undefined||this.state.mainvalues=== ""?`说明:添加了`+this.state.subvalues:this.state.subvalues}`}
</div>}
</div>
@ -697,27 +699,6 @@ class Newshixuns extends Component {
{/*</Form>*/}
</Modal>
<Modal
keyboard={false}
title="提示"
visible={postapplytitle}
closable={false}
footer={null}
>
<div>
<div className="task-popup-content"><p
className="task-popup-text-center font-16"><span
className="font-17 mt10">新建申请已提交请等待管理员的审核</span></p>
<li className="font-14 mt15 color-grey-6 edu-txt-center">我们将在1-2个工作日内与您联系
</li>
</div>
<div className="task-popup-OK clearfix">
<a className="task-btn task-btn-orange"
onClick={this.yeshidemodel}>知道啦</a>
</div>
</div>
</Modal>
</div>
</div>

@ -60,12 +60,37 @@ class Challengesjupyter extends Component {
componentDidMount() {
setTimeout(this.ChallengesList(), 1000);
// console.log("componentDidMount");
// console.log("Challengesjupyter");
// console.log(this.props);
let id = this.props.match.params.shixunId;
let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
let datas={
identifier:id,
}
axios.get(ChallengesURL, {params: datas}).then((response) => {
debugger
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
console.log("componentDidMount");
console.log("Challengesjupyter");
console.log(this.props);
}else{
// console.log("componentDidMountChallengesjupyter");
// console.log(response.data);
debugger
if(response.data.status===0){
this.setState({
jupyter_url:response.data.url,
jupyter_port:response.data.port,
})
}else{
}
}
}).catch((error) => {
console.log(error)
});
}
@ -121,19 +146,25 @@ class Challengesjupyter extends Component {
};
modifyjupyter=(propsysl)=>{
console.log("propsysl");
console.log(propsysl);
modifyjupyter=()=>{
// console.log("propsysl");
// console.log(propsysl);
let id=this.props.match.params.shixunId;
var jupyter_port="";
try{
jupyter_port= parseInt(this.state.jupyter_port);
}catch (e) {
jupyter_port=this.state.jupyter_port;
const url=`/shixuns/${id}/update_jupyter.json`;
}
const url=`/jupyters/save_with_tpm.json`;
const data={
identifier:id,
jupyter_port:propsysl.shixunsDetails.jupyter_port
jupyter_port:jupyter_port,
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
if (result.data.status === 0) {
this.props.showNotification(`应用成功`);
}
}).catch((error) => {
@ -221,13 +252,22 @@ class Challengesjupyter extends Component {
`
}
</style>
{
this.state.jupyter_url === null || this.state.jupyter_url === undefined ?
""
:
<div className="sortinxdirection mt60">
<div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdivtest ml24"></p></div>
<div><p className="renwuxiangqdiv">任务详情</p></div>
<div><p className="renwuxiangqdivtest ml24">请将实训题目写在下方</p></div>
</div>
<div className="renwuxiangssit xaxisreverseorder">
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p
className="challenbaocuntest">应用到实训</p></div>
</div>
<div className="renwuxiangssit xaxisreverseorder"><div className="challenbaocun" onClick={()=>this.modifyjupyter(this.props)}><p className="challenbaocuntest">应用到实训</p></div></div>
</div>
}
<style>
{
`
@ -254,18 +294,13 @@ class Challengesjupyter extends Component {
<div className="pb47">
{
this.props.shixunsDetails===null || this.props.shixunsDetails===undefined||JSON.stringify(this.props.shixunsDetails)==="{}"?
this.state.jupyter_url===null || this.state.jupyter_url===undefined?
""
:
(
this.props&&this.props.shixunsDetails&&this.props.shixunsDetails.jupyter_url?
<iframe src={this.props.shixunsDetails.jupyter_url}
<iframe src={this.state.jupyter_url}
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0"
></iframe>
:""
)
}
</div>
</div>

@ -3,6 +3,11 @@
line-height: 30px;
}
.height28 {
height: 30px;
line-height:28px;
}
.line27{
line-height: 27px;
vertical-align: 1px;

@ -457,7 +457,7 @@ class Collaborators extends Component {
style={{display:this.props.identity<5?"flex":"none"}}
>
<div className="yslwushiwidth">
<p className="edu-default-btn edu-greenback-btn ml20 height40 yslwushiwidthcolortest">共12</p>
<p className="edu-default-btn edu-greenback-btn ml20 height28 yslwushiwidthcolortest">{collaboratorList&&collaboratorList.length}</p>
</div>
<div className="yslwushiwidth xaxisreverseorder">
@ -469,7 +469,13 @@ class Collaborators extends Component {
<a onClick={() => this.showCollaboratorsvisible("admin")}
style={{display:this.props.identity===1?"flex":"none"}}
data-remote="true"
className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton">更换管理员</a>
className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton">
<p style={{
textAlign: "center",
width:'100%',
lineHeight: "29px",
}}>更换管理员</p>
</a>
</div>

@ -67,6 +67,7 @@ class TPMRepositoryCommits extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
{ loadingContent ?
<CircularProgress size={40} thickness={3}

@ -52,8 +52,6 @@
width:32px;
height:30px;
font-size:16px;
font-family:MicrosoftYaHei;
color:#4CACFF;
line-height:30px;
}

Loading…
Cancel
Save