From f90d58f5b391e38b229ed84784de07bce7ec04d0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Dec 2019 15:03:47 +0800 Subject: [PATCH 01/56] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E4=BC=98=E5=8C=962.0=E3=80=81=E8=B6=85=E7=AE=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 3 +- app/helpers/application_helper.rb | 2 +- app/models/shixun.rb | 13 ++++ app/queries/admins/shixun_query.rb | 10 ++++ app/services/shixun_search_service.rb | 8 ++- app/services/users/shixun_service.rb | 19 +++--- app/views/admins/shixuns/index.html.erb | 59 ++++++++++++------- .../admins/shixuns/shared/_list.html.erb | 14 +++-- ...19060435_add_fork_reason_to_shixun_info.rb | 5 ++ 9 files changed, 94 insertions(+), 39 deletions(-) create mode 100644 db/migrate/20191219060435_add_fork_reason_to_shixun_info.rb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index aa25d0875..960d56a40 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -215,7 +215,8 @@ class ShixunsController < ApplicationController if @shixun.shixun_info.present? ShixunInfo.create!(shixun_id: @new_shixun.id, description: @shixun.description, - evaluate_script: @shixun.evaluate_script) + evaluate_script: @shixun.evaluate_script, + shixun_reason: params[:reason].to_s.strip) end # 同步私密版本库 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cabf8d244..40e6cb365 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -64,7 +64,7 @@ module ApplicationHelper shixun_id = shixun_id.blank? ? -1 : shixun_id.join(",") Shixun.select([:id, :name, :user_id, :challenges_count, :myshixuns_count, :trainee, :identifier]).where("id - in(#{shixun_id})").unhidden.order("homepage_show asc, myshixuns_count desc").limit(3) + in(#{shixun_id})").unhidden.publiced.order("homepage_show asc, myshixuns_count desc").limit(3) end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index de014f87b..9522c54da 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -103,6 +103,19 @@ class Shixun < ApplicationRecord shixun_info.try(:evaluate_script) end + def fork_reason + case shixun_info.try(:fork_reason) + when 'Shixun' + '实训内容升级' + when 'Course' + '课堂教学使用' + when 'Subject' + '实践课程使用' + else + shixun_info.try(:fork_reason) + end + end + def fork_identifier self.fork_from.nil? ? "--" : fork_shixuns.first&.identifier end diff --git a/app/queries/admins/shixun_query.rb b/app/queries/admins/shixun_query.rb index 0f8523599..4f9f4676e 100644 --- a/app/queries/admins/shixun_query.rb +++ b/app/queries/admins/shixun_query.rb @@ -33,6 +33,16 @@ class Admins::ShixunQuery < ApplicationQuery all_shixuns = all_shixuns.where(status: status) if status.present? all_shixuns = all_shixuns.where(public: public) if public.present? + if params[:fork_status].present? + all_shixuns = all_shixuns.where.not(fork_from: nil) + case params[:fork_status] + when 'Shixun', 'Course', 'Subject' + all_shixuns = all_shixuns.joins(:shixun_info).where(shixun_infos: {fork_reason: params[:fork_status]}) + when 'Other' + all_shixuns = all_shixuns.joins(:shixun_info).where("fork_reason is null or fork_reason not in ('Shixun', 'Course', 'Subject')") + end + end + if params[:tag].present? all_shixuns = all_shixuns.joins(:mirror_repositories).where("mirror_repositories.id = ?",params[:tag].to_i) end diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index f5af69179..248d7d176 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -49,12 +49,16 @@ class ShixunSearchService < ApplicationService includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ] } model_options.merge!(where: { id: @shixuns.pluck(:id) }) - model_options.merge!(order: {"myshixuns_count" => sort_str}) + model_options.merge!(order: {sort_str => order_str}) model_options.merge!(default_options) model_options end - def sort_str + def order_str params[:order] || "desc" end + + def sort_str + params[:sort] || "myshixuns_count" + end end \ No newline at end of file diff --git a/app/services/users/shixun_service.rb b/app/services/users/shixun_service.rb index 279d147f4..b13b0ab1f 100644 --- a/app/services/users/shixun_service.rb +++ b/app/services/users/shixun_service.rb @@ -65,13 +65,18 @@ class Users::ShixunService end def manage_shixun_status_filter(relations) - status = case params[:status] - when 'editing' then 0 - when 'applying' then 1 - when 'published' then 2 - when 'closed' then 3 - end - relations = relations.where(status: status) if status + if params[:status] == "publiced" + relations = relations.where(public: 2) + elsif params[:status] == "applying" + relations = relations.where(public: 1) + else + status = case params[:status] + when 'editing' then 0 + when 'published' then 2 + when 'closed' then 3 + end + relations = relations.where(status: status) if status + end relations end diff --git a/app/views/admins/shixuns/index.html.erb b/app/views/admins/shixuns/index.html.erb index d04257927..9bb09f86f 100644 --- a/app/views/admins/shixuns/index.html.erb +++ b/app/views/admins/shixuns/index.html.erb @@ -4,33 +4,48 @@
<%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',id:"shixuns-search-form",remote:true) do %> -
- - <% status_options = [['全部', ''], ["编辑中(#{@editing_shixuns})", "editing"], ["待审核(#{@pending_shixuns})", 'pending'], ["已发布(#{@processed_shixuns})", 'processed'],["已关闭(#{@closed_shixuns})",'closed']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
+
+
+
+ + <% status_options = [['全部', ''], ["编辑中(#{@editing_shixuns})", "editing"], ["待审核(#{@pending_shixuns})", 'pending'], ["已发布(#{@processed_shixuns})", 'processed'],["已关闭(#{@closed_shixuns})",'closed']] %> + <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> +
-
- - <% public_options = [['全部', ''], ["未公开(#{@none_public_shixuns})", "editing"], ["待审核(#{@pending_public_shixuns})", 'pending'], ["已公开(#{@processed_pubic_shixuns})", 'processed']] %> - <%= select_tag(:public, options_for_select(public_options), class: 'form-control') %> -
+
+ + <% public_options = [['全部', ''], ["未公开(#{@none_public_shixuns})", "editing"], ["待审核(#{@pending_public_shixuns})", 'pending'], ["已公开(#{@processed_pubic_shixuns})", 'processed']] %> + <%= select_tag(:public, options_for_select(public_options), class: 'form-control') %> +
-
- - <%= select_tag(:tag, options_for_select(@shixuns_type_check.unshift(["",nil])), class: 'form-control',id:"tag-choosed") %> -
+
+ + <%= select_tag(:tag, options_for_select(@shixuns_type_check.unshift(["",nil])), class: 'form-control',id:"tag-choosed") %> +
+ +
+ + <% auto_trial_options = [['创建者姓名', 0], ['实训名称', 1], ['学校名称', 2]] %> + <%= select_tag(:search_type, options_for_select(auto_trial_options), class: 'form-control') %> +
+ <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %> +
+ 导出 +
+
+ +
+
+ + <% fork_status_options = [['全部', ''], ["全部fork实训", "Fork"], ["实训内容升级", 'Shixun'], ["课堂教学使用", 'Course'],["实践课程使用",'Subject'],["其他原因",'Other']] %> + <%= select_tag(:fork_status, options_for_select(fork_status_options), class: 'form-control') %> +
-
- - <% auto_trial_options = [['创建者姓名', 0], ['实训名称', 1], ['学校名称', 2]] %> - <%= select_tag(:search_type, options_for_select(auto_trial_options), class: 'form-control') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %> + <%= link_to "清除", admins_shixuns_path,class: "btn btn-default",id:"shixuns-clear-search",'data-disable-with': '清除中...' %> +
- <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2', placeholder: '输入关键字搜索') %> - <%= submit_tag('搜索', class: 'btn btn-primary','data-disable-with': '搜索中...') %> - <%= link_to "清除", admins_shixuns_path,class: "btn btn-default",id:"shixuns-clear-search",'data-disable-with': '清除中...' %> <% end %> - 导出
diff --git a/app/views/admins/shixuns/shared/_list.html.erb b/app/views/admins/shixuns/shared/_list.html.erb index 9ee44ece3..b0a0c715d 100644 --- a/app/views/admins/shixuns/shared/_list.html.erb +++ b/app/views/admins/shixuns/shared/_list.html.erb @@ -2,17 +2,18 @@ 序号 ID - 实训名称 + 实训名称 技术平台 Fork源 + Fork原因 实践 - 选择 + 选择 状态 公开 - 创建者 - <%= sort_tag('创建于', name: 'created_at', path: admins_shixuns_path) %> - 单测 - 操作 + 创建者 + <%= sort_tag('创建于', name: 'created_at', path: admins_shixuns_path) %> + 单测 + 操作 <% if shixuns.present? %> @@ -31,6 +32,7 @@ <%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%> <% end%> + <%= overflow_hidden_span(shixun&.fork_reason) %> <%= shixun.challenges.where(:st => 0).size %> <%= shixun.challenges.where(:st => 1).size %> <%= shixun_authentication_status shixun %> diff --git a/db/migrate/20191219060435_add_fork_reason_to_shixun_info.rb b/db/migrate/20191219060435_add_fork_reason_to_shixun_info.rb new file mode 100644 index 000000000..8a1446d54 --- /dev/null +++ b/db/migrate/20191219060435_add_fork_reason_to_shixun_info.rb @@ -0,0 +1,5 @@ +class AddForkReasonToShixunInfo < ActiveRecord::Migration[5.2] + def change + add_column :shixun_infos, :fork_reason, :string + end +end From f06d9da36384222e5880ab0656503f0227cf77bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 09:20:55 +0800 Subject: [PATCH 02/56] =?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/paths/PathDetail/Addshixuns.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/Addshixuns.js b/public/react/src/modules/paths/PathDetail/Addshixuns.js index 9e7766e32..a4819ed76 100644 --- a/public/react/src/modules/paths/PathDetail/Addshixuns.js +++ b/public/react/src/modules/paths/PathDetail/Addshixuns.js @@ -93,14 +93,14 @@ class Addshixuns extends Component { :""}
-
- - - 普通实训 - jupyter实训 - - -
+ {/*
*/} + {/* */} + {/* */} + {/* 普通实训*/} + {/* jupyter实训*/} + {/* */} + {/* */} + {/*
*/}

实训名称: From 09539a843dee415dcdcfc75008ffaae418719dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 23 Dec 2019 10:09:35 +0800 Subject: [PATCH 03/56] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/shixunHomework/Listofworksstudentone.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 03bf13f13..459421dcd 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1748,10 +1748,11 @@ class Listofworksstudentone extends Component { } catch (e) { } - + // console.log("table1handleChange"); + // console.log(sorter.columnKey); try { //学生成绩排序 - if (sorter.columnKey === "finalscore") { + if (sorter.columnKey === "work_score") { if (sorter.order === "ascend") { //升序 this.setState({ From 3669839afc8ffb669c121b8d01f2fa4bf6dcd34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 10:44:10 +0800 Subject: [PATCH 04/56] =?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/user/usersInfo/InfosShixun.js | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 4816b4ca6..1868d9f5f 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -214,12 +214,12 @@ class InfosShixun extends Component{

  • this.changeCategory()} className="font-16 w32">全部
  • + onClick={() => this.changeCategory()} className="font-16 w32">全部
  • this.changeCategory("manage")} + onClick={() => this.changeCategory("manage")} className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}管理的
  • this.changeCategory("study")} + onClick={() => this.changeCategory("study")} className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的
  • -

    - - 上传文件

    +
    + + +
    { data_sets_count>0?
    Date: Mon, 23 Dec 2019 13:06:15 +0800 Subject: [PATCH 14/56] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/jupyter/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index ad62d249c..cdaee96bb 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -325,13 +325,13 @@ function JupyterTPI (props) {

    - {/* sync | poweroff */} - {/*重置实训*/} + {/*sync | poweroff */} + + {/*重置实训*/} +

    { data_sets_count>0? From 111cca2965ec29d9dd8c959f502115ebc7822498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 14:14:39 +0800 Subject: [PATCH 19/56] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMDataset.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index ecd004a92..fca56b93d 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -311,7 +311,9 @@ class TPMDataset extends Component { //done 成功就会调用这个方法 if(info.file.response){ if(info.file.response.status===-1||info.file.response.status==="-1"){ - + this.setState({ + Buttonloading:false + }) }else{ this.getdatas(); this.setState({ @@ -320,6 +322,10 @@ class TPMDataset extends Component { // this.props.showNotification(`上传成功`); } } + }else{ + this.setState({ + Buttonloading:false + }) } if(info.file.response){ From c1bb93043a162ece442a0c01e446c37648e89012 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 14:18:10 +0800 Subject: [PATCH 20/56] =?UTF-8?q?Jupyter=E6=8F=90=E7=A4=BA=E8=AF=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 2 +- app/controllers/shixuns_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d55eb9211..a5cb1ece3 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -103,7 +103,7 @@ class GamesController < ApplicationController begin @tpm_modified = @myshixun.repository_is_modified(@shixun.repo_path) # 判断TPM和TPI的版本库是否被改了 rescue - uid_logger("实训平台繁忙,繁忙等级(81)") + uid_logger("服务器出现问题,请重置刷新页面") end end diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 7c5964962..81d6dbce5 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -781,7 +781,7 @@ class ShixunsController < ApplicationController end rescue => e uid_logger_error(e.message) - tip_exception("#{e.message}") + tip_exception("服务器出现问题,请重置环境") end end From 49c76d14626d893643a52f7268263bcb327c0abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 14:29:13 +0800 Subject: [PATCH 21/56] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMDataset.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index fca56b93d..1cb64df36 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -300,6 +300,11 @@ class TPMDataset extends Component { this.setState({ Buttonloading:true }) + if(!info.file.status){ + this.setState({ + Buttonloading:false + }) + } if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){ let fileList = info.fileList; @@ -323,9 +328,9 @@ class TPMDataset extends Component { } } }else{ - this.setState({ - Buttonloading:false - }) + // this.setState({ + // Buttonloading:false + // }) } if(info.file.response){ @@ -465,9 +470,9 @@ class TPMDataset extends Component { } ButtonloadinghandleChange=()=>{ // this.props.showNotification(`zhzzzzz`); - this.setState({ - Buttonloading:false - }) + // this.setState({ + // Buttonloading:false + // }) } render() { const {tpmLoading, shixun, user, match} = this.props; @@ -495,12 +500,11 @@ class TPMDataset extends Component { onRemove: this.onAttachmentRemove, beforeUpload: (file) => { //上传前的操作 - // console.log('beforeUpload', file.name); + console.log('beforeUpload', file); // this.props.showNotification(`文件上传中`); - const isLt400M = file.size / 1024 / 1024 <= 400; + const isLt400M = file.size / 1024 / 1024 <= 1; if (!isLt400M) { - this.ButtonloadinghandleChange this.props.showNotification('文件大小必须小于等于400MB!'); } return isLt400M; From 6775a59d6ee661b7d4f65456b4ef0675d5f13bbf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 14:37:03 +0800 Subject: [PATCH 22/56] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0jupyter=E5=AE=9E=E8=AE=AD=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=89=93=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 6a9438a79..c8f2f5f57 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -214,7 +214,15 @@ class SubjectsController < ApplicationController GitService.add_repository(repo_path: repo_path) # todo: 为什么保存的时候要去除后面的.git呢?? @shixun.update_column(:repo_name, repo_path.split(".")[0]) - mirror_id = MirrorRepository.find_by(type_name: 'Python3.6')&.id + mirror_id = + if @shixun.is_jupyter? + MirrorRepository.where("type_name like '%Jupyter%'").first&.id + folder = EduSetting.get('shixun_folder') + path = "#{folder}/#{identifier}" + FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path) + else + MirrorRepository.find_by(type_name: 'Python3.6')&.id + end if mirror_id ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id) @shixun.shixun_service_configs.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id) From 032ba7f7a62b90f9d7eb6a99a2c5f2153f094330 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 14:40:25 +0800 Subject: [PATCH 23/56] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/discuss.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/discuss.rb b/app/models/discuss.rb index a50b18a6f..e8fee2ed1 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -10,7 +10,7 @@ class Discuss < ApplicationRecord has_one :praise_tread_cache, as: :object, dependent: :destroy belongs_to :dis, polymorphic: true - belongs_to :challenge + belongs_to :challenge, optional: true after_create :send_tiding scope :children, -> (discuss_id){ where(parent_id: discuss_id).includes(:user).reorder(created_at: :asc) } From 3dd6234a0a11db7dbb63e1325efb02031d13f8de Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 14:46:09 +0800 Subject: [PATCH 24/56] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/discuss.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/discuss.rb b/app/models/discuss.rb index e8fee2ed1..652ffea37 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -54,9 +54,14 @@ class Discuss < ApplicationRecord def send_tiding base_attrs = { trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: 'Challenge', - belong_container_id: dis_id, belong_container_type: 'Shixun', viewed: 0, tiding_type: 'Comment' + belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment' } - user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id + user_id = + if dis_type == 'Shixun' + has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id + elsif dis_type == 'Hack' + has_parent? ? parent.user_id : Hack.find(dis_id).user_id + end tidings.create!(base_attrs.merge(user_id: user_id)) end end From 706b8e5f46e98675dcbd19b4d8b6304ff86929a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 15:07:30 +0800 Subject: [PATCH 25/56] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- public/react/src/modules/tpm/TPMDataset.js | 2 +- public/react/src/modules/tpm/TPMIndex.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index acd18e6c3..0356f25f1 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -35,7 +35,7 @@ if (isDev) { // 老师 //ebugType="teacher"; // 学生 -// debugType="student"; +//debugType="student"; window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index 1cb64df36..b70bc457c 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -502,7 +502,7 @@ class TPMDataset extends Component { //上传前的操作 console.log('beforeUpload', file); // this.props.showNotification(`文件上传中`); - const isLt400M = file.size / 1024 / 1024 <= 1; + const isLt400M = file.size / 1024 / 1024 <= 400; if (!isLt400M) { this.props.showNotification('文件大小必须小于等于400MB!'); diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index c44d8ce51..a8e869a3c 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -412,7 +412,7 @@ class TPMIndex extends Component { 合作者 - { this.state.is_jupyter===true? + { this.state.identity >4||this.state.identity===undefined ? "":this.state.is_jupyter===true? 数据集 :""} From 9767e87d631b481102507e86d96df2f92c02f04d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 15:11:11 +0800 Subject: [PATCH 26/56] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/comments/_discuss.json.jbuilder | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/comments/_discuss.json.jbuilder b/app/views/comments/_discuss.json.jbuilder index e9f983a47..b634b20a8 100644 --- a/app/views/comments/_discuss.json.jbuilder +++ b/app/views/comments/_discuss.json.jbuilder @@ -1,3 +1,6 @@ +json.author do + json.partial! 'users/user', user: discuss.user +end json.id discuss.id json.content content_safe(discuss.content) json.time time_from_now(discuss.created_at) From 4d5f902f1cc3a6a3c2f4773da13e689d1fa396b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 15:46:46 +0800 Subject: [PATCH 27/56] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E7=AD=9B=E9=80=89=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/coursesPublic/NewShixunModel.js | 12 ++++++++++-- .../src/modules/paths/PathDetail/DetailCards.js | 1 + .../react/src/modules/paths/PathDetail/DetailTop.js | 4 ---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js index 5ee763951..1f7518a9d 100644 --- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js +++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js @@ -25,8 +25,15 @@ class NewShixunModel extends Component{ } componentDidMount() { let{page,type,keyword,order,diff,limit,status,sort}=this.state; + let newsort=sort + if(this.props&&this.props.user.course_name===undefined){ + newsort="created_at"; + }else{ + newsort="publish_time"; + } + if(this.props.type==='shixuns'){ - this.getdatalist(page,type,status,keyword,order,diff,limit) + this.getdatalist(page,type,status,keyword,order,diff,limit,undefined,newsort); }else{ this.getdatalist(page,type,undefined,keyword,order,undefined,limit,undefined,sort); } @@ -34,6 +41,7 @@ class NewShixunModel extends Component{ } getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{ + this.setState({ isspinning:true }) @@ -368,6 +376,7 @@ class NewShixunModel extends Component{ // let {visible,patheditarry}=this.props; // console.log(Grouplist) // console.log(allGrouplist) + const statusmenus=( @@ -425,7 +434,6 @@ class NewShixunModel extends Component{ ); - console.log(shixun_list) return(
    diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 006cb3179..35efec643 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -574,6 +574,7 @@ class DetailCards extends Component{
    } Date: Mon, 23 Dec 2019 15:55:39 +0800 Subject: [PATCH 28/56] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 73756ece3..10ae90fde 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -69,7 +69,9 @@ Rails.application.routes.draw do delete :delete_set end resources :comments do - post :reply + collection do + post :reply + end end end From dbbcfcc332ec3ad5c702031beccea104b4985c06 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 23 Dec 2019 17:10:46 +0800 Subject: [PATCH 29/56] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/migrate_course_student.rake | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/tasks/migrate_course_student.rake diff --git a/lib/tasks/migrate_course_student.rake b/lib/tasks/migrate_course_student.rake new file mode 100644 index 000000000..913cb2562 --- /dev/null +++ b/lib/tasks/migrate_course_student.rake @@ -0,0 +1,32 @@ +# 执行示例 RAILS_ENV=production bundle exec rake migrate_course_student:student args=3835,2526,21950,1000 +# args 第一个课程 course_id,第二个参数是学校school_id,第三个参数是部门id,第四个参数是迁移数量 +# + +desc "同步学校的学生" +namespace :migrate_course_student do + if ENV['args'] + course_id = ENV['args'].split(",")[0] # 对应课堂的id + school_id = ENV['args'].split(",")[1] # 对应学校id + department_id = ENV['args'].split(",")[2] # 对应部门id + limit = ENV['args'].split(",")[3] # 限制导入的数量 + end + + task :student => :environment do + course = Course.find course_id + users = User.joins(:user_extension).where(user_extensions: {school_id: school_id, department_id: department_id, identity: 1}).limit(limit) + user_ids = [] + + users.each do |user| + if user.student_id.present? && !course.students.exists?(user_id: user.id) + begin + CourseMember.create!(course_id: course_id, user_id: user.id, role: 4) + user_ids << user.id + rescue Exception => e + Rails.logger(e.message) + end + end + end + CourseAddStudentCreateWorksJob.perform_later(course_id, user_ids) + + end +end \ No newline at end of file From e972dd939a2f79ef19596b0ad1896f45a5e98f6f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 23 Dec 2019 18:12:20 +0800 Subject: [PATCH 30/56] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/excellent_course_exercise.rake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index e05a813f4..c3700957c 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -36,14 +36,15 @@ namespace :excellent_course_exercise do # index < pass_count 之前的学生都是通关的,之后的未通过 members.each_with_index do |member, index| exercise_user = exercise.exercise_users.where(user_id: member.user_id).take - if exercise_question_ids.length == 20 + question_length = exercise_question_ids.length + if question_length == 20 rand_num = index < pass_count - 1 ? rand(15..20) : rand(1..10) - elsif exercise_question_ids.length == 17 + elsif question_length == 17 rand_num = index < pass_count - 1 ? rand(12..17) : rand(1..9) - elsif exercise_question_ids.length == 39 + elsif question_length == 39 rand_num = index < pass_count - 1 ? rand(30..39) : rand(1..18) else - rand_num = exercise_question_ids.length + rand_num = index < pass_count - 1 ? rand((question_length-3)..question_length) : rand(1..(question_length-8)) end if exercise_user && exercise_user.commit_status == 0 From 15753532fbbc7333c7022c77c46b5de17fc1f387 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 23 Dec 2019 18:22:11 +0800 Subject: [PATCH 31/56] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/excellent_course_exercise.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index c3700957c..a8f860c2d 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -14,19 +14,19 @@ namespace :excellent_course_exercise do course = Course.find_by(id: course_id) course.exercises.each_with_index do |exercise, index| - # if exercise.exercise_users.where(commit_status: 1).count == 0 + if exercise.exercise_users.where(commit_status: 1).count == 0 # 第一个试卷的参与人数和通过人数都是传的数据,后续的随机 if index == 0 members = course.students.order("id asc").limit(participant_count) update_exercise_user(exercise, members, pass_count) else - new_participant_count = rand((participant_count - 423)..participant_count) - new_pass_count = rand((new_participant_count - 113)..new_participant_count) + new_participant_count = rand((participant_count - 20)..participant_count) + new_pass_count = rand((new_participant_count - 30)..new_participant_count) members = course.students.order("id asc").limit(new_participant_count) update_exercise_user(exercise, members, new_pass_count) end - # end + end end end From 69f7c8cc25c095e3e33bc6f9a0c0b733d4cc0583 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 19:40:02 +0800 Subject: [PATCH 32/56] =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/comments_controller.rb | 2 +- .../20191223113620_modify_task_pass_for_challenges.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20191223113620_modify_task_pass_for_challenges.rb diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 851567c92..474132903 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -22,7 +22,7 @@ class CommentsController < ApplicationController @discuss = @hack.discusses.new(reply_params) @discuss.hidden = false @discuss.user_id = current_user.id - @discuss.root_id = params[:parent_id] + @discuss.root_id = params[:comments][:parent_id] @discuss.save! rescue Exception => e uid_logger_error("reply discuss failed : #{e.message}") diff --git a/db/migrate/20191223113620_modify_task_pass_for_challenges.rb b/db/migrate/20191223113620_modify_task_pass_for_challenges.rb new file mode 100644 index 000000000..097892ac5 --- /dev/null +++ b/db/migrate/20191223113620_modify_task_pass_for_challenges.rb @@ -0,0 +1,6 @@ +class ModifyTaskPassForChallenges < ActiveRecord::Migration[5.2] + def change + challenge = Challenge.find(6917) + challenge.update_attribute(:task_pass, challenge.gsub(" ", "").gsub("rac", "\frac")) + end +end From d03c8d469f4b4d4c4eb85f33e3c09f3abde32fc4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 19:41:08 +0800 Subject: [PATCH 33/56] =?UTF-8?q?=E8=BF=87=E5=85=B3=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/comments_controller.rb | 2 +- db/migrate/20191223113620_modify_task_pass_for_challenges.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 474132903..851567c92 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -22,7 +22,7 @@ class CommentsController < ApplicationController @discuss = @hack.discusses.new(reply_params) @discuss.hidden = false @discuss.user_id = current_user.id - @discuss.root_id = params[:comments][:parent_id] + @discuss.root_id = params[:parent_id] @discuss.save! rescue Exception => e uid_logger_error("reply discuss failed : #{e.message}") diff --git a/db/migrate/20191223113620_modify_task_pass_for_challenges.rb b/db/migrate/20191223113620_modify_task_pass_for_challenges.rb index 097892ac5..cfcb77fc7 100644 --- a/db/migrate/20191223113620_modify_task_pass_for_challenges.rb +++ b/db/migrate/20191223113620_modify_task_pass_for_challenges.rb @@ -1,6 +1,6 @@ class ModifyTaskPassForChallenges < ActiveRecord::Migration[5.2] def change challenge = Challenge.find(6917) - challenge.update_attribute(:task_pass, challenge.gsub(" ", "").gsub("rac", "\frac")) + challenge.update_attribute(:task_pass, challenge.task_pass.gsub(" ", "").gsub("rac", "\frac")) end end From e5e24d545521de2dd6582f96bd703a1e2714796d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 19:43:09 +0800 Subject: [PATCH 34/56] 1 --- db/migrate/20191223113620_modify_task_pass_for_challenges.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/migrate/20191223113620_modify_task_pass_for_challenges.rb b/db/migrate/20191223113620_modify_task_pass_for_challenges.rb index cfcb77fc7..f0d04f964 100644 --- a/db/migrate/20191223113620_modify_task_pass_for_challenges.rb +++ b/db/migrate/20191223113620_modify_task_pass_for_challenges.rb @@ -1,6 +1,7 @@ class ModifyTaskPassForChallenges < ActiveRecord::Migration[5.2] def change challenge = Challenge.find(6917) - challenge.update_attribute(:task_pass, challenge.task_pass.gsub(" ", "").gsub("rac", "\frac")) + task_pass = challenge.task_pass.gsub(" ", "").gsub("rac", '\frac') + challenge.update_attribute(:task_pass, task_pass) end end From 328d5108785bc3753206a53cf13c9fcce835cf54 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 19:43:32 +0800 Subject: [PATCH 35/56] 1 --- ...enges.rb => 20191223113621_modify_task_pass_for_challenges.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/migrate/{20191223113620_modify_task_pass_for_challenges.rb => 20191223113621_modify_task_pass_for_challenges.rb} (100%) diff --git a/db/migrate/20191223113620_modify_task_pass_for_challenges.rb b/db/migrate/20191223113621_modify_task_pass_for_challenges.rb similarity index 100% rename from db/migrate/20191223113620_modify_task_pass_for_challenges.rb rename to db/migrate/20191223113621_modify_task_pass_for_challenges.rb From 382e8475f553117d83ffdeb01393d758ca0ed3fc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 23 Dec 2019 19:45:25 +0800 Subject: [PATCH 36/56] =?UTF-8?q?=E8=BF=87=E5=85=B3=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20191223113621_modify_task_pass_for_challenges.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db/migrate/20191223113621_modify_task_pass_for_challenges.rb b/db/migrate/20191223113621_modify_task_pass_for_challenges.rb index f0d04f964..dbbbafced 100644 --- a/db/migrate/20191223113621_modify_task_pass_for_challenges.rb +++ b/db/migrate/20191223113621_modify_task_pass_for_challenges.rb @@ -1,7 +1,8 @@ class ModifyTaskPassForChallenges < ActiveRecord::Migration[5.2] def change - challenge = Challenge.find(6917) - task_pass = challenge.task_pass.gsub(" ", "").gsub("rac", '\frac') - challenge.update_attribute(:task_pass, task_pass) + Challenge.find_each do |challenge| + task_pass = challenge.task_pass.gsub(" ", "").gsub("rac", '\frac') + challenge.update_attribute(:task_pass, task_pass) + end end end From e170214ed917132eaa5be4908dbce2256fce1a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 23 Dec 2019 19:54:23 +0800 Subject: [PATCH 37/56] =?UTF-8?q?fork=E5=8A=9F=E8=83=BD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMBanner.js | 106 +++++++++++++++--- .../src/modules/tpm/shixuns/css/TPMBanner.css | 6 + 2 files changed, 95 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 4a5fe6f24..50716b4f3 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -15,6 +15,7 @@ import axios from 'axios' import Modals from '../modals/Modals'; import './shixuns/css/TPMBanner.css'; +import types from "../../redux/actions/actionTypes"; let $ = window.$; @@ -22,6 +23,8 @@ const Search = Input.Search; const RadioGroup = Radio.Group; +const { TextArea } = Input; + class TPMBanner extends Component { constructor(props) { super(props) @@ -54,7 +57,9 @@ class TPMBanner extends Component { Senttothevcaluetype: false, jupyterbool: false, openknow:false, - openshowpublictype:false + openshowpublictype:false, + Radiovalue:1, + TextAreaintshow:false } } @@ -197,13 +202,46 @@ class TPMBanner extends Component { }) } + changeTextArea=(e)=>{ + this.setState({ + TextArea:e.target.value + }) + } + addForkvisible = () => { + let reason; + switch (this.state.Radiovalue) { + case 1: + reason="Shixun"; + break; + case 2: + reason="Course"; + break; + case 3: + reason="Subject"; + break; + case 4: + reason=this.state.TextArea; + } + + if(this.state.Radiovalue===4){ + if(this.state.TextArea===null||this.state.TextArea===undefined||this.state.TextArea=== ""){ + this.setState({ + TextAreaintshow:true + }) + return + } + } + this.setState({ - Forkvisibletype: true, + Forkvisibletype:true, }) + let id = this.props.match.params.shixunId; let url = "/shixuns/" + id + "/copy.json"; - axios.post(url).then((response) => { + axios.post(url, { + reason:reason, + }).then((response) => { if (response.data.status === 401) { } else { @@ -212,7 +250,7 @@ class TPMBanner extends Component { Forkauthentication: false, // Forkvisibletype:false }) - window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; + // window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; } }).catch((error) => { @@ -694,17 +732,9 @@ class TPMBanner extends Component { } - showonMouseOver = () => { - $("#ratePanel").show(); - this.setState({ - showradios: true - }) - } - - hideonMouseOut = () => { - $("#ratePanel").hide(); + onChangeRadiovalue=(e)=>{ this.setState({ - showradios: false + Radiovalue:e.target.value }) } @@ -1233,9 +1263,34 @@ class TPMBanner extends Component { + + {Forkvisible===true?:""} + + { + this.state.TextAreaintshow===true?:"" + } :
    -

    复制将在后台执行,平台将为你创建
    一个新的同名实训和内容,请问是否继续?

    +
    +
    请根据实际情况,填写fork本实训的原因
    + + + 实训内容升级 + + + 课堂教学使用 + + + 实践课程使用 + + + 其它原因 + + {this.state.Radiovalue === 4 ? +