From ca5602ae08a4ad9171becb53f2e528e21beb4163 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 10:36:53 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/index.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index eae72dad2..217fe1e28 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -20,7 +20,7 @@ if @challenges.present? user_passed_count = challenge.user_passed_count json.passed_count user_passed_count #json.playing_count @play_games_map.fetch(challenge.id, 0) - json.playing_count (challenge.games.count - user_passed_count) + json.playing_count (challenge.playing_count) json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) json.open_game challenge.open_game(@shixun) #json.open_game challenge.open_game(@shixun, @user.id) From 9657b7065fb196763496bf3095f471ce1859d4b0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 10:48:02 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=80=9A=E5=85=B3?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/challenge.rb | 2 +- app/views/challenges/index.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 31a683760..42d7f3499 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -143,7 +143,7 @@ class Challenge < ApplicationRecord # 关卡用户通关数 def user_passed_count #games.map{|g| g.status == 2}.count - self.games.where(status: 1).count + self.games.where(status: 2).count end # 关卡用户正在挑战的人数 diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index 217fe1e28..eae72dad2 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -20,7 +20,7 @@ if @challenges.present? user_passed_count = challenge.user_passed_count json.passed_count user_passed_count #json.playing_count @play_games_map.fetch(challenge.id, 0) - json.playing_count (challenge.playing_count) + json.playing_count (challenge.games.count - user_passed_count) json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) json.open_game challenge.open_game(@shixun) #json.open_game challenge.open_game(@shixun, @user.id) From 6d2500e253aad593fffc1bdfbe1d3c2885b6899f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 15:09:58 +0800 Subject: [PATCH 03/17] 1 --- app/controllers/challenges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 47c8fc68c..e73243b94 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -162,7 +162,7 @@ class ChallengesController < ApplicationController #@pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count #@play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count - @challenges = @shixun.challenges.joins(join_sql).select(base_columns) + @challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq #@challenges = @shixun.challenges.fields_for_list @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 From 0094e94b03627e8f5e87c6fa5b9b19256ec2e744 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 15:37:06 +0800 Subject: [PATCH 04/17] 1 --- app/controllers/challenges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index e73243b94..47c8fc68c 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -162,7 +162,7 @@ class ChallengesController < ApplicationController #@pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count #@play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count - @challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq + @challenges = @shixun.challenges.joins(join_sql).select(base_columns) #@challenges = @shixun.challenges.fields_for_list @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 From 3535d4ce12516bdbee437f847a19e22fe609e661 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 15:40:07 +0800 Subject: [PATCH 05/17] 1 --- app/controllers/challenges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 47c8fc68c..e73243b94 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -162,7 +162,7 @@ class ChallengesController < ApplicationController #@pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count #@play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count - @challenges = @shixun.challenges.joins(join_sql).select(base_columns) + @challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq #@challenges = @shixun.challenges.fields_for_list @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 From 7884cd71c520bec1c6dd2395ab2ac7cefd84894d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 15:41:33 +0800 Subject: [PATCH 06/17] 1 --- app/models/game.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/game.rb b/app/models/game.rb index 144dbced2..d0d59c0e3 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -7,6 +7,7 @@ class Game < ApplicationRecord default_scope { order("games.created_at desc") } + #TODO: games表要增加challenge_id与user_id的唯一索引 has_many :outputs, -> { order('query_index DESC') } has_many :challenge_samples, :dependent => :destroy has_many :game_codes, :dependent => :destroy From cd80381510acdac828828756e696010edca99d40 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 17:45:22 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 29a9a9730..324d2214e 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -23,22 +23,16 @@ class MyshixunsController < ApplicationController end begin ActiveRecord::Base.transaction do - begin @shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id) @myshixun.destroy! - StudentWork.where(:myshixun_id => @myshixun.id).update_all(myshixun_id: 0, work_status: 0, work_score: nil, - final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0) - rescue Exception => e - logger.error("######reset_my_game_failed:#{e.message}") - raise("ActiveRecord::RecordInvalid") - end + + StudentWork.where(:myshixun_id => @myshixun.id) + .update_all(myshixun_id: 0, work_status: 0, work_score: nil, + final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0) end # 删除版本库 GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type? rescue Exception => e - if e.message != "ActiveRecord::RecordInvalid" - logger.error("######delete_repository_error-:#{e.message}") - end raise "delete_repository_error:#{e.message}" end end From 03a72aedc87bdd83b93ab05f256337ba7a0e67a8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 17:51:20 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 324d2214e..e816ab667 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -22,8 +22,8 @@ class MyshixunsController < ApplicationController tip_exception("403", "") end begin + @shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id) ActiveRecord::Base.transaction do - @shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id) @myshixun.destroy! StudentWork.where(:myshixun_id => @myshixun.id) From 7a8e9226438998af3af5305fc7d94f448ffaa851 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 22:44:15 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E8=BD=AC=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 995f9a82f..ecb5afdc6 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -2,13 +2,18 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do - Video.find_each do |v| - if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265") - p "--- Start submit video trans code #{v.uuid}" + i = 1 + Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).find_each do |v| + code_info = AliyunVod::Service.get_meta_code_info(v.uuid) + if !v.file_url.include?('.mp4') && !code_info[:codecnamne]&.include?("h264") + puts "v.file_url: #{v.file_url}, code_info[:codecnamne]: #{code_info[:codecnamne]}" + i += 1 AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') else v.update(transcoded: true) end end + puts "###########转码个数:#{i}" + end end \ No newline at end of file From a5f26d33ca427356134e74543373c3535284b29c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 23:12:28 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E8=BD=AC=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index ecb5afdc6..c0b8a9a62 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -2,18 +2,17 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do - i = 1 + i = [] Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).find_each do |v| code_info = AliyunVod::Service.get_meta_code_info(v.uuid) - if !v.file_url.include?('.mp4') && !code_info[:codecnamne]&.include?("h264") - puts "v.file_url: #{v.file_url}, code_info[:codecnamne]: #{code_info[:codecnamne]}" - i += 1 - AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') - else + if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") v.update(transcoded: true) + else + i << "#{v.id}, #{v.file_url}, #{code_info[:codecnamne]}" + AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') end end - puts "###########转码个数:#{i}" - + puts "###########转码个数:#{i.size}" + puts "###########id,file_url, codecnamne:#{i}" end end \ No newline at end of file From 2dfb081f4f5e9ba469e62844f2a019d5f102d91e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 00:13:20 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E8=BD=AC=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index c0b8a9a62..98221e007 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -8,6 +8,7 @@ namespace :video_transcode do if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") v.update(transcoded: true) else + puts("uuid: #{v.uuid}") i << "#{v.id}, #{v.file_url}, #{code_info[:codecnamne]}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') end From 8bdeb3ea4570c7de81d60574fe6d1488e3036186 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 00:21:38 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=9A=84=E8=A7=86?= =?UTF-8?q?=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 98221e007..4fb7c17bd 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do i = [] - Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).find_each do |v| + Video.where.not(uuid: nil, file_url: nil).where(transcoded: false, status: "published").find_each do |v| code_info = AliyunVod::Service.get_meta_code_info(v.uuid) if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") v.update(transcoded: true) From 0f22210bf5f3da0a9300bd28fd86ee2f17285048 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 12:00:48 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E9=AB=98=E6=A0=A1=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/schools.rake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/tasks/schools.rake diff --git a/lib/tasks/schools.rake b/lib/tasks/schools.rake new file mode 100644 index 000000000..f5a66a786 --- /dev/null +++ b/lib/tasks/schools.rake @@ -0,0 +1,21 @@ +#coding=utf-8 + +desc "合并高校的数据,第一个参数是: 正确高校的id, 第二个参数是: 错误高校需要合并到正确高校的id" +# 命令: bundle exec rake schools:merge_school_data f_school=1 s_school=2,3 +namespace :schools do + task merge_school_data: :environment do + f_school = ENV['f_school'].to_i + school = School.find_by(id: f_school) + return if school.blank? + + s_school = ENV['s_school'].split(",") + merge_schools = School.where(id: s_school) + + # 改变用户的学校id 和 单位 + UserExtension.where(school_id: merge_schools) + .update_all(school_id: f_school, department_id: nil) + + # 改变课堂的学校id + Course.where(school_id: merge_schools).update_all(school_id: f_school) + end +end \ No newline at end of file From d2a282e37befae934cd25424c9e1b0dad371d1fb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 12:10:46 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=95=B0=E7=9B=AE?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/schools.rake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/tasks/schools.rake b/lib/tasks/schools.rake index f5a66a786..3b62c5e20 100644 --- a/lib/tasks/schools.rake +++ b/lib/tasks/schools.rake @@ -17,5 +17,12 @@ namespace :schools do # 改变课堂的学校id Course.where(school_id: merge_schools).update_all(school_id: f_school) + + # 实训报告表迁移数据 + s_report = SchoolReport.find_by(school_id: f_school) + SchoolReport.where(school_id: merge_schools).each do |sr| + s_report.update_column(:shixun_evaluate_count, shixun_evaluate_count+sr.shixun_evaluate_count) + sr.update(shixun_evaluate_count: 0) + end end end \ No newline at end of file From 52fe87875b6a3044bbb1422090cc270d2d309cf3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 12:11:49 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/schools.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/schools.rake b/lib/tasks/schools.rake index 3b62c5e20..0d2cf0899 100644 --- a/lib/tasks/schools.rake +++ b/lib/tasks/schools.rake @@ -21,7 +21,7 @@ namespace :schools do # 实训报告表迁移数据 s_report = SchoolReport.find_by(school_id: f_school) SchoolReport.where(school_id: merge_schools).each do |sr| - s_report.update_column(:shixun_evaluate_count, shixun_evaluate_count+sr.shixun_evaluate_count) + s_report.update_column(:shixun_evaluate_count, s_report.shixun_evaluate_count+sr.shixun_evaluate_count) sr.update(shixun_evaluate_count: 0) end end From 56c90e53cedb7c0949f564d2bc1d22e8b899a6ad Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 14:32:38 +0800 Subject: [PATCH 16/17] 1 --- lib/tasks/schools.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/schools.rake b/lib/tasks/schools.rake index 0d2cf0899..a788d57d1 100644 --- a/lib/tasks/schools.rake +++ b/lib/tasks/schools.rake @@ -21,7 +21,7 @@ namespace :schools do # 实训报告表迁移数据 s_report = SchoolReport.find_by(school_id: f_school) SchoolReport.where(school_id: merge_schools).each do |sr| - s_report.update_column(:shixun_evaluate_count, s_report.shixun_evaluate_count+sr.shixun_evaluate_count) + s_report.update_column(:shixun_evaluate_count, (s_report.shixun_evaluate_count+sr.shixun_evaluate_count)) sr.update(shixun_evaluate_count: 0) end end From 3d2c7097d9732b6a51c81a9cfc6574565e6aaeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Mar 2020 15:24:35 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E9=A1=B6=E9=83=A8=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/modals/Modals.js | 5 +- .../src/modules/paths/PathDetail/DetailTop.js | 56 +++++++++++-------- public/react/src/modules/tpm/TPMBanner.js | 55 ++++++++++++++---- public/react/src/modules/tpm/TPMIndex.js | 1 + 4 files changed, 82 insertions(+), 35 deletions(-) diff --git a/public/react/src/modules/modals/Modals.js b/public/react/src/modules/modals/Modals.js index 1aaec6402..60485b26a 100644 --- a/public/react/src/modules/modals/Modals.js +++ b/public/react/src/modules/modals/Modals.js @@ -34,6 +34,9 @@ render() { } .color848282{ color:#848282; + } + .task-btn{ + color: #fff !important; } ` } @@ -50,7 +53,7 @@ render() { :
} diff --git a/public/react/src/modules/paths/PathDetail/DetailTop.js b/public/react/src/modules/paths/PathDetail/DetailTop.js index d542c225e..1509b2b43 100644 --- a/public/react/src/modules/paths/PathDetail/DetailTop.js +++ b/public/react/src/modules/paths/PathDetail/DetailTop.js @@ -32,7 +32,10 @@ class DetailTop extends Component{ getappointmenttype:false, openpathss:false, cancel_publics:false, - cancel_has_publics:false + cancel_has_publics:false, + applyissuePaths:false, + cancelText:undefined, + okText:undefined } } componentDidMount(){ @@ -110,21 +113,27 @@ class DetailTop extends Component{ applyissuePath=()=>{ + this.setState({ + loadtype:true, + Modalstype: true, + Modalstopval:` 课程需经过平台审核方可公开使用,公开的课程将对平台所`, + modalsMidval:"有人公开可见,若仅本人教学使用则无需申请公开,直接发", + Modalsbottomval:"送到课堂即可。", + applyissuePaths:true + }) + + } + + showapplyissuePath=()=>{ let pathid=this.props.match.params.pathId; let url ="/paths/"+pathid+"/publish.json"; axios.post(url).then((result)=>{ if(result.status===200){ if(result.data.status===0){ - this.setState({ - loadtype:true, - Modalstype: true, - Modalstopval: ` 课程需经过平台审核方可公开使用,公开的课程将对平台所`, - modalsMidval:"有人公开可见。若仅本人教学使用则无需申请公开, 直接发", - Modalsbottomval:"送到课堂即可.", - cardsModalsavetype: true, - }) + this.props.showNotification(result.data.message) this.props.getlistdatas(); + this.cardsModalcancel() }else if(result.data.status===1){ // window.location.reload(); } @@ -132,9 +141,7 @@ class DetailTop extends Component{ }).catch((error)=>{ console.log(error); }) - - - } + } postcancelissuePath=()=>{ let pathId=this.props.match.params.pathId; let url ="/paths/"+pathId+"/cancel_publish.json"; @@ -180,12 +187,15 @@ class DetailTop extends Component{ modalsMidval:'', modalstyles:'', cardsModalsavetype:false, - applyissuePath:false, + applyissuePaths:false, openpathss:false, cancel_publics:false, cancel_has_publics:false, Modalstopval:``, + cancelText:undefined, + okText:undefined }) + } cardsModalsave=()=>{ @@ -369,13 +379,13 @@ class DetailTop extends Component{ openpaths=()=>{ this.setState({ - loadtype:true, Modalstype: true, openpathss:true, - Modalstopval: "公开申请已提交,请等待管理员的审核", - modalsMidval:"• 我们将在1-2个工作日内完成审核", - Loadtype:true, - modalstyles:"848282" + Modalstopval: "公开课程需经过平台标准化审核,审核周期为1-2天,公开", + modalsMidval:"的课程将对平台所有人可见。若仅本人教学使用则无需", + Modalsbottomval:"申请公开,直接发送到课堂即可", + cancelText:"取消申请", + okText:"确定申请" }) } @@ -433,7 +443,7 @@ class DetailTop extends Component{ render(){ let{detailInfoList}=this.props; - let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics}=this.state; + let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics,applyissuePaths}=this.state; const radioStyle = { display: 'block', height: '30px', @@ -470,8 +480,10 @@ class DetailTop extends Component{ modalsTopval={Modalstopval} modalsBottomval={Modalsbottomval} modalCancel={cardsModalcancel} - modalSave={loadtype===true&&openpathss===false?()=>this.cardsModalcancel():cardsModalsavetype===true?()=>this.postcancelissuePath():openpathss===true?()=>this.postopenpaths():cancel_publics===true?()=>this.postcancel_public():cancel_has_publics===true?()=>this.postcancel_has_public():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()} + modalSave={applyissuePaths===true?()=>this.showapplyissuePath():loadtype===true&&openpathss===false?()=>this.cardsModalcancel():cardsModalsavetype===true?()=>this.postcancelissuePath():openpathss===true?()=>this.postopenpaths():cancel_publics===true?()=>this.postcancel_public():cancel_has_publics===true?()=>this.postcancel_has_public():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()} loadtype={loadtype} + cancelText={this.state.cancelText} + okText={this.state.okText} modalsMidval={this.state.modalsMidval} modalstyles={this.state.modalstyles} > @@ -605,8 +617,8 @@ class DetailTop extends Component{ { detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true? 发布:"" + style={{'width':'95px'}} + onClick={this.applyissuePath}>申请发布:"" } diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 9ba752827..7527357c0 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -60,7 +60,8 @@ class TPMBanner extends Component { openshowpublictype:false, Radiovalue:1, TextAreaintshow:false, - + cancelText:undefined, + okText:undefined, } } @@ -434,6 +435,9 @@ class TPMBanner extends Component { modalsMidval:undefined, ModalsBottomval:"", modalstyles:"", + cancelText:undefined, + okText:undefined, + Loadtype:false, }) } ModalSave = () => { @@ -441,7 +445,10 @@ class TPMBanner extends Component { let url = "/shixuns/" + id + "/cancel_publish.json"; axios.get(url).then((response) => { this.props.showSnackbar(response.data.message); - window.location.reload() + // window.location.reload() + this.ModalCancel() + this.props.getcomponentdidmount() + }).catch((error) => { console.log(error) }); @@ -461,16 +468,21 @@ class TPMBanner extends Component { ModalSaveopenpublic= () => { this.setState({ Modalstype: true, - Modalstopval: "公开申请已提交,请等待管理员的审核", - modalsMidval:"• 我们将在1-2个工作日内完成审核", - ModalCancel: this.eopenpublicupdatadata, + Modalstopval:"公开实训需经过平台标准化审核,审核周期为1-2天,", + modalsMidval:"公开的实训将对平台所有人可见。若仅本人教学使用", + ModalsBottomval:"则无需申请公开, 直接发送到课堂即可。", + cancelText:"取消申请", + okText:"确定申请", + ModalCancel: this.ModalCancel, ModalSave: this.eopenpublicupdatadata, - Loadtype:true, - modalstyles:"848282" + // Loadtype:true, + // modalstyles:"848282" }) } eopenpublicupdatadata=()=>{ - window.location.reload() + // window.location.reload() + this.ModalCancel() + this.props.getcomponentdidmount() } openpublic=()=>{ let id = this.props.match.params.shixunId; @@ -490,7 +502,9 @@ class TPMBanner extends Component { let url = `/shixuns/${id}/cancel_apply_public.json`; axios.get(url).then((response) => { if(response.data.status===0){ - window.location.reload() + // window.location.reload() + this.ModalCancel() + this.props.getcomponentdidmount() } }).catch((error) => { console.log(error) @@ -522,7 +536,10 @@ class TPMBanner extends Component { evaluation_set_position = response.data.evaluation_set_position } if(response.data.status===0){ - window.location.reload() + // window.location.reload() + this.applyreleaseopen() + // this.ModalCancel() + this.props.getcomponentdidmount() }else{ this.setState({ Issuevisible: true, @@ -536,13 +553,23 @@ class TPMBanner extends Component { console.log(error) }); }; + applyreleaseopen = () => { + this.setState({ + Modalstype: true, + Loadtype:true, + Modalstopval: "实训发布后即可发送课堂使用", + ModalSave: this.ModalCancel, + }) + } hiddenIssuevisible = (val) => { this.setState({ Issuevisible: false }) if (val === 0 || val === 1) { - window.location.reload() + // window.location.reload() + this.ModalCancel() + this.props.getcomponentdidmount() } } @@ -803,7 +830,9 @@ class TPMBanner extends Component { hidestartshixunsreplacevalue, Forkvisibletype, AccountProfiletype, - isIE + isIE, + cancelText, + okText, } = this.state; let {shixunsDetails, shixunId, star_info, star_infos} = this.props; let challengeBtnTipText = ''; @@ -900,6 +929,8 @@ class TPMBanner extends Component { modalsMidval={this.state.modalsMidval} loadtype={this.state.Loadtype} modalstyles={this.state.modalstyles} + cancelText={this.state.cancelText} + okText={this.state.okText} /> : ""}