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/47] =?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/47] =?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/47] 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/47] 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/47] 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/47] 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 767c0455089f446910a965316b354b12b5f012e0 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 5 Mar 2020 22:10:18 +0800 Subject: [PATCH 07/47] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../watch_video_histories_controller.rb | 8 +++ app/models/course_video.rb | 2 + app/models/user.rb | 4 ++ app/models/watch_course_video.rb | 9 +++ app/models/watch_video_history.rb | 5 ++ app/services/create_watch_video_service.rb | 71 +++++++++++++++++++ config/routes.rb | 2 + ...200305072442_create_watch_course_videos.rb | 15 ++++ ...0305074638_create_watch_video_histories.rb | 18 +++++ 9 files changed, 134 insertions(+) create mode 100644 app/controllers/watch_video_histories_controller.rb create mode 100644 app/models/watch_course_video.rb create mode 100644 app/models/watch_video_history.rb create mode 100644 app/services/create_watch_video_service.rb create mode 100644 db/migrate/20200305072442_create_watch_course_videos.rb create mode 100644 db/migrate/20200305074638_create_watch_video_histories.rb diff --git a/app/controllers/watch_video_histories_controller.rb b/app/controllers/watch_video_histories_controller.rb new file mode 100644 index 000000000..996c76d24 --- /dev/null +++ b/app/controllers/watch_video_histories_controller.rb @@ -0,0 +1,8 @@ +class WatchVideoHistoriesController < ApplicationController + before_action :require_login + + def create + watch_log = CreateWatchVideoService.new(current_user, request, params).call + render_ok(log_id: watch_log&.id) + end +end diff --git a/app/models/course_video.rb b/app/models/course_video.rb index 2cfa151ce..e192cf7f8 100644 --- a/app/models/course_video.rb +++ b/app/models/course_video.rb @@ -5,4 +5,6 @@ class CourseVideo < ApplicationRecord validates :title, length: { maximum: 60, too_long: "不能超过60个字符" }, allow_blank: true validates :link, format: { with: CustomRegexp::URL, message: "必须为网址超链接" }, allow_blank: true + + has_many :watch_course_videos end diff --git a/app/models/user.rb b/app/models/user.rb index b0bd191d2..fb4cc50da 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -162,6 +162,10 @@ class User < ApplicationRecord has_many :teacher_group_records, dependent: :destroy + # 视频观看记录 + has_many :watch_video_histories, dependent: :destroy + has_many :watch_course_video, dependent: :destroy + # Groups and active users scope :active, lambda { where(status: STATUS_ACTIVE) } diff --git a/app/models/watch_course_video.rb b/app/models/watch_course_video.rb new file mode 100644 index 000000000..cf2d67028 --- /dev/null +++ b/app/models/watch_course_video.rb @@ -0,0 +1,9 @@ +class WatchCourseVideo < ApplicationRecord + belongs_to :course_video + belongs_to :user + + has_many :watch_video_histories + + + validates :course_video_id, uniqueness: {scope: :user_id} +end diff --git a/app/models/watch_video_history.rb b/app/models/watch_video_history.rb new file mode 100644 index 000000000..0f9ab4a8a --- /dev/null +++ b/app/models/watch_video_history.rb @@ -0,0 +1,5 @@ +class WatchVideoHistory < ApplicationRecord + belongs_to :user + belongs_to :video + belongs_to :watch_course_video, optional: true +end diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb new file mode 100644 index 000000000..b16a65535 --- /dev/null +++ b/app/services/create_watch_video_service.rb @@ -0,0 +1,71 @@ +class CreateWatchVideoService < ApplicationService + attr_reader :user, :params, :request + + def initialize(user, request, params) + @user = user + @request = request + @params = params + end + + def call + ActiveRecord::Base.transaction do + current_time = Time.now + if params[:log_id].present? + # 更新观看时长 + watch_video_history = user.watch_video_histories.find(params[:log_id]) + + if watch_video_history.present? && watch_video_history.watch_duration < params[:watch_duration].to_f + # 如果观看时长少于原有的,说明拖放到前面重新观看了,不必再去记录 + watch_video_history.end_at = current_time + watch_video_history.watch_duration = params[:watch_duration] + watch_video_history.is_finished = (watch_video_history.duration <= params[:watch_duration].to_f) + watch_video_history.save! + + watch_course_video = watch_video_history.watch_course_video + + if watch_course_video.present? && !watch_course_video.is_finished && watch_course_video.watch_duration < params[:watch_duration].to_f + # 更新课程视频的时长及是否看完 + watch_course_video.watch_duration = params[:watch_duration] + watch_course_video.is_finished = (watch_course_video.duration <= params[:watch_duration].to_f) + watch_course_video.end_at = current_time + watch_course_video.save! + end + end + else + # 开始播放时记录一次 + if params[:course_id].present? + # 课堂视频 + course_video = CourseVideo.find_by(course_id: params[:course_id], video_id: params[:video_id]) + watch_course_video = WatchCourseVideo.find_or_initialize_by(course_video_id: course_video.id, user_id: user.id) do |d| + d.start_at = current_time + d.duration = params[:duration] + end + + watch_video_history = build_video_log(current_time, course_video.video_id, watch_course_video.id) + watch_video_history.save! + + watch_course_video.save! unless watch_course_video.persisted? + else + # 非课堂视频 + video = Video.find_by(params[:video_id]) + watch_video_history = build_video_log(current_time, video.id) + watch_video_history.save! + end + end + watch_video_history + end + end + + + def build_video_log(current_time, video_id, watch_course_video_id) + WatchVideoHistory.new( + user_id: user.id, + watch_course_video_id: watch_course_video_id, + start_at: current_time, + duration: params[:duration], + video_id: video_id, + device: params[:device], + ip: request.remote_ip + ) + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index db9b74bd2..bcab93203 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,6 +29,8 @@ Rails.application.routes.draw do put 'commons/unhidden', to: 'commons#unhidden' delete 'commons/delete', to: 'commons#delete' + resources :watch_video_histories, only: [:create] + resources :jupyters do collection do get :save_with_tpi diff --git a/db/migrate/20200305072442_create_watch_course_videos.rb b/db/migrate/20200305072442_create_watch_course_videos.rb new file mode 100644 index 000000000..5695344fc --- /dev/null +++ b/db/migrate/20200305072442_create_watch_course_videos.rb @@ -0,0 +1,15 @@ +class CreateWatchCourseVideos < ActiveRecord::Migration[5.2] + def change + create_table :watch_course_videos do |t| + t.references :course_video, index: true + t.references :user, index: true + t.boolean :is_finished, default: false + t.float :duration, default: 0 + t.float :watch_duration, default: 0 + t.datetime :start_at + t.datetime :end_at + + t.timestamps + end + end +end diff --git a/db/migrate/20200305074638_create_watch_video_histories.rb b/db/migrate/20200305074638_create_watch_video_histories.rb new file mode 100644 index 000000000..ad9645a6a --- /dev/null +++ b/db/migrate/20200305074638_create_watch_video_histories.rb @@ -0,0 +1,18 @@ +class CreateWatchVideoHistories < ActiveRecord::Migration[5.2] + def change + create_table :watch_video_histories do |t| + t.references :watch_course_video, index: true + t.references :user, index: true + t.references :video, index: true + t.boolean :is_finished, default: false + t.float :duration, default: 0 + t.float :watch_duration, default: 0 + t.datetime :start_at + t.datetime :end_at + t.string :device + t.string :ip + + t.timestamps + end + end +end From 1ccb16f76d8235e6ec29de8590aae3b4aa35c106 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 17:34:38 +0800 Subject: [PATCH 08/47] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...311092049_add_index_user_id_challenge_id_for_games.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb diff --git a/db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb b/db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb new file mode 100644 index 000000000..c9fab49d4 --- /dev/null +++ b/db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb @@ -0,0 +1,9 @@ +class AddIndexUserIdChallengeIdForGames < ActiveRecord::Migration[5.2] + def change + delete_games = Game.where.not(myshixun_id: Myshixun.all).reorder(nil) + puts "delete_games: #{delete_games.pluck(:id)}" + delete_games.destroy_all + + add_index :games, [:user_id, :challenge_id], unique: true + end +end 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 09/47] =?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 10/47] =?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 e80ae9f952535cb0ac816de72651c3f3b25f0ce2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 18:02:16 +0800 Subject: [PATCH 11/47] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=80=89=E7=94=A8?= =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=92=8C=E5=88=9B=E5=BB=BA=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=90=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 5 +++++ app/controllers/question_banks_controller.rb | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 0e3771e61..adf0dc6bf 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -376,6 +376,11 @@ class HomeworkCommonsController < ApplicationController @homework.user_id = current_user.id @homework.course_id = @course.id + if params[:category].present? + category = @course.course_second_categories.find_by(id: params[:category]) + @homework.course_second_category_id = category&.id.to_i + end + homework_detail_manual = HomeworkDetailManual.new @homework.homework_detail_manual = homework_detail_manual homework_detail_manual.te_proportion = 0.7 diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index bcb88ad85..af6305a64 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -212,6 +212,11 @@ class QuestionBanksController < ApplicationController homework_type: homework.homework_type, course_id: course.id, homework_bank_id: homework.id, reference_answer: homework.reference_answer) + if params[:category].present? + category = course.course_second_categories.find_by(id: params[:category]) + new_homework.course_second_category_id = category&.id.to_i + end + # 作业的基本设置复制 new_homework.homework_detail_manual = HomeworkDetailManual.new new_homework_detail_manual = new_homework.homework_detail_manual From fdbccae6c8052ec5c68b69b24f2d95ace05bacf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 18:22:58 +0800 Subject: [PATCH 12/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coursesPublic/ModulationModal_exercise.js | 4 +- .../courses/exercise/ExerciseListItem.js | 21 ++- .../courses/exercise/Exercisesetting.js | 125 +++++++----------- .../exercise/Studentshavecompletedthelist.js | 46 +++++-- .../exercise/Testpapersettinghomepage.js | 18 ++- 5 files changed, 120 insertions(+), 94 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js index 7c6e6cf6e..4950d10d0 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js @@ -42,8 +42,8 @@ class ModulationModal_exercise extends Component { } componentDidMount = () => { - console.log("ModulationModal_exercise"); - console.log(this.props); + // console.log("ModulationModal_exercise"); + // console.log(this.props); this.setState({ subjective_score: this.props.subjective_score, objective_score: this.props.objective_score, diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index 52f05bb6d..f9f3288e8 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -77,7 +77,6 @@ class ExerciseListItem extends Component{ const IsAdmin =this.props.isAdmin(); const IsStudent =this.props.isStudent(); - // console.log(this.props.current_user.user_id) return(
window.$(`.exerciseitem${index} input`).click() }> { @@ -189,8 +188,24 @@ class ExerciseListItem extends Component{ { IsAdmin &&
- this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 - 编辑 + + + { + item&&item.assistant_auth===true? + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + : + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + + } + { + item&&item.assistant_auth===true? + 编辑 + : + "" + } + 设置
} diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index 0e613a554..504c73456 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -75,10 +75,11 @@ class Exercisesetting extends Component{ limit:10, searchtext:"", order: "end_at", + assistant_auth:false } - console.log("Exercisesetting"); - console.log("69"); - console.log(props); + // console.log("Exercisesetting"); + // console.log("69"); + // console.log(props); } _getRequestParams() { const { order, exercise_group_id,searchtext, page ,limit} = this.state @@ -92,6 +93,10 @@ class Exercisesetting extends Component{ } //加载 componentDidMount=()=>{ + this.setState({ + assistant_auth:this.props.assistant_auth, + }) + this.getSettingInfo(); // window.addEventListener('click', this.handleClick); @@ -113,6 +118,11 @@ class Exercisesetting extends Component{ if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){ this.editSetting() } + if(prevProps.assistant_auth!= this.props.assistant_auth){ + this.setState({ + assistant_auth:this.props.assistant_auth, + }) + } } _getRequestParams() { @@ -348,10 +358,16 @@ class Exercisesetting extends Component{ this.commitSetting((result)=>{ console.log(result) - if(result.status==200){ + if(result.status===200){ this.props.showNotification(`${result.data.message}`); this.getSettingInfo(1); this.cancelEdit(); + try { + this.props.assistantauthoritys(this.state.assistant_auth); + + }catch (e) { + + } } }) } @@ -371,6 +387,12 @@ class Exercisesetting extends Component{ this.props.showNotification(`${result.data.message}`); this.cancelEdit(); this.getSettingInfo(1); + try { + this.props.assistantauthoritys(this.state.assistant_auth); + + }catch (e) { + + } } }); @@ -386,11 +408,12 @@ class Exercisesetting extends Component{ publish_time:this.state.publish_time, end_time:this.state.end_time, show_statistic:this.state.show_statistic, - choice_random:this.state.choice_random, + choice_random:this.state.choice_random, score_open:this.state.score_open, answer_open:this.state.answer_open, question_random:this.state.question_random, time:this.state.time, + assistant_auth:this.state.assistant_auth, } }else{ let list=this.state.rules; @@ -403,7 +426,6 @@ class Exercisesetting extends Component{ } lists.push(newlist) }) - params={ unified_setting:this.state.unified_setting, show_statistic:this.state.show_statistic, @@ -413,6 +435,7 @@ class Exercisesetting extends Component{ answer_open:this.state.answer_open, publish_time_groups:lists, time:this.state.time, + assistant_auth:this.state.assistant_auth, } } axios.post((url),params).then((result)=>{ @@ -491,6 +514,12 @@ class Exercisesetting extends Component{ }) } + assistantauthority=(e)=>{ + this.setState({ + assistant_auth:e.target.checked + }) + } + onChangeTimepublish=(date, dateString)=>{ if(date===null){ this.setState({ @@ -608,7 +637,9 @@ class Exercisesetting extends Component{ // console.log("asdasdasda"); // console.log(this.props); // console.log(this.props.Commonheadofthetestpaper); - return( + + + return(
-

公开设置

+

属性设置

@@ -790,7 +821,7 @@ class Exercisesetting extends Component{ (选中,则在试卷截止时间之后,已提交答题的学生可以查看试卷题目的答案,否则不能查看)

-

+

{getFieldDecorator('show_statistic') ( @@ -799,6 +830,15 @@ class Exercisesetting extends Component{ (选中,则在试卷截止时间之后,已提交答题的学生可以查看答题统计,否则不能查看)

+

+ + {getFieldDecorator('assistantauthority') + ( + 助教权限 + )} + + (勾选则允许助教查看答案) +

@@ -820,70 +860,3 @@ const WrappedExercisesetting = Form.create({ name: 'exercisesetting' })(Exercise export default WrappedExercisesetting; -// //提交form表单 -// handleSubmit = (e) => { -// -// let{unified_setting,answer_open}=this.state; -// e.preventDefault(); -// let exercise_id=this.props.match.params.Id; -// -// this.props.form.validateFieldsAndScroll((err, values) => { -// debugger -// if(!err){ -// // 第一次进行问卷设置或者勾选了统一设置 -// if(unified_setting==true){ -// if(this.state.p_flag == false && this.state.e_flag == true){ -// // 选择了发布时间但截至时间没有选择 -// this.setState({ -// modalsType:true, -// modalsTopval:"请选择截止时间", -// loadtype:true, -// modalSave:this.cancelBox -// }) -// return; -// }else if(this.state.p_flag == true && this.state.e_flag == true){ -// // 如果两个时间都没有填写则弹出立即发布弹框 -// let{publish_time,end_time}=this.state -// if(publish_time==undefined && end_time ==undefined){ -// -// }else{ -// // 否则就是选择的时间错误 -// this.setState({ -// modalsType:true, -// modalsTopval:"请选择正确的发布时间和截止时间", -// loadtype:true, -// modalSave:this.cancelBox -// }) -// } -// return; -// } -// } -// -// let url=`/exercises/${exercise_id}/commit_setting.json`; -// let params=[]; -// if(values.unitSet){ -// params={ -// unified_setting:values.unitSet, -// publish_time:this.state.publish_time, -// end_time:this.state.end_time, -// show_result:values.public, -// un_anonymous:values.real -// } -// }else{ -// params={ -// unified_setting:values.unitSet, -// show_result:values.public, -// un_anonymous:values.real, -// publish_time_groups:this.state.rules -// } -// } -// axios.post((url),{params}).then((result)=>{ -// if(result.status==200){ -// this.props.showNotification(`${result.data.message}`); -// } -// }).catch((error)=>{ -// console.log(error); -// }) -// } -// }) -// } diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 9c6e8a87b..e9568a1cf 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1158,8 +1158,19 @@ class Studentshavecompletedthelist extends Component { { record.submitstate === "未提交"||record.commit_method===5? - this.Adjustment(record.user_id)}>评阅 + ( + this.props.assistant_auth&&this.props.assistant_auth===true? + ( + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) + : + this.Adjustment(record.user_id)}>评阅 + ) :record.submitstate === "已提交"? { record.submitstate === "未提交"||record.commit_method===5? - this.Adjustment(record.user_id)}>评阅 + ( + this.props.assistant_auth&&this.props.assistant_auth===true? + ( + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) + : + this.Adjustment(record.user_id)}>评阅 + ) :record.submitstate === "已提交"? { - console.log("Adjustment"); - console.log(e); + // console.log("Adjustment"); + // console.log(e); + if(this.state.objective_score===0&&this.state.subjective_score===0){ + this.props.showNotification('试卷题型分被限制为0分,不能调分,请到编辑试卷中修改题型分数'); + + return + } + + + this.setState({ testpapergradingboll: true, exeuserid: e, @@ -2828,8 +2858,8 @@ class Studentshavecompletedthelist extends Component { // //console.log("this.props.Commonheadofthetestpaper.exercise_status"); // //console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status); // //console.log(exercise_status); - console.log("Studentshavecompletedthelis123123t"); - console.log(columnss); + // console.log("Studentshavecompletedthelis123123t"); + // console.log(columnss); return ( isAdmin === true ? ( diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index ce63ca526..17f95b352 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -35,6 +35,7 @@ class Testpapersettinghomepage extends Component{ DownloadMessageval:undefined, donwloading:false, exercise_status:3, + assistant_auth:false, //设置助教 } } //切换tab @@ -72,6 +73,7 @@ class Testpapersettinghomepage extends Component{ Commonheadofthetestpaper:response.data, current_status:response.data.user_permission.current_status, exercise_status:response.data.exercise_status, + assistant_auth:response.data.assistant_auth, }) // console.log(JSON.stringify(response.data.show_statistic)); @@ -85,6 +87,12 @@ class Testpapersettinghomepage extends Component{ } + assistantauthoritys=(bool)=>{ + this.setState({ + assistant_auth:bool, + }) + } + Ecerciseacallagain=()=>{ this.setState({ visible:true @@ -287,7 +295,7 @@ class Testpapersettinghomepage extends Component{ this.props.history.goBack() } render(){ - let {tab,visible,Commonheadofthetestpaper,exercise_status}=this.state; + let {tab,visible,Commonheadofthetestpaper,exercise_status,assistant_auth}=this.state; const isAdmin =this.props.isAdmin(); const isStudent = this.props.isStudent(); // TODO @@ -461,22 +469,22 @@ class Testpapersettinghomepage extends Component{ /> { // 教师列表 - parseInt(tab[0])==0 ? this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}>:"" + parseInt(tab[0])==0 ? this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}>:"" } {/*统计结果*/} { - parseInt(tab[0])==1 ? :"" + parseInt(tab[0])==1 ? :"" } { - parseInt(tab[0])==2 ? :"" + parseInt(tab[0])==2 ? :"" } { - parseInt(tab[0])==3 ? :"" + parseInt(tab[0])==3 ? this.assistantauthoritys(bool)}>:"" }
From dca59351cf3d07dc1491717433902ad08ba964ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 18:24:54 +0800 Subject: [PATCH 13/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/exercise/Studentshavecompletedthelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index e9568a1cf..b0a337645 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -2797,7 +2797,7 @@ class Studentshavecompletedthelist extends Component { // console.log("Adjustment"); // console.log(e); if(this.state.objective_score===0&&this.state.subjective_score===0){ - this.props.showNotification('试卷题型分被限制为0分,不能调分,请到编辑试卷中修改题型分数'); + this.props.showNotification('试卷题型分被限制为0分,不能调分,请点击编辑试卷修改题型分数'); return } From 4c1de925add462fcd1bb71f85cece807620e3724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 19:17:56 +0800 Subject: [PATCH 14/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/ExerciseListItem.js | 35 +++++++++------ .../courses/exercise/Exercisesetting.js | 20 +++++++++ .../exercise/Studentshavecompletedthelist.js | 38 ++++++++++------ .../exercise/Testpapersettinghomepage.js | 43 +++++++++++++++++-- public/react/src/modules/tpm/TPMIndexHOC.js | 5 +++ 5 files changed, 111 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index f9f3288e8..a4bdc5c29 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -75,7 +75,9 @@ class ExerciseListItem extends Component{ let{item,checkBox,index}=this.props; let {coursesId,Id}=this.props.match.params const IsAdmin =this.props.isAdmin(); - const IsStudent =this.props.isStudent(); + const isAssistant=this.props.isAssistant(); + + const IsStudent =this.props.isStudent(); return(
window.$(`.exerciseitem${index} input`).click() }> @@ -188,24 +190,31 @@ class ExerciseListItem extends Component{ { IsAdmin &&
- - { - item&&item.assistant_auth===true? - this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + isAssistant===true? + ( + item&&item.assistant_auth===true? + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + : + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + ) : - this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 - + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 } + { - item&&item.assistant_auth===true? - 编辑 + isAssistant===true? + ( + item&&item.assistant_auth===true? + 编辑 + : + "" + ) : - "" + 编辑 } - 设置
} diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index 504c73456..ed3db102c 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -97,6 +97,8 @@ class Exercisesetting extends Component{ assistant_auth:this.props.assistant_auth, }) + + this.getSettingInfo(); // window.addEventListener('click', this.handleClick); @@ -113,6 +115,24 @@ class Exercisesetting extends Component{ if(this.props.isAdmin() === false){ this.cancelEdit() } + + try { + //是否为助教 + if(this.props.isAssistant()===true){ + //如果是助教是否有权限 + if(this.props.assistant_auth===true){ + this.setState({ + flagPageEdit:true + }) + }else{ + this.setState({ + flagPageEdit:false + }) + } + } + }catch (e) { + + } } componentDidUpdate = (prevProps) => { if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){ diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index b0a337645..12e3f4235 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1158,12 +1158,17 @@ class Studentshavecompletedthelist extends Component { { record.submitstate === "未提交"||record.commit_method===5? - ( - this.props.assistant_auth&&this.props.assistant_auth===true? - ( - this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? - this.Adjustment(record.user_id)}>评阅 + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) : -- ) @@ -1178,7 +1183,7 @@ class Studentshavecompletedthelist extends Component { : -- } - + ) }, ], @@ -1387,12 +1392,17 @@ class Studentshavecompletedthelist extends Component { { record.submitstate === "未提交"||record.commit_method===5? - ( - this.props.assistant_auth&&this.props.assistant_auth===true? - ( - this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? - this.Adjustment(record.user_id)}>评阅 + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) : -- ) @@ -1407,7 +1417,7 @@ class Studentshavecompletedthelist extends Component { : -- } - + ) }, ],//columnsystwo 也会被columnsys当作参数接收 diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index 17f95b352..88d1755f0 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -297,7 +297,9 @@ class Testpapersettinghomepage extends Component{ render(){ let {tab,visible,Commonheadofthetestpaper,exercise_status,assistant_auth}=this.state; const isAdmin =this.props.isAdmin(); - const isStudent = this.props.isStudent(); + const isAssistant=this.props.isAssistant(); + + const isStudent = this.props.isStudent(); // TODO //console.log(Commonheadofthetestpaper.exercise_status); @@ -361,7 +363,26 @@ class Testpapersettinghomepage extends Component{
- {this.props.isAdmin()===true? + {isAssistant===true? + ( + assistant_auth===true? + + 答题列表 + 统计结果 + 试卷预览 + 设置 + + : + + 答题列表 + {Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true? + Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status===3? + 统计结果:"":""} + 设置 + + ) + : + this.props.isAdmin()===true? 答题列表 统计结果 @@ -445,7 +466,23 @@ class Testpapersettinghomepage extends Component{ getsetdata={this.getsetdata} > :"":""} - {isAdmin === true? 编辑试卷:""} + {/*const isAdminOrTeacher*/} + {/*assistant_auth===true*/} + {/**/} + {isAdmin === true? + ( + isAssistant===true? + ( + assistant_auth===true? + 编辑试卷 + : + "" + ) + + : + 编辑试卷 + ) + :""} {isAdmin === false && this.props.current_user !== undefined? Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status===2? diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 27ed40437..1731a55fa 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -276,6 +276,10 @@ export function TPMIndexHOC(WrappedComponent) { isAdminOrTeacher = () => { return this.state.coursedata&&this.state.coursedata.course_identity < 4 } + // 助教===4 + isAssistant=()=>{ + return this.state.coursedata&&this.state.coursedata.course_identity ===4 + } // 超管、运维、课堂管理、老师、助教0-4 isAdmin = () => { return this.state.coursedata&&this.state.coursedata.course_identity < 5 @@ -711,6 +715,7 @@ export function TPMIndexHOC(WrappedComponent) { isAdmin: this.isAdmin, isAdminOrTeacher: this.isAdminOrTeacher, + isAssistant:this.isAssistant, isStudent: this.isStudent, isAdminOrStudent: this.isAdminOrStudent, isNotMember: this.isNotMember, From 7e3a7fb8914263be0bc09e7e56630f4d4f7f36f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 19:27:07 +0800 Subject: [PATCH 15/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Exercisesetting.js | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index ed3db102c..0acfec901 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -674,13 +674,22 @@ class Exercisesetting extends Component{ 发布设置 { !flagPageEdit&&this.props.isAdmin()===true ? - - 编辑设置 - {/**/} - {/**/} - {/**/} - - :"" + ( + this.props.isAssistant()===true? + ( + this.props.assistant_auth===true? + + 编辑设置 + + : + "" + ) + : + + 编辑设置 + + ) + :"" }

@@ -868,7 +877,10 @@ class Exercisesetting extends Component{
取消 -
:"" +
+ + + :"" } From 2f024d6bcee4b2e2d646e5160caa15af09d3dab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 19:36:11 +0800 Subject: [PATCH 16/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 98c56ff37..f54c99978 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -130,16 +130,17 @@ class CoursesBanner extends Component { axios.get(url,{params: dataqueryss }).then((result) => { - if(result.data.status===-2){ - // this.setState({ - // AccountProfiletype:true, - // content:result.data.message, - // okText:"立即认证", - // cannelText:"稍后认证", - // okHref:`/account/certification`, - // Accounturltype:true - // }) - }else{ + try { + if(result.data.status===-2){ + // this.setState({ + // AccountProfiletype:true, + // content:result.data.message, + // okText:"立即认证", + // cannelText:"稍后认证", + // okHref:`/account/certification`, + // Accounturltype:true + // }) + }else{ if( result!=undefined){ let data = result.data; this.setState({ @@ -150,8 +151,12 @@ class CoursesBanner extends Component { }else{ this.onloadupdatabanner() } + } + }catch (e) { + } + }) }; foo=(url)=> { From 40f5cbd4a1557f046248d5d503b4bcc127b3c432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 19:57:25 +0800 Subject: [PATCH 17/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Exercisesetting.js | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index 0acfec901..2a43f42fb 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -604,9 +604,33 @@ class Exercisesetting extends Component{ modalSave:this.cancelBox }) }else{ - this.setState({ - flagPageEdit:true - }) + if(this.props.isAdmin()===true){ + try { + //是否为助教 + if(this.props.isAssistant()===true){ + //如果是助教是否有权限 + if(this.props.assistant_auth===true){ + this.setState({ + flagPageEdit:true + }) + }else{ + this.setState({ + flagPageEdit:false + }) + } + }else{ + //是老师 + this.setState({ + flagPageEdit:true + }) + } + }catch (e) { + this.setState({ + flagPageEdit:true + }) + } + } + } } //取消编辑 From 183892304162fe91ad89d63af71809c2486dc8da Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 20:28:25 +0800 Subject: [PATCH 18/47] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=AD=90=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/homework_common.rb | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index a6a919981..58a420581 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -69,17 +69,18 @@ class HomeworkCommon < ApplicationRecord # 作业对应的子目录/父目录名称 def category_info - case self.homework_type - when 'normal' - {category_id: course.common_course_modules.first.try(:id), category_name: course.common_course_modules.first.try(:module_name), main: 1} - when 'group' - {category_id: course.group_course_modules.first.try(:id), category_name: course.group_course_modules.first.try(:module_name), main: 1} - when 'practice' - if self.course_second_category.present? - {category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name), main: 0} - else - {category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name), main: 1} - end + if self.course_second_category.present? + {category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name), main: 0} + else + course_module = case homework_type + when 'normal' + course.common_course_modules.take + when 'group' + course.group_course_modules.take + when 'practice' + course.shixun_course_modules.take + end + {category_id: course_module.try(:id), category_name: course_module.try(:module_name), main: 1} end end From c48b37699d138b542684885f111e3474d0b474d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 20:29:05 +0800 Subject: [PATCH 19/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 12e3f4235..755537798 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1177,9 +1177,26 @@ class Studentshavecompletedthelist extends Component { target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅 ) :record.submitstate === "已提交"? - {record.finalscore} + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + {record.finalscore} + : + -- + ) + : + -- + ) + : + {record.finalscore} + ) : -- } @@ -1411,9 +1428,28 @@ class Studentshavecompletedthelist extends Component { target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅 ) :record.submitstate === "已提交"? - {record.finalscore} + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + //是助教就是评阅 + {record.finalscore} + : + -- + ) + : + -- + ) + : + //是老师就是评阅 + {record.finalscore} + ) : -- } From c16057ba7d188286f98dc26f409c072c93043954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 20:43:41 +0800 Subject: [PATCH 20/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 755537798..5944e9c6f 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1162,6 +1162,9 @@ class Studentshavecompletedthelist extends Component { this.props.isAssistant()&&this.props.isAssistant()===true? (//助教是否有权限 this.props.assistant_auth&&this.props.assistant_auth===true? + this.Adjustment(record.user_id)}>评阅 + : (//是否截止 this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? -- ) - : - -- ) : {record.finalscore} + : (//是否截止 this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? -- ) - : - -- ) : this.Adjustment(record.user_id)}>评阅 + : (//是否截止 this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? -- ) - : - -- ) : {record.finalscore} + : (//是否截止 this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? //是助教就是评阅 @@ -1441,8 +1449,6 @@ class Studentshavecompletedthelist extends Component { : -- ) - : - -- ) : //是老师就是评阅 From 01d8a87c3903a8b1ec9539657e2cc1e6377a80db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 20:54:44 +0800 Subject: [PATCH 21/47] =?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/courses/exercise/Exercisesetting.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index 2a43f42fb..0bd596c35 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -890,7 +890,7 @@ class Exercisesetting extends Component{ 助教权限 )} - (勾选则允许助教查看答案) + (选中,则允许助教查看答案)

From 119a76a58557daeae568649a63b424b1a42f82f7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 21:02:48 +0800 Subject: [PATCH 22/47] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E5=AD=90?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 10 +++++++++- app/views/homework_commons/edit.json.jbuilder | 12 +++++++++++- app/views/homework_commons/new.json.jbuilder | 10 +++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index adf0dc6bf..faea30242 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -359,6 +359,9 @@ class HomeworkCommonsController < ApplicationController def new tip_exception("type参数有误") if params[:type].blank? || ![1, 3].include?(params[:type].to_i) @homework_type = params[:type].to_i + module_type = params[:type].to_i == 1 ? "common_homework" : "group_homework" + @main_category = @course.course_modules.find_by(module_type: module_type) + @category = @main_category.course_second_categories.find_by(id: params[:category]) if params[:category].present? end def create @@ -409,7 +412,12 @@ class HomeworkCommonsController < ApplicationController end def edit - + if @homework.course_second_category_id == 0 + module_type = @homework.homework_type == "normal" ? "common_homework" : "group_homework" + @main_category = @course.course_modules.find_by(module_type: module_type) + else + @category = @homework.course_second_category + end end def update diff --git a/app/views/homework_commons/edit.json.jbuilder b/app/views/homework_commons/edit.json.jbuilder index 49dc11dd8..d2eb865ac 100644 --- a/app/views/homework_commons/edit.json.jbuilder +++ b/app/views/homework_commons/edit.json.jbuilder @@ -1,6 +1,16 @@ json.course_id @course.id json.course_name @course.name -json.category @homework.category_info +# json.category @homework.category_info + +json.category do + if @category.present? + json.category_id @category.id + json.category_name @category.name + else + json.category_id @main_category&.id + json.category_name @main_category&.module_name + end +end json.(@homework, :id, :name, :description, :reference_answer) diff --git a/app/views/homework_commons/new.json.jbuilder b/app/views/homework_commons/new.json.jbuilder index 82a5d78fa..9a703d40f 100644 --- a/app/views/homework_commons/new.json.jbuilder +++ b/app/views/homework_commons/new.json.jbuilder @@ -1,3 +1,11 @@ json.course_id @course.id json.course_name @course.name -json.category @course.category_info(@homework_type == 1 ? "common_homework" : "group_homework") \ No newline at end of file +json.category do + if @category.present? + json.category_id @category.id + json.category_name @category.name + else + json.category_id @main_category&.id + json.category_name @main_category&.module_name + end +end \ No newline at end of file From 3bf8e6d80175ad6402d8a4ed374ef45e7ac93074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 21:05:58 +0800 Subject: [PATCH 23/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 271 +----------------- 1 file changed, 7 insertions(+), 264 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 5944e9c6f..1d391bb2c 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1207,262 +1207,7 @@ class Studentshavecompletedthelist extends Component { ) }, ], - columnsystwo: [ - { - title: '序号', - dataIndex: 'number', - key: 'number', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.number === "--" ? - -- - : - {record.number} - } - - ) - }, - { - title: '姓名', - dataIndex: 'name', - key: 'name', - align: 'center', - className: "edu-txt-center font-14", - - render: (text, record) => ( - - {record.name==="--"? - {record.name} - : - {record.name} - } - - ) - }, - { - title: '学号', - dataIndex: 'stduynumber', - key: 'stduynumber', - align: 'center', - className: "edu-txt-center font-14", - sorter: true, - sortDirections: sortDirections, - render: (text, record) => ( - - {record.stduynumber === "--" ? - {record.stduynumber} - : - {record.stduynumber} - } - - ), - }, - { - title: '分班', - key: 'classroom', - dataIndex: 'classroom', - align: 'center', - className: "edu-txt-center font-14 maxnamewidth260 ", - width:'260px', - render: (text, record) => ( - - {record.classroom==="--"? - {record.classroom} - : - {record.classroom} - } - - ) - }, - { - title: '提交状态', - dataIndex: 'submitstate', - key: 'submitstate', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.submitstate} - - - ) - - }, - { - title: '提交时间', - dataIndex: 'updatetime', - key: 'updatetime', - align: 'center', - className: "edu-txt-center font-14", - sorter: true, - defaultSortOrder: 'descend', - sortDirections: sortDirections, - render: (text, record) => ( - - {record.updatetime==="--"? - -- - : - {record.updatetime} - } - - ), - }, - { - title: '客观题得分', - dataIndex: 'completion', - key: 'completion', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.completion=== "--"? - -- - : - {record.completion} - } - - ) - }, - { - title: '主观题得分', - dataIndex: 'levelscore', - key: 'levelscore', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.levelscore==="--"? - -- - : - {record.levelscore} - } - - ) - }, - { - title: '最终成绩', - dataIndex: 'efficiencyscore', - key: 'efficiencyscore', - align: 'center', - className: "edu-txt-center font-14", - sorter: true, - sortDirections: sortDirections, - render: (text, record) => ( - - {record.efficiencyscore === "--" ? - -
未评分
-
}> - -- - - : - record.commit_method===5? - -
最终调整成绩:{record.efficiencyscore}分
- }> - 90 ? { - color: '#DD1717', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 90 ? { - color: '#FF6800', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 60 ? { - color: '#747A7F', - textAlign: "center", - } : { - color: '#747A7F', - textAlign: "center", - }}>{record.efficiencyscore} -
- : - 90 ? { - color: '#DD1717', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 90 ? { - color: '#FF6800', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 60 ? { - color: '#747A7F', - textAlign: "center", - } : { - color: '#747A7F', - textAlign: "center", - }}>{record.efficiencyscore} - } - - ) - }, - { - title: '操作', - dataIndex: 'finalscore', - key: 'finalscore', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - { - record.submitstate === "未提交"||record.commit_method===5? - (//是否助教 - this.props.isAssistant()&&this.props.isAssistant()===true? - (//助教是否有权限 - this.props.assistant_auth&&this.props.assistant_auth===true? - this.Adjustment(record.user_id)}>评阅 - : - (//是否截止 - this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? - this.Adjustment(record.user_id)}>评阅 - : - -- - ) - ) - : - this.Adjustment(record.user_id)}>评阅 - ) - :record.submitstate === "已提交"? - (//是否助教 - this.props.isAssistant()&&this.props.isAssistant()===true? - (//助教是否有权限 - this.props.assistant_auth&&this.props.assistant_auth===true? - {record.finalscore} - : - (//是否截止 - this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? - //是助教就是评阅 - {record.finalscore} - : - -- - ) - ) - : - //是老师就是评阅 - {record.finalscore} - ) - : - -- - } - - ) - }, - ],//columnsystwo 也会被columnsys当作参数接收 + columnsystwo: [],// 也会被columnsys当作参数接收 exercise_status:0, order_type: "desc", exeuserid: 0, @@ -1523,20 +1268,18 @@ class Studentshavecompletedthelist extends Component { } componentDidMount() { - // if(this.props.isAdmin() === true){ - // this.Teacherliststudentlistsy(); - // //console.log("1111111111111111"); - // //console.log(this.props.isAdmin()); - // }else { + //被columnsys当作参数接收 + this.setState({ + columnsystwo:this.state.columnsys, + }) this.Teacherliststudentlist(); - // //console.log("2222222222222"); - // //console.log(this.props.isAdmin()); - // } + try { this.props.triggerRef(this); }catch (e) { } + } componentWillReceiveProps = (nextProps) => { From bfdb6b13b8a56e8e720a121f9488c91860946fb8 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 21:06:32 +0800 Subject: [PATCH 24/47] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E7=9B=AE=E5=BD=95id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/index.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/files/index.json.jbuilder b/app/views/files/index.json.jbuilder index 0002cf299..e7805c0d8 100644 --- a/app/views/files/index.json.jbuilder +++ b/app/views/files/index.json.jbuilder @@ -14,6 +14,7 @@ json.data do json.partial! "users/user_simple", user: attachment.author end # json.partial! "files/course_groups", attachment_group_settings: attachment.attachment_group_settings + json.category_id attachment.course_second_category_id if @course_second_category_id.to_i == 0 json.category_name attachment.course_second_category&.name end From 41c04d9499787aadc5c5c3087fbebc1cf691f7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 21:12:03 +0800 Subject: [PATCH 25/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Studentshavecompletedthelist.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 1d391bb2c..3b46b680a 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -28,6 +28,7 @@ const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; const {Option} = Select; //学生老师页面 +let columnsystwo=[]; class Studentshavecompletedthelist extends Component { // http://localhost:3007/courses/1309/exercises/722/exercises/student_exercise_list?debug=s constructor(props) { @@ -1207,7 +1208,7 @@ class Studentshavecompletedthelist extends Component { ) }, ], - columnsystwo: [],// 也会被columnsys当作参数接收 + // 也会被columnsys当作参数接收 exercise_status:0, order_type: "desc", exeuserid: 0, @@ -1269,9 +1270,10 @@ class Studentshavecompletedthelist extends Component { componentDidMount() { //被columnsys当作参数接收 - this.setState({ - columnsystwo:this.state.columnsys, - }) + // console.log("componentDidMount"); + // console.log(columnsystwo); + columnsystwo=this.state.columnsys; + // console.log(columnsystwo); this.Teacherliststudentlist(); try { @@ -1980,7 +1982,7 @@ class Studentshavecompletedthelist extends Component { course_groups: response.data.course_groups, mylistansum:response.data.exercise_types.answer_users+response.data.exercise_types.unanswer_users, loadingstate: false, - columnsys: this.state.columnsystwo, + columnsys: columnsystwo, subjective: response.data.exercise_types.subjective, objective_score: response.data.exercise_types.objective_score, subjective_score: response.data.exercise_types.subjective_score, From 47b544df4e8f333f33ee7429ea9c4ae6e52cc6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 21:12:20 +0800 Subject: [PATCH 26/47] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/exercise/Studentshavecompletedthelist.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 3b46b680a..c3d4bf465 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1272,7 +1272,11 @@ class Studentshavecompletedthelist extends Component { //被columnsys当作参数接收 // console.log("componentDidMount"); // console.log(columnsystwo); + try { columnsystwo=this.state.columnsys; + }catch (e) { + + } // console.log(columnsystwo); this.Teacherliststudentlist(); From 1c8452dd289643e84e4c227a55987ceb8a4593f6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 21:12:36 +0800 Subject: [PATCH 27/47] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercises/exercise_setting.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercises/exercise_setting.json.jbuilder b/app/views/exercises/exercise_setting.json.jbuilder index 25c6fa588..84cd31c55 100644 --- a/app/views/exercises/exercise_setting.json.jbuilder +++ b/app/views/exercises/exercise_setting.json.jbuilder @@ -1,7 +1,7 @@ json.exercise do json.extract! @exercise, :id,:exercise_name, :exercise_status,:time,:publish_time, :end_time,:score_open,:answer_open,:question_random,:choice_random, - :unified_setting,:show_statistic + :unified_setting,:show_statistic,:assistant_auth json.course_id @course.id json.published_count @exercise_publish_count json.unpublish_count @exercise_unpublish_count From 98e2b0448187d2ca8b826d613f27460762e037bc Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 21:14:53 +0800 Subject: [PATCH 28/47] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index e5d9fc495..cf67746ac 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -399,7 +399,7 @@ class ExercisesController < ApplicationController choice_random = params[:choice_random] ? true : false score_open = params[:score_open] ? true : false #分数是否公开 answer_open = params[:answer_open] ? true : false #答案是否公开 - assistant_auth = params[:assistant_auth] ? true : false # 助教权限 + assistant_auth = params[:assistant_auth] # 助教权限 # 统一设置或者分班为0,则更新试卷,并删除试卷分组 if unified_setting || (course_group_ids.size == 0) @@ -532,7 +532,8 @@ class ExercisesController < ApplicationController :answer_open => answer_open, :exercise_status => exercise_status, :publish_time => p_time, - :end_time => e_time + :end_time => e_time, + :assistant_auth => assistant_auth } @exercise.update!(exercise_params) if @exercise.exercise_status == Exercise::PUBLISHED From f83354dc9dd63fcc65a9a307c3c03dfa5c99b415 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 21:33:32 +0800 Subject: [PATCH 29/47] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index cf67746ac..73bd07954 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -774,10 +774,11 @@ class ExercisesController < ApplicationController ex_group_setting = exercise.exercise_group_settings old_exercise_groups = ex_group_setting.find_in_exercise_group("course_group_id", g_course) #试卷的分组设置 left_course_groups = teacher_course_group_ids - g_course + all_left_groups = all_course_group_ids - g_course left_exercise_groups = ex_group_setting.find_in_exercise_group("course_group_id", left_course_groups) if left_exercise_groups.blank? && exercise.unified_setting - if left_course_groups.size > 0 #开始为统一设置,但是立即截止为分班。则创建没有立即截止的班级的exercise_group_setting - left_course_groups.each do |g| + if all_left_groups.size > 0 #开始为统一设置,但是立即截止为分班。则创建没有立即截止的班级的exercise_group_setting + all_left_groups.each do |g| ex_group_options = { :exercise_id => exercise.id, :course_group_id => g, 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 30/47] =?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 31/47] =?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 32/47] =?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 33/47] =?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 9c337ef66bfa50051ac13ad9f06aad6800205876 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 12 Mar 2020 10:55:59 +0800 Subject: [PATCH 34/47] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../watch_video_histories_controller.rb | 2 ++ app/models/watch_video_history.rb | 2 ++ app/services/create_watch_video_service.rb | 17 +++++++++++------ ...d_total_duration_to_watch_video_histories.rb | 5 +++++ 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20200312014100_add_total_duration_to_watch_video_histories.rb diff --git a/app/controllers/watch_video_histories_controller.rb b/app/controllers/watch_video_histories_controller.rb index 996c76d24..15ee62113 100644 --- a/app/controllers/watch_video_histories_controller.rb +++ b/app/controllers/watch_video_histories_controller.rb @@ -4,5 +4,7 @@ class WatchVideoHistoriesController < ApplicationController def create watch_log = CreateWatchVideoService.new(current_user, request, params).call render_ok(log_id: watch_log&.id) + rescue CreateWatchVideoService::Error => ex + render_error(ex.message) end end diff --git a/app/models/watch_video_history.rb b/app/models/watch_video_history.rb index 0f9ab4a8a..36f7be0f3 100644 --- a/app/models/watch_video_history.rb +++ b/app/models/watch_video_history.rb @@ -2,4 +2,6 @@ class WatchVideoHistory < ApplicationRecord belongs_to :user belongs_to :video belongs_to :watch_course_video, optional: true + + validates :duration, numericality: { greater_than_or_equal_to: 0 } end diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index b16a65535..c7b3bb3bb 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -11,20 +11,25 @@ class CreateWatchVideoService < ApplicationService ActiveRecord::Base.transaction do current_time = Time.now if params[:log_id].present? + if params[:total_duration].to_f < params[:watch_duration].to_f || params[:watch_duration].to_f < 0 + raise Error, '观看时长错误' + end # 更新观看时长 watch_video_history = user.watch_video_histories.find(params[:log_id]) - if watch_video_history.present? && watch_video_history.watch_duration < params[:watch_duration].to_f - # 如果观看时长少于原有的,说明拖放到前面重新观看了,不必再去记录 + if watch_video_history.present? && watch_video_history.watch_duration <= params[:watch_duration].to_f && params[:total_duration].to_f > watch_video_history.total_duration + # 如果观看总时长没变,说明视频没有播放,无需再去记录 + watch_video_history.end_at = current_time - watch_video_history.watch_duration = params[:watch_duration] + watch_video_history.total_duration = params[:total_duration] + watch_video_history.watch_duration = params[:watch_duration].to_f > watch_video_history.duration ? watch_video_history.duration : params[:watch_duration] watch_video_history.is_finished = (watch_video_history.duration <= params[:watch_duration].to_f) watch_video_history.save! watch_course_video = watch_video_history.watch_course_video if watch_course_video.present? && !watch_course_video.is_finished && watch_course_video.watch_duration < params[:watch_duration].to_f - # 更新课程视频的时长及是否看完 + # 更新课程视频的时长及是否看完状态 watch_course_video.watch_duration = params[:watch_duration] watch_course_video.is_finished = (watch_course_video.duration <= params[:watch_duration].to_f) watch_course_video.end_at = current_time @@ -35,7 +40,7 @@ class CreateWatchVideoService < ApplicationService # 开始播放时记录一次 if params[:course_id].present? # 课堂视频 - course_video = CourseVideo.find_by(course_id: params[:course_id], video_id: params[:video_id]) + course_video = CourseVideo.find_by(params[:course_video_id]) watch_course_video = WatchCourseVideo.find_or_initialize_by(course_video_id: course_video.id, user_id: user.id) do |d| d.start_at = current_time d.duration = params[:duration] @@ -57,7 +62,7 @@ class CreateWatchVideoService < ApplicationService end - def build_video_log(current_time, video_id, watch_course_video_id) + def build_video_log(current_time, video_id, watch_course_video_id=nil) WatchVideoHistory.new( user_id: user.id, watch_course_video_id: watch_course_video_id, diff --git a/db/migrate/20200312014100_add_total_duration_to_watch_video_histories.rb b/db/migrate/20200312014100_add_total_duration_to_watch_video_histories.rb new file mode 100644 index 000000000..e595384e0 --- /dev/null +++ b/db/migrate/20200312014100_add_total_duration_to_watch_video_histories.rb @@ -0,0 +1,5 @@ +class AddTotalDurationToWatchVideoHistories < ActiveRecord::Migration[5.2] + def change + add_column :watch_video_histories, :total_duration, :float, default: 0 + end +end From 450ba26dc72d822f47572d1d9744e2bc4a1b4496 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 12 Mar 2020 11:05:35 +0800 Subject: [PATCH 35/47] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E8=A7=86=E9=A2=91id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index c7b3bb3bb..8e4297aee 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -40,7 +40,7 @@ class CreateWatchVideoService < ApplicationService # 开始播放时记录一次 if params[:course_id].present? # 课堂视频 - course_video = CourseVideo.find_by(params[:course_video_id]) + course_video = CourseVideo.find_by(course_id: params[:course_id], video_id: params[:video_id]) watch_course_video = WatchCourseVideo.find_or_initialize_by(course_video_id: course_video.id, user_id: user.id) do |d| d.start_at = current_time d.duration = params[:duration] From eddb4440721173e763db02bdd227ef1ed34d0acb Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 12 Mar 2020 11:27:52 +0800 Subject: [PATCH 36/47] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=97=B6=E9=95=BFid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index 8e4297aee..c7b3bb3bb 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -40,7 +40,7 @@ class CreateWatchVideoService < ApplicationService # 开始播放时记录一次 if params[:course_id].present? # 课堂视频 - course_video = CourseVideo.find_by(course_id: params[:course_id], video_id: params[:video_id]) + course_video = CourseVideo.find_by(params[:course_video_id]) watch_course_video = WatchCourseVideo.find_or_initialize_by(course_video_id: course_video.id, user_id: user.id) do |d| d.start_at = current_time d.duration = params[:duration] From 03be8d94f81d948ab428711f1a7bf3fac7c447a2 Mon Sep 17 00:00:00 2001 From: harry Date: Thu, 12 Mar 2020 11:54:38 +0800 Subject: [PATCH 37/47] =?UTF-8?q?fix=20=E5=AE=9E=E8=AE=AD=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/paths/ShixunPathSearch.js | 4 +- public/react/src/modules/paths/btn-new.png | Bin 0 -> 2745 bytes public/react/src/modules/tpm/TPMIndex.css | 452 +++++++++++------- .../src/modules/tpm/shixuns/ShixunsIndex.js | 2 +- .../tpm/shixuns/shixun-keyword-list.scss | 4 + 5 files changed, 276 insertions(+), 186 deletions(-) create mode 100644 public/react/src/modules/paths/btn-new.png diff --git a/public/react/src/modules/paths/ShixunPathSearch.js b/public/react/src/modules/paths/ShixunPathSearch.js index be1d3a33c..844215974 100644 --- a/public/react/src/modules/paths/ShixunPathSearch.js +++ b/public/react/src/modules/paths/ShixunPathSearch.js @@ -8,7 +8,7 @@ import Pagination from '@icedesign/base/lib/pagination'; import '@icedesign/base/lib/pagination/style.js'; import './ShixunPaths.css'; import KeywordList from '../tpm/shixuns/shixun-keyword-list'; -import btnUrl from '../tpm/shixuns/btn-new.png'; +import btnUrl from './btn-new.png'; class ShixunPathSearch extends Component { constructor(props) { @@ -252,7 +252,7 @@ class ShixunPathSearch extends Component { - + { diff --git a/public/react/src/modules/paths/btn-new.png b/public/react/src/modules/paths/btn-new.png new file mode 100644 index 0000000000000000000000000000000000000000..b900fa1f48d0f6dcb63e0f4a1c1d5c5394aa178c GIT binary patch literal 2745 zcmV;q3P$ybP)Pxd=S_gELRTlmxy%$1yNTDTk2t}pqiqh6lTowe^1MEuC1B(=QIfAIb z0phYNxa@+6tCS^5k+KMgQX;S*y#@#b(n&9*kT!e2m;B?*081tb=NNC!%>U+}_rLdU z|L)D`P(wC9MD+o5v!O>fK<}^J|9M_@Y0%-6oHM$j_l{VeQO7r7Vy;{k3KQxx?==e2 z>8ga8dBV(MU5zFVL9e%J6o)rIWHmGW*>f8+Fvhw%1`VZ`Pk%r(d@H)|(M@O>VW{RhF-+7X}K{SN<3`v%EnSq-wj`64=- z*eJdE&H8+9o``X?#A)LxcY4Kz_Sge zk>@=+W1289(6cMb^cC2gc|;xfd{Khhw3&TVO!XgviGBm{8}HsYRTwYd@4{DEM^P^G z>r3_0h@+JqUiEoaX`qc$Go+Q}V0GGF^~$O!c<9;8pGhyvRVKG4eIGJKb9JRUF=8xT zPa7BfSa`!A-3onWt!Urr4zuvZP zu+~}QZdo4o=bgpL!s`}o_^`=0N>i~X_Y`iHq^qxk#GfoBi#5UxUi6H_yTN17-L;i$ zo`yw9Ut(j%VN}VVr8K~!3*HSGgQr|uBcb#z7Ry@e?;b>@g=^J`5$&*pJ-cCk$Y^wR zX^9&psaTZwCH^hZsx}Ng=h0CKqo-RN+$qfv2EM`<8Q;SaAJfjktHq31*I1*m#D+HM zj`^aYE-uY+tvCe>lVT8)87qGDV2bMJ-X05rUqNs8wn!|^#FFGKk}MCHFkr8<#eIFb z@i`wmwwRGmTTR2DCSCEdB(+s(dyrRAWY~mBZ(g&}=;RWHtHnuJm>8q-1R3h<)=soH z24p1peioJ_ZNWNWz&M9cAhUu-h=yCB*~#%HYa2Fs#K2-k+BpSdQRu6nSrt{4;*<3K zV3bKI%QkE=-0K<9&}g)G4#DN3M3ve5d2~SP{TwV64Xl-Cm^4XtIvb3WT=Z7pFoZh= zDnD74yj9IHELe+y#f)fclA&2a!!g>suhcerY|K22za(!*TuHJv1ur-4g|~x7Dy&5f zl4;FkJZzjX$#0-arhaywIDIc(p8pzKvyRou#|)d)4C>5?wh)u!43XwU-vMCO-j#C_ zl<0{^gk{d39`KTaD#T*@a?jvH5x}ARi`tTPx?0Q#4@{FG@Vix79rw9&6B}2&5ikUA z_z#Achs{&r0iG>;bl*q;60hvpFNxkw4GGeu(~oAyMdzDl72nwfE+(B{_m zS}#VlO>8BE63$cltsMhZmZxObXB;$ySEY%*Z_q9P8 zF+NRy_YRmN3=Qz?qHfdamrI_A$%-|BBgW6vXZ*w%(GJzYDMST?AL`)1+8VXFHdxL6 zsLd`K<%vhlX^8t47gi0i>62LFm(579y*JuQSEMd9NZLV6ZstUk`y|O^btfx(6*hm} zqzC#+-7s4k0Ic4A>)l7;s{lJM1W4lRci~U)5?C=!5+R9Q6du&u&Ry_S6xO95Kwf1L zPD}5K*_ssFX{jn>3FS9M%u@G^-!2y?V%U{MASQb+gp0z@Z?HDJ1UWgB`Xo_ z)siHfy?0XzrAl0pL;2czV5nDj!)EW?-k>m=tBs=)PMgzHalIr3({8T8sH;mAGT>wu zT^lkEAyTT%;lfy1RfUuRPMC3Pt$GpW@J!}pqLCz7eYxCc$ulOthBd-otwm6)3N#%}jrQ_1&%yd=#^^iux zg~*i%6b-j`3RQVUYv|bs7%i+Uk<_Y#ubl^Mt*ix2yJAQa`PZfpt>R&1Z8afcf%XLp zp>aO_(NQw+Sf75d(OIbnS-Ek6UeYLFQ>{c$DIxc^wsWyb3aa?hG<=_T0mlljO3O4- zH4+M|N|csZn@si_gkA0Cs{<4Dc92qdY}|(;^%kleps@P7w^LPNAGxwa!#{lff zIfdI|O4Kx8ITeNYHt(DX{O9>iH1b{Ec_~fr;AyuA{6WCr#OohPIeT95hFU~S=ee1U{;>u!-YT8@*t0rvidbHpw5(VyPWWoql9n)qGoUI(BP;$YR zwtvPaY5SDpvF-@8_rk91lTw!6M0b}~AXL9DZ6KQDSOJaHAT>3>v$J9})WKI(fcfJ1 zIU)#>i?xI5nsDrGI}-bI&q~cw-RNc@NfmrHMT#>DjPZbJ6a5OZ68Z0_iBwh2542ry%@G{E-@F3iXbIb_BuQjql9($G_@A5~6*CkZtHD-|{#cf@RWU-dU68m*J;Ts_?%pjan=j#_ znEXBI+Hg#>GA9#8Iy*PV4k?Oyh*XNjH|E~{0_4U`0Dttd9!QsvL)v6~}Z9?TLXi)mMCHa!rpUf^V zR9bWqe*hrZiGc zs((}yZKZziq|?oBl+66}GpAU?@3R{F56}Jw=xne7bneiE00000NkvXXu0mjfB?Ur` literal 0 HcmV?d00001 diff --git a/public/react/src/modules/tpm/TPMIndex.css b/public/react/src/modules/tpm/TPMIndex.css index 2ec090e7d..325b0fc54 100644 --- a/public/react/src/modules/tpm/TPMIndex.css +++ b/public/react/src/modules/tpm/TPMIndex.css @@ -4,48 +4,58 @@ } */ body { overflow: auto !important; - font-family: "Microsoft YaHei"; + font-family: "Microsoft YaHei"; } #root { - /* ie兼容性 */ - position: relative; - min-height: 100%; + /* ie兼容性 */ + position: relative; + min-height: 100%; } + body>.-task-title { - opacity: 1 !important; + opacity: 1 !important; } + /*�����Ŵ󾵵�����·Ŵ󾵵�λ��*/ #root .search-all { - width: 219px; + width: 219px; } /*Header START*/ .newHeader .logoimg { - margin-top: 16px; - float: left; - width: 97px; + margin-top: 16px; + float: left; + width: 97px; } + .head-right i { - font-size: 20px; - float: none !important; + font-size: 20px; + float: none !important; } -.headIcon, #header_keyword_search { - padding-top: 13px !important; + +.headIcon, +#header_keyword_search { + padding-top: 13px !important; } + .search-icon { - height: 30px !important; + height: 30px !important; } + .search-icon i { - font-size: 20px; + font-size: 20px; } + #header_keyword_search i { - color: #4cacff; + color: #4cacff; } -.ant-select-selection--multiple{ - padding-bottom: 0px!important; - padding-top:3px; + +.ant-select-selection--multiple { + padding-bottom: 0px !important; + padding-top: 3px; } + /* 先注释掉下面2个样式,这样写影响范围太广了,并不是所有的select都需要40px高 */ /* .ant-select-selection--single{ height:40px!important; @@ -53,247 +63,323 @@ body>.-task-title { .ant-select-selection__rendered{ line-height: 40px!important; } */ -.ant-select-selection--multiple .ant-select-selection__rendered>ul>li, .ant-select-selection--multiple>ul>li{ - height: 25px!important; - line-height: 23px!important; - margin-bottom:3px; - margin-top:0px; +.ant-select-selection--multiple .ant-select-selection__rendered>ul>li, +.ant-select-selection--multiple>ul>li { + height: 25px !important; + line-height: 23px !important; + margin-bottom: 3px; + margin-top: 0px; } + /*Main START*/ -.newContainer{ - background: #fafafa!important; +.newContainer { + background: #fafafa !important; } -.ant-modal-title{ - font-size: 16px; - font-weight: bold !important; - color: #333; +.ant-modal-title { + font-size: 16px; + font-weight: bold !important; + color: #333; } -.ant-modal-title{ - text-align: center; +.ant-modal-title { + text-align: center; } + /*.ant-modal{*/ - /*top:10rem !important;*/ +/*top:10rem !important;*/ /*}*/ @-moz-document url-prefix() { - .ant-radio-inner { - width: 17px !important; - height: 17px !important; - } + .ant-radio-inner { + width: 17px !important; + height: 17px !important; + } } + /* IE只能用padding,不能用上下居中 */ -.shixunDetail_top{ - display: block!important; - padding-top: 48px; -} -.totalScore{ - display: block!important; - padding-top: 40px; +.shixunDetail_top { + display: block !important; + padding-top: 48px; } -.head-nav ul#header-nav li{ - /*font-weight: 600;*/ + +.totalScore { + display: block !important; + padding-top: 40px; } + /*.newFooter{*/ - /*position: fixed !important;*/ +/*position: fixed !important;*/ /*}*/ -.edu-menu-panel .edu-menu-listnew:hover .careersiconfont{ - color: #000 !important; +.edu-menu-panel .edu-menu-listnew:hover .careersiconfont { + color: #000 !important; } .newHeader { - background: #24292D !important; - height: 60px !important; + background: #24292D !important; + height: 60px !important; } /*-------------------个人主页:右侧提示区域--------------------------*/ -.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:80px !important;z-index: 10;} -.-task-sidebar>div{height: 40px;line-height: 40px;box-sizing: border-box;width:40px;background:#4CACFF;color:#fff;font-size:20px;text-align:center;margin-bottom:5px;border-radius: 4px;} -.-task-sidebar>div i{ color:#fff;} -.-task-sidebar>div i:hover{color: #fff!important;} -.gotop{background-color: rgba(208,207,207,0.5)!important;padding: 0px!important;} -.-task-desc{background:#494949;width:90px;line-height: 36px;text-align: center; - position: absolute;color: #fff;font-size: 13px;z-index: 999999;opacity: 0;} -.-task-desc div{position: absolute;top:10px;right: -7px;height: 13px;} -.-task-desc div img{float: left} -.-task-sidebar .scan_ewm{ - position: absolute !important; - right: 45px !important; - bottom: 0px !important; - background-color: #494949 !important; - -webkit-box-sizing: border-box !important; - box-sizing: border-box !important; - font-size: 14px !important; - line-height: 16px !important; - display: none; - height: 213px !important; -} -.trangle_right{position: absolute;right: -5px;bottom: 15px;width: 0;height: 0px;border-top: 6px solid transparent;border-left: 5px solid #494949;border-bottom: 6px solid transparent} - -.HeaderSearch{ - margin-top: 18px; - margin-right: 20px; -} -.HeaderSearch .ant-input-search .ant-input{ - /*height:30px;*/ - background: #373e3f !important; - border: 1px solid #373e3f !important; - -} -.ant-input-search .ant-input-affix-wrapper{ - border:transparent; +.-task-sidebar { + position: fixed; + width: 40px; + height: 180px; + right: 0; + bottom: 20px !important; + z-index: 10; +} + +.-task-sidebar>div { + height: 40px; + line-height: 40px; + box-sizing: border-box; + width: 40px; + background: #4CACFF; + color: #fff; + font-size: 20px; + text-align: center; + margin-bottom: 5px; + border-radius: 4px; +} + +.-task-sidebar>div i { + color: #fff; +} + +.-task-sidebar>div i:hover { + color: #fff !important; +} + +.gotop { + background-color: rgba(208, 207, 207, 0.5) !important; + padding: 0px !important; +} + +.-task-desc { + background: #494949; + width: 90px; + line-height: 36px; + text-align: center; + position: absolute; + color: #fff; + font-size: 13px; + z-index: 999999; + opacity: 0; +} + +.-task-desc div { + position: absolute; + top: 10px; + right: -7px; + height: 13px; } + +.-task-desc div img { + float: left +} + +.-task-sidebar .scan_ewm { + position: absolute !important; + right: 45px !important; + bottom: 0px !important; + background-color: #494949 !important; + -webkit-box-sizing: border-box !important; + box-sizing: border-box !important; + font-size: 14px !important; + line-height: 16px !important; + display: none; + height: 213px !important; +} + +.trangle_right { + position: absolute; + right: -5px; + bottom: 15px; + width: 0; + height: 0px; + border-top: 6px solid transparent; + border-left: 5px solid #494949; + border-bottom: 6px solid transparent +} + +.HeaderSearch { + margin-top: 18px; + margin-right: 20px; +} + +.HeaderSearch .ant-input-search .ant-input { + /*height:30px;*/ + background: #373e3f !important; + border: 1px solid #373e3f !important; + +} + +.ant-input-search .ant-input-affix-wrapper { + border: transparent; +} + .ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled) { - /* 比较奇怪的需求,先注释掉了,如果需要启用,麻烦增加class限制,别影响别的地方的使用 */ - /* border-color: transparent; */ + /* 比较奇怪的需求,先注释掉了,如果需要启用,麻烦增加class限制,别影响别的地方的使用 */ + /* border-color: transparent; */ } .ant-input:focus { - /*border-color: transparent;*/ - border-right-width: 1px !important; - outline: 0; - -webkit-box-shadow: 0 0 0 2px transparent; - box-shadow: 0 0 0 2px transparent; - border: 1px solid #d9d9d9; + /*border-color: transparent;*/ + border-right-width: 1px !important; + outline: 0; + -webkit-box-shadow: 0 0 0 2px transparent; + box-shadow: 0 0 0 2px transparent; + border: 1px solid #d9d9d9; } -.HeaderSearch .ant-input-search .ant-input::-webkit-input-placeholder{ - color: #999; - font-size: 14px; +.HeaderSearch .ant-input-search .ant-input::-webkit-input-placeholder { + color: #999; + font-size: 14px; } .HeaderSearch .ant-input-search .ant-input:-moz-placeholder { - color: #999; - font-size: 14px; + color: #999; + font-size: 14px; } -.HeaderSearch .ant-input-search .ant-input::-moz-placeholder{ - color: #999; - font-size: 14px; +.HeaderSearch .ant-input-search .ant-input::-moz-placeholder { + color: #999; + font-size: 14px; } -.HeaderSearch .ant-input-search .ant-input:-ms-input-placeholder{ - color: #999; - font-size: 14px; +.HeaderSearch .ant-input-search .ant-input:-ms-input-placeholder { + color: #999; + font-size: 14px; } .HeaderSearch .ant-input-search .ant-input-suffix .anticon-search { - color: #999; + color: #999; } -.HeaderSearch .ant-input-search .ant-input{ - color: #fff; +.HeaderSearch .ant-input-search .ant-input { + color: #fff; } -.HeaderSearch .ant-input-search .ant-input-suffix{ - background: transparent !important; +.HeaderSearch .ant-input-search .ant-input-suffix { + background: transparent !important; } -.roundedRectangles{ - position: absolute; - top: 10px; - right: -22px; +.roundedRectangles { + position: absolute; + top: 10px; + right: -22px; } -.HeaderSearch{ - width: 325px; - /*right: 20px;*/ +.HeaderSearch { + width: 325px; + /*right: 20px;*/ } -.HeaderSearch .ant-input-search{ - right: 20px; + +.HeaderSearch .ant-input-search { + right: 20px; } -.mainheighs{ - height: 100%; - display: block; + +.mainheighs { + height: 100%; + display: block; } -.ml18a{ - margin-left:18%; +.ml18a { + margin-left: 18%; } -.logoimg{ - float: left; - min-width: 40px; - height:40px; +.logoimg { + float: left; + min-width: 40px; + height: 40px; } -.headwith100b{ - width: 100%; +.headwith100b { + width: 100%; } -.wechatcenter{ - text-align: center; + +.wechatcenter { + text-align: center; } -.myrigthsiderbar{ - right: 9% !important; +.myrigthsiderbar { + right: 9% !important; } -.feedbackdivcolor{ - background: #33BD8C !important; - height: 49px !important; - line-height: 24px !important; +.feedbackdivcolor { + background: #33BD8C !important; + height: 49px !important; + line-height: 24px !important; } -.xiaoshou{ - cursor:pointer + +.xiaoshou { + cursor: pointer } -.questiontypes{ - width:37px; - height:17px; - font-size:12px; - color:rgba(51,51,51,1); - line-height:17px; - cursor:pointer; + +.questiontypes { + width: 37px; + height: 17px; + font-size: 12px; + color: rgba(51, 51, 51, 1); + line-height: 17px; + cursor: pointer; } -.questiontype{ - width: 100%; - font-size: 12px; - color: #333333; - line-height: 17px; - text-align: center; - padding: 11px; - cursor:pointer; + +.questiontype { + width: 100%; + font-size: 12px; + color: #333333; + line-height: 17px; + text-align: center; + padding: 11px; + cursor: pointer; } -.questiontypeheng{ - width:100%; - height:1px; - background: #EEEEEE; + +.questiontypeheng { + width: 100%; + height: 1px; + background: #EEEEEE; } -.mystask-sidebar{ - right: 181px !important; + +.mystask-sidebar { + right: 181px !important; } -.mystask-sidebars{ - right: 20px !important; + +.mystask-sidebars { + right: 20px !important; } -.shitikussmys{ - width:29px !important; - height:20px!important; - background:#FF6601 !important; - border-radius:10px !important; - position: absolute !important; - font-size:11px !important; - color:#ffffff !important; - line-height:20px !important; - top: -13px !important; - right: -10px !important; + +.shitikussmys { + width: 29px !important; + height: 20px !important; + background: #FF6601 !important; + border-radius: 10px !important; + position: absolute !important; + font-size: 11px !important; + color: #ffffff !important; + line-height: 20px !important; + top: -13px !important; + right: -10px !important; } -.maxnamewidth30{ - max-width: 30px; - overflow:hidden; - text-overflow:ellipsis; - white-space:nowrap; - cursor: default; -} -.mystask-sidebarss{ - right: 5px !important; +.maxnamewidth30 { + max-width: 30px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; } + +.mystask-sidebarss { + right: 5px !important; +} \ No newline at end of file diff --git a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js index c0fbb2c01..2613fc1c7 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js +++ b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js @@ -392,7 +392,7 @@ class ShixunsIndex extends Component { // console.log(this.state.updata) return ( -
+
{this.state.updata === undefined ? "" : } diff --git a/public/react/src/modules/tpm/shixuns/shixun-keyword-list.scss b/public/react/src/modules/tpm/shixuns/shixun-keyword-list.scss index c8a62bdd8..d74f54e03 100644 --- a/public/react/src/modules/tpm/shixuns/shixun-keyword-list.scss +++ b/public/react/src/modules/tpm/shixuns/shixun-keyword-list.scss @@ -1,3 +1,7 @@ +.shi-xun-index .search-keyword-container { + padding: 20px 0 15px 0; +} + .search-keyword-container { display: flex; flex-flow: row nowrap; 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 38/47] =?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 39/47] =?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 40/47] =?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 60e087b0eb528e9cf87219b135a82e27c3257fb6 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Thu, 12 Mar 2020 13:39:33 +0800 Subject: [PATCH 41/47] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E8=A7=86=E9=A2=91id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index c7b3bb3bb..8a9bb7f08 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -38,9 +38,9 @@ class CreateWatchVideoService < ApplicationService end else # 开始播放时记录一次 - if params[:course_id].present? + if params[:course_video_id].present? # 课堂视频 - course_video = CourseVideo.find_by(params[:course_video_id]) + course_video = CourseVideo.find(params[:course_video_id]) watch_course_video = WatchCourseVideo.find_or_initialize_by(course_video_id: course_video.id, user_id: user.id) do |d| d.start_at = current_time d.duration = params[:duration] From 341fb50e585a3ad8226ac8e83f1f6e4bda4a49cd Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 12 Mar 2020 14:00:43 +0800 Subject: [PATCH 42/47] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/attendances_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/weapps/attendances_controller.rb b/app/controllers/weapps/attendances_controller.rb index 6cc2dda4e..2ec4180a1 100644 --- a/app/controllers/weapps/attendances_controller.rb +++ b/app/controllers/weapps/attendances_controller.rb @@ -94,7 +94,9 @@ class Weapps::AttendancesController < ApplicationController @absence_count = @attendance.absence_count @all_count = @attendance.course_member_attendances.size - @_is_current_attendance = @attendance.current_attendance? + a_end_time = "#{@attendance.attendance_date} #{@attendance.end_time}".to_time + + @_is_current_attendance = Time.current < a_end_time if @attendance.course_attendance_groups.first&.course_group_id.to_i == 0 @group_ids = @course.course_groups.pluck(:id) + [0] 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 43/47] 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 92804ee277408fbd5ef0635e60d64adc527a3a1c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 12 Mar 2020 14:48:33 +0800 Subject: [PATCH 44/47] =?UTF-8?q?web=E7=AB=AF=E7=9A=84=E6=AD=A3=E5=9C=A8?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=92=8C=E5=8E=86=E5=8F=B2=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attendances_controller.rb | 39 +++++++++++++++++++++++ app/views/attendances/index.json.jbuilder | 18 +++++++++++ config/routes.rb | 4 +++ 3 files changed, 61 insertions(+) create mode 100644 app/controllers/attendances_controller.rb create mode 100644 app/views/attendances/index.json.jbuilder diff --git a/app/controllers/attendances_controller.rb b/app/controllers/attendances_controller.rb new file mode 100644 index 000000000..17eeab1d6 --- /dev/null +++ b/app/controllers/attendances_controller.rb @@ -0,0 +1,39 @@ +class AttendancesController < ApplicationController + before_action :require_login + before_action :find_course, only: [:index, :student_attendances, :history_attendances] + before_action :find_attendance, except: [:index, :student_attendances, :history_attendances] + before_action :user_course_identity + + def index + current_date = Date.current + current_end_time = Time.current.strftime("%H:%M:%S") + + if params[:history] + @attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or + (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')") + else + @attendances = @course.course_attendances.where("attendance_date > '#{current_date}' or + (attendance_date = '#{current_date}' and end_time > '#{current_end_time}')") + end + @attendances_count = @attendances.size + + @attendances = @attendances.order("attendance_date desc, start_time desc") + @attendances = paginate @attendances.includes(:user, :course_member_attendances) + end + + def history_attendances + current_date = Date.current + current_end_time = Time.current.strftime("%H:%M:%S") + + @history_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or + (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')").order("id desc") + @all_history_count = @history_attendances.size + @history_attendances = paginate @history_attendances.includes(:course_member_attendances) + end + + private + def find_attendance + @attendance = CourseAttendance.find params[:id] + @course = @attendance.course + end +end \ No newline at end of file diff --git a/app/views/attendances/index.json.jbuilder b/app/views/attendances/index.json.jbuilder new file mode 100644 index 000000000..76febf51e --- /dev/null +++ b/app/views/attendances/index.json.jbuilder @@ -0,0 +1,18 @@ +json.attendances @attendances do |attendance| + json.(attendance, :id, :name, :normal_count, :all_count, :mode) + json.author do + user = attendance.user + json.user_name user.real_name + json.user_login user.login + end + json.attendance_date attendance.attendance_date.strftime("%Y-%m-%d") + json.start_time attendance.start_time.strftime("%H:%M") + json.end_time attendance.end_time.strftime("%H:%M") + json.edit_auth @user_course_identity < Course::PROFESSOR || attendance.user_id == User.current.id + + if @user_course_identity < Course::PROFESSOR == Course::STUDENT + json.attendance_status student_attendance_status(attendance, User.current) + end +end + +json.attendances_count @attendances_count \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index bcab93203..0f1bc5ba4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -550,6 +550,10 @@ Rails.application.routes.draw do end end + resources :attendances, shallow: true do + + end + resources :polls, only:[:index,:new,:create] do collection do post :publish # 立即发布 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 45/47] =?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} /> : ""}
diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 7c7a706c5..2a650e3d0 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -412,6 +412,7 @@ class TPMIndex extends Component { {...this.props} {...this.state} is_jupyter={this.state. is_jupyter} + getcomponentdidmount={()=>this.getcomponentdidmount()} > } From b3089a4d6b78c575032e5843f04ef3eba659447b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 12 Mar 2020 15:47:19 +0800 Subject: [PATCH 46/47] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attendances_controller.rb | 14 ++++++++++++++ app/views/attendances/index.json.jbuilder | 10 ++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/controllers/attendances_controller.rb b/app/controllers/attendances_controller.rb index 17eeab1d6..e920eaa8a 100644 --- a/app/controllers/attendances_controller.rb +++ b/app/controllers/attendances_controller.rb @@ -11,6 +11,16 @@ class AttendancesController < ApplicationController if params[:history] @attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')") + if @user_course_identity == Course::STUDENT + member = @course.students.find_by(user_id: current_user.id) + group_ids = [member&.course_group_id.to_i, 0] + @attendances = @attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: group_ids}) + + attendance_ids = @attendances.pluck(:id) + @normal_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "NORMAL").size + @leave_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "LEAVE").size + @absence_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "ABSENCE").size + end else @attendances = @course.course_attendances.where("attendance_date > '#{current_date}' or (attendance_date = '#{current_date}' and end_time > '#{current_end_time}')") @@ -21,6 +31,10 @@ class AttendancesController < ApplicationController @attendances = paginate @attendances.includes(:user, :course_member_attendances) end + def statistics + + end + def history_attendances current_date = Date.current current_end_time = Time.current.strftime("%H:%M:%S") diff --git a/app/views/attendances/index.json.jbuilder b/app/views/attendances/index.json.jbuilder index 76febf51e..8a4dd2bb1 100644 --- a/app/views/attendances/index.json.jbuilder +++ b/app/views/attendances/index.json.jbuilder @@ -10,9 +10,15 @@ json.attendances @attendances do |attendance| json.end_time attendance.end_time.strftime("%H:%M") json.edit_auth @user_course_identity < Course::PROFESSOR || attendance.user_id == User.current.id - if @user_course_identity < Course::PROFESSOR == Course::STUDENT + if @user_course_identity == Course::STUDENT json.attendance_status student_attendance_status(attendance, User.current) end end -json.attendances_count @attendances_count \ No newline at end of file +json.attendances_count @attendances_count + +if @user_course_identity == Course::STUDENT + json.normal_count @normal_count + json.leave_count @leave_count + json.absence_count @absence_count +end \ No newline at end of file From 3ed72cb593ca27aff6fca15d4fae45627ce22b4f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Mar 2020 15:54:29 +0800 Subject: [PATCH 47/47] =?UTF-8?q?=E5=85=B3=E5=8D=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/challenge.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 42d7f3499..38aa2812a 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -75,7 +75,7 @@ class Challenge < ApplicationRecord if identifier.present? shixun.task_pass || self.status != 3 ? "/tasks/#{identifier}" : "" else - self.position == 1 ? "/api/shixuns/#{shixun.identifier}/shixun_exec" : "" + self.position == 1 ? "/shixuns/#{shixun.identifier}/shixun_exec.json" : "" end end