From b97b314debc05ed848e41dc0a6362fb64d106b3a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 22 Nov 2019 14:52:02 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E6=88=91=E7=9A=84=E6=9C=AA=E5=8F=91=E5=B8=83=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index f9052de8a..24f6a7b4a 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -163,7 +163,7 @@ class HacksController < ApplicationController hacks = Hack.select(select_sql).mine(current_user.id) else # 全部包括已经发布的,和我的未发布的 - hacks = Hack.select(select_sql).published.opening.merge(Hack.select(select_sql).unpublish.mine(current_user.id)) + hacks = Hack.select(select_sql).published.opening.or(Hack.select(select_sql).unpublish.mine(current_user.id)) end # 搜索 if params[:search] From d57307ba53821a528186a9166332982acae4bdad Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 22 Nov 2019 15:14:33 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 24f6a7b4a..0178f3b78 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -184,6 +184,11 @@ class HacksController < ApplicationController hacks = hacks.joins(:hack_user_lastest_code).where(hack_user_lastest_code: {status: params[:status]}) end end + # 分类 + if params[:category] + hacks = hacks.where(category: params[:category]) + end + # 排序 sort_by = params[:sort_by] || "hack_user_lastest_codes_count" sort_direction = params[:sort_direction] || "desc" From 477206be79bd05474cfb123a9d36f2e4b0b4f8ed Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 22 Nov 2019 15:32:27 +0800 Subject: [PATCH 03/43] 1 --- app/controllers/hacks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 0178f3b78..1bff3888f 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -181,7 +181,7 @@ class HacksController < ApplicationController hacks = hacks.where.not(id: user_hacks.pluck(:hack_id)) end else - hacks = hacks.joins(:hack_user_lastest_code).where(hack_user_lastest_code: {status: params[:status]}) + hacks = hacks.joins(:hack_user_lastest_codes).where(hack_user_lastest_code: {status: params[:status]}) end end # 分类 From ca07e2fa961d3a2dbb2dd70fa8e7d918f1c86303 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 22 Nov 2019 15:33:17 +0800 Subject: [PATCH 04/43] 1 --- app/controllers/hacks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 1bff3888f..aee4ba338 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -181,7 +181,7 @@ class HacksController < ApplicationController hacks = hacks.where.not(id: user_hacks.pluck(:hack_id)) end else - hacks = hacks.joins(:hack_user_lastest_codes).where(hack_user_lastest_code: {status: params[:status]}) + hacks = hacks.joins(:hack_user_lastest_codes).where(hack_user_lastest_codes: {status: params[:status]}) end end # 分类 From 190407e5887c66d3fd7a3945da3fa157e0aebaa1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 22 Nov 2019 16:19:06 +0800 Subject: [PATCH 05/43] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index bf7f465d5..48554111c 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -610,7 +610,7 @@ class ExercisesController < ApplicationController # 对未提交的用户进行调分 def adjust_score exercise_user = @exercise.exercise_users.find_by!(user_id: params[:user_id]) - tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1 + tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1 && exercise_user.commit_method != 5 if @exercise.subjective_score > 0 tip_exception("主观题成绩不能为空") if params[:subjective_score].blank? tip_exception("主观题成绩不能小于零") if params[:subjective_score].to_f < 0 @@ -628,8 +628,13 @@ class ExercisesController < ApplicationController subjective_score = @exercise.subjective_score > 0 ? params[:subjective_score].to_f.round(2) : 0 objective_score = @exercise.objective_score > 0 ? params[:objective_score].to_f.round(2) : 0 score = subjective_score + objective_score - exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score, - subjective_score: subjective_score, objective_score: objective_score, commit_method: 5) + if exercise_user.commit_status == 1 + exercise_user.update_attributes!(score: score, subjective_score: subjective_score, objective_score: objective_score) + else + exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score, + subjective_score: subjective_score, objective_score: objective_score, commit_method: 5) + end + ExerciseUserScore.create!(exercise_id: @exercise.id, exercise_user_id: exercise_user.id, subjective_score: subjective_score, objective_score: objective_score) normal_status("操作成功") From 89abbabeca60902c95972be4500840e46e7f7695 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 22 Nov 2019 17:05:34 +0800 Subject: [PATCH 06/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/courses_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index 8716e6b28..f35b0591a 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -1,6 +1,6 @@ class Weapps::CoursesController < Weapps::BaseController before_action :require_login - before_action :user_course_identity, except: [:create] + before_action :set_course, :user_course_identity, except: [:create] before_action :teacher_allowed, only: [:edit, :update] before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers] @@ -167,4 +167,9 @@ class Weapps::CoursesController < Weapps::BaseController tip_exception(403, "..") end end + + def set_course + @course = Course.find_by!(id: params[:id]) + tip_exception(404, "") if @course.is_delete == 1 && !current_user.admin? + end end \ No newline at end of file From 7b027b1b7f58affe4b53c8c6a160ea3507f3a0cf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 10:24:15 +0800 Subject: [PATCH 07/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/registers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/weapps/registers_controller.rb b/app/controllers/weapps/registers_controller.rb index 0cbab7fd4..eb1da3dd8 100644 --- a/app/controllers/weapps/registers_controller.rb +++ b/app/controllers/weapps/registers_controller.rb @@ -50,7 +50,7 @@ class Weapps::RegistersController < Weapps::BaseController successful_authentication(@user) session[:user_id] = @user.id - render_ok + render_ok(user_id: @user.id) end private From 8c23737e302d07af21134dd6b6690e44ef94e014 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 10:37:56 +0800 Subject: [PATCH 08/43] =?UTF-8?q?Base64=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/hack.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/hack.rb b/app/models/hack.rb index 814debef5..80724d3d4 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -26,9 +26,11 @@ class Hack < ApplicationRecord def code if hack_codes.count == 1 - tran_base64_decode64(hack_codes.first.code) + #tran_base64_decode64(hack_codes.first.code) + hack_codes.first.code else - tran_base64_decode64(hack_codes.pluck(:code)) + #tran_base64_decode64(hack_codes.pluck(:code)) + hack_codes.pluck(:code) end end From 99a7a34274ab204cf31f0284f4d37a2b395405b0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 11:06:33 +0800 Subject: [PATCH 09/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/registers/create.json.jbuilder | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/views/weapps/registers/create.json.jbuilder diff --git a/app/views/weapps/registers/create.json.jbuilder b/app/views/weapps/registers/create.json.jbuilder new file mode 100644 index 000000000..5d1fcf2b4 --- /dev/null +++ b/app/views/weapps/registers/create.json.jbuilder @@ -0,0 +1,3 @@ +json.user do + json.partial! 'weapps/shared/user', locals: { user: @user } +end \ No newline at end of file From 8d343846a321467d2cacb45fe25bc2155b31df8e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 12:37:16 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/registers/create.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/weapps/registers/create.json.jbuilder b/app/views/weapps/registers/create.json.jbuilder index 5d1fcf2b4..0cfb5e30f 100644 --- a/app/views/weapps/registers/create.json.jbuilder +++ b/app/views/weapps/registers/create.json.jbuilder @@ -1,3 +1,4 @@ +json.status 0 json.user do json.partial! 'weapps/shared/user', locals: { user: @user } end \ No newline at end of file From ba84ee4fd70732e82c970814f0adfe627b059a92 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 14:06:07 +0800 Subject: [PATCH 11/43] 1 --- app/controllers/hack_user_lastest_codes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 9602673e5..a4b41a162 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -105,7 +105,7 @@ class HackUserLastestCodesController < ApplicationController else [{input: params[:input]}] end - testCases = Base64.urlsafe_encode64(test_sets.to_json) + testCases = Base64.encode64(test_sets.to_json) #codeFileContent = Base64.urlsafe_encode64(@my_hack.code) debug_params = {execMode: exec_mode, tpiID: @my_hack.identifier, From 2c4419794c54c9df101f0dc745ae7246b68b0efc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 14:16:18 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index aee4ba338..0a8a24f08 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -1,8 +1,9 @@ class HacksController < ApplicationController before_action :require_login, except: [:index] + before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set] before_action :require_teacher_identity, only: [:create, :update_set] before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set] - before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set] + # 开启编程,如果第一次开启,创建一条记录,如果已经开启过的话,直接返回标识即可 def start From 00777fa2676ef4912b8c5927822051b5fb7f96f1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 14:22:14 +0800 Subject: [PATCH 13/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/registers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/weapps/registers_controller.rb b/app/controllers/weapps/registers_controller.rb index eb1da3dd8..391850090 100644 --- a/app/controllers/weapps/registers_controller.rb +++ b/app/controllers/weapps/registers_controller.rb @@ -50,7 +50,7 @@ class Weapps::RegistersController < Weapps::BaseController successful_authentication(@user) session[:user_id] = @user.id - render_ok(user_id: @user.id) + # render_ok(user_id: @user.id) end private From 59ec6d02961842afa107fdaa2bcfde06e45843cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 25 Nov 2019 14:50:30 +0800 Subject: [PATCH 14/43] =?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 | 116 +++++++++++++++++- .../exercise/Testpapersettinghomepage.js | 2 +- 2 files changed, 115 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index a06cbbfa7..7cef67aad 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -27,7 +27,6 @@ const Search = Input.Search; const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; const {Option} = Select; - //学生老师页面 class Studentshavecompletedthelist extends Component { // http://localhost:3007/courses/1309/exercises/722/exercises/student_exercise_list?debug=s @@ -317,6 +316,26 @@ class Studentshavecompletedthelist extends Component { : + 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" @@ -587,6 +606,30 @@ class Studentshavecompletedthelist extends Component { }}>-- : + record.commit_method===5? + +
最终调整成绩:{record.efficiencyscore}分
+ }> + 90 ? { + color: '#DD1717', + textAlign: "center", + width:"199px" + } : parseInt(record.efficiencyscore) <= 90 ? { + color: '#FF6800', + textAlign: "center", + width:"199px" + } : parseInt(record.efficiencyscore) <= 60 ? { + color: '#747A7F', + textAlign: "center", + width:"199px" + } : { + color: '#747A7F', + textAlign: "center", + width:"199px" + }}>{record.efficiencyscore} +
+ : 90 ? { color: '#DD1717', textAlign: "center", @@ -845,6 +888,26 @@ class Studentshavecompletedthelist extends Component { }}>-- : + 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", @@ -1048,6 +1111,26 @@ class Studentshavecompletedthelist extends Component { textAlign: "center",}}>-- : + 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", @@ -1246,6 +1329,26 @@ class Studentshavecompletedthelist extends Component { textAlign: "center",}}>-- : + 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", @@ -1401,7 +1504,9 @@ class Studentshavecompletedthelist extends Component { // //console.log("试卷学生未截止"); this.Generatenewdatas(response.data.exercise_users); if (response.data.exercise_types.subjective === 0) { + if (this.state.noclassroom === undefined || this.state.noclassroom === "" || this.state.noclassroom === null) { + console.log("4"); var arr =[]; for(var i=0;i { // 教师列表 - parseInt(tab[0])==0 ? this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper}>:"" + 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]}`]}>:"" } {/*统计结果*/} From 4075bfc269eeb2b501adb09eaa8fa03e95e42748 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:16:28 +0800 Subject: [PATCH 15/43] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E5=85=A5=E5=8F=A3=E4=B8=8E=E7=8A=B6=E6=80=81=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/polls_helper.rb | 2 +- app/models/poll.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index 866d28254..7ae4470e2 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -77,7 +77,7 @@ module PollsHelper ex_pb_time = poll.get_poll_times(user.id,false) poll_publish_time = ex_pb_time[:publish_time] poll_end_time = ex_pb_time[:end_time] - current_status = poll.check_user_votes_status(user) + current_status = poll.check_user_votes_status(user, poll_status) lock_icon = 0 #不显示锁图标 else poll_users_list = poll.get_poll_exercise_users diff --git a/app/models/poll.rb b/app/models/poll.rb index 9cb860f61..f3a16198c 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -146,12 +146,15 @@ class Poll < ApplicationRecord end #判断当前用户的答题状态 - def check_user_votes_status(user) + def check_user_votes_status(user, poll_status) poll_answer_user = poll_users.where(user_id: user.id).select(:start_at,:end_at,:commit_status) user_status = 2 if poll_answer_user.exists? && (poll_answer_user.first&.start_at.present? || poll_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 user_status = poll_answer_user.first.commit_status end + if poll_status > 2 + user_status = user_status == 1 ? 1 : 4 + end user_status end From 5eeef267e56666f7d08fd80f401bff944bc783b6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:19:33 +0800 Subject: [PATCH 16/43] =?UTF-8?q?=E9=97=AE=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/polls_controller.rb | 4 ++-- app/models/poll.rb | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 5a3fda7a4..068a0dafd 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -198,14 +198,14 @@ class PollsController < ApplicationController def common_header ActiveRecord::Base.transaction do begin + @poll_status = @poll.get_poll_status(current_user) if @user_course_identity > Course::ASSISTANT_PROFESSOR @is_teacher_or = 0 - @user_poll_answer = @poll.check_user_votes_status(current_user) + @user_poll_answer = @poll.check_user_votes_status(current_user, @poll_status) else @is_teacher_or = 1 @user_poll_answer = 3 #教师页面 end - @poll_status = @poll.get_poll_status(current_user) poll_id_array = [@poll.id] @poll_publish_count = get_user_permission_course(poll_id_array,2).count #是否存在已发布的 @poll_unpublish_count = get_user_permission_course(poll_id_array,1).count #是否存在未发布的 diff --git a/app/models/poll.rb b/app/models/poll.rb index f3a16198c..626f55dcb 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -152,7 +152,14 @@ class Poll < ApplicationRecord if poll_answer_user.exists? && (poll_answer_user.first&.start_at.present? || poll_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 user_status = poll_answer_user.first.commit_status end + # 问卷已截止时学生的答题状态需要考虑问卷的状态 if poll_status > 2 + # 问卷如果还是继续答题状态则自动提交 + if user_status = 0 + poll_end_time = get_poll_times(user.id,false) + poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time) + user_status = 1 + end user_status = user_status == 1 ? 1 : 4 end user_status From c88a998992ebf8a70e6ffefb0c3be912ca6919f7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:29:48 +0800 Subject: [PATCH 17/43] =?UTF-8?q?=E9=97=AE=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/models/poll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index 626f55dcb..8eb8e6cf9 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -155,7 +155,7 @@ class Poll < ApplicationRecord # 问卷已截止时学生的答题状态需要考虑问卷的状态 if poll_status > 2 # 问卷如果还是继续答题状态则自动提交 - if user_status = 0 + if user_status == 0 poll_end_time = get_poll_times(user.id,false) poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time) user_status = 1 From 34fed0365560f1cc3b5164d2dd4a00c049b81d83 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:31:21 +0800 Subject: [PATCH 18/43] =?UTF-8?q?=E9=97=AE=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/models/poll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index 8eb8e6cf9..ea6656ca2 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -156,7 +156,7 @@ class Poll < ApplicationRecord if poll_status > 2 # 问卷如果还是继续答题状态则自动提交 if user_status == 0 - poll_end_time = get_poll_times(user.id,false) + poll_end_time = get_poll_times(user.id,false)[:end_time] poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time) user_status = 1 end From ffc4e52114bf8da5754c40fbaa0c13c619521db2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 19:15:27 +0800 Subject: [PATCH 19/43] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixun_feedback_messages_controller.rb | 6 +++++ app/views/admins/shared/_sidebar.html.erb | 6 +++++ .../shixun_feedback_messages/index.html.erb | 14 +++++++++++ .../shared/_list.html.erb | 24 +++++++++++++++++++ app/views/hacks/edit.json.jbuilder | 2 +- config/routes.rb | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 app/controllers/admins/shixun_feedback_messages_controller.rb create mode 100644 app/views/admins/shixun_feedback_messages/index.html.erb create mode 100644 app/views/admins/shixun_feedback_messages/shared/_list.html.erb diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb new file mode 100644 index 000000000..c7e6a9586 --- /dev/null +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -0,0 +1,6 @@ +class Admins::ShixunFeedbackMessagesController < Admins::BaseController + + def index + + end +end \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index f78b52ac7..7b1f5db7a 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -65,6 +65,12 @@ <% end %> +
  • + <%= sidebar_item_group('#comments-submenu', '消息', icon: 'comments') do %> +
  • <%= sidebar_item(admins_shixun_feedback_messages_path, '实训反馈', icon: 'comment', controller: 'admins-shixun_feedback_messages') %>
  • + <% end %> + +
  • <%= sidebar_item_group('#major-identification-submenu', '工程认证', icon: 'anchor') do %>
  • <%= sidebar_item(admins_major_informations_path, '本科专业目录', icon: 'outdent', controller: 'admins-major_informations') %>
  • diff --git a/app/views/admins/shixun_feedback_messages/index.html.erb b/app/views/admins/shixun_feedback_messages/index.html.erb new file mode 100644 index 000000000..02e696cd3 --- /dev/null +++ b/app/views/admins/shixun_feedback_messages/index.html.erb @@ -0,0 +1,14 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('实训反馈', admins_shixun_feedback_messages_path) %> +<% end %> + +
    + <%= form_tag(admins_shixun_feedback_messages_path, method: :get, class: 'form-inline search-form', remote: true) do %> + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-md-4 ml-3', placeholder: '输入实训名称关键字进行搜索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> + <% end %> +
    + +
    + <%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {}) %> +
    \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb new file mode 100644 index 000000000..65b9e0035 --- /dev/null +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + <% if true %> + + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
    ID标识实训名称实训老师完成经验值学员姓名学员单位11
    + +<%#= render partial: 'admins/shared/paginate', locals: { objects: myshixuns } %> \ No newline at end of file diff --git a/app/views/hacks/edit.json.jbuilder b/app/views/hacks/edit.json.jbuilder index 95124666f..efbf424b6 100644 --- a/app/views/hacks/edit.json.jbuilder +++ b/app/views/hacks/edit.json.jbuilder @@ -1,5 +1,5 @@ # 编程内容 -json.(@hack, :name, :description, :language, :code) +json.(@hack, :name, :description, :language, :difficult, :category, :time_limit) # 代码 json.language @hack.language diff --git a/config/routes.rb b/config/routes.rb index 86bac4533..0f31c6d48 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1039,6 +1039,7 @@ Rails.application.routes.draw do end resources :shixuns, only: [:index,:destroy] resources :shixun_settings, only: [:index,:update] + resources :shixun_feedback_messages, only: [:index] resources :department_applies,only: [:index,:destroy] do collection do post :merge From 2d7096a9d2516823d9f2e837e4e5fe3dc092dbef Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:11:35 +0800 Subject: [PATCH 20/43] =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E4=B8=8D=E5=88=87=E6=8D=A2=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/laboratory_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index 37a3675f0..8302e4c6a 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -26,6 +26,6 @@ module LaboratoryHelper end def default_yun_session - @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" + @_default_yun_session = "#{current_laboratory.split('.').first}_user_id" end end \ No newline at end of file From 5745ff8c28a2bf46ae4ece12669665cdb241696c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 20:36:38 +0800 Subject: [PATCH 21/43] 1 --- .../shixun_feedback_messages_controller.rb | 4 ++- .../hack_user_lastest_codes_controller.rb | 2 +- .../shixun_feedback_messages/index.html.erb | 4 +-- .../shixun_feedback_messages/index.js.erb | 1 + .../shared/_list.html.erb | 28 +++++++++++-------- .../result.json.jbuilder | 13 ++++++--- app/views/hacks/edit.json.jbuilder | 2 +- 7 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 app/views/admins/shixun_feedback_messages/index.js.erb diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb index c7e6a9586..27c3f4225 100644 --- a/app/controllers/admins/shixun_feedback_messages_controller.rb +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -1,6 +1,8 @@ class Admins::ShixunFeedbackMessagesController < Admins::BaseController def index - + default_sort('created_at', 'desc') + @params_page = params[:page] || 1 + @discusses = paginate Discuss.where(:dis_type => 'Shixun').preload(:user) end end \ No newline at end of file diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index a4b41a162..2d749ce75 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -35,7 +35,7 @@ class HackUserLastestCodesController < ApplicationController # 提交结果显示 def result if @my_hack.submit_status == 1 - render json: {status:0, message: "正在评测中"} + render json: {status: 1, message: "正在评测中"} else @mode = params[:mode] @result = diff --git a/app/views/admins/shixun_feedback_messages/index.html.erb b/app/views/admins/shixun_feedback_messages/index.html.erb index 02e696cd3..730729646 100644 --- a/app/views/admins/shixun_feedback_messages/index.html.erb +++ b/app/views/admins/shixun_feedback_messages/index.html.erb @@ -9,6 +9,6 @@ <% end %> -
    - <%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {}) %> +
    + <%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {discusses: @discusses}) %>
    \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/index.js.erb b/app/views/admins/shixun_feedback_messages/index.js.erb new file mode 100644 index 000000000..38c393589 --- /dev/null +++ b/app/views/admins/shixun_feedback_messages/index.js.erb @@ -0,0 +1 @@ +$(".shixun_feedback_messages-list-container").html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {shixun_settings:@discusses} %>") \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 65b9e0035..370ac9df2 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -1,24 +1,28 @@ - - - - - - - - - + + + + + - <% if true %> - + <% if discusses.present? %> + <% discusses.each_with_index do |discuss, index| %> + + + + + + + + <% end %> <% else %> <%= render 'admins/shared/no_data_for_table' %> <% end %>
    ID标识实训名称实训老师完成经验值学员姓名学员单位11序号实训名称评论内容评论者评论时间
    <%= (@params_page.to_i - 1) * 20 + index + 1 %><%= discuss.dis.name %><%= content_safe discuss.content %><%= discuss.user.show_real_name %><%= format_time discuss.created_at %>
    -<%#= render partial: 'admins/shared/paginate', locals: { objects: myshixuns } %> \ No newline at end of file +<%= render partial: 'admins/shared/paginate', locals: { objects: discusses } %> \ No newline at end of file diff --git a/app/views/hack_user_lastest_codes/result.json.jbuilder b/app/views/hack_user_lastest_codes/result.json.jbuilder index 31164d4f7..2561d4ecd 100644 --- a/app/views/hack_user_lastest_codes/result.json.jbuilder +++ b/app/views/hack_user_lastest_codes/result.json.jbuilder @@ -1,7 +1,12 @@ -json.(@result, :id, :status, :error_line, :error_msg, - :input, :output, :execute_time, :execute_memory) +json.status 0 +json.message "评测成功" +json.data do + json.(@result, :id, :status, :error_line, :error_msg, + :input, :output, :execute_time, :execute_memory) # 提交模式多了一个预计输出 -if @mode == "submit" - json.expected_output @result.expected_output + if @mode == "submit" + json.expected_output @result.expected_output + end end + diff --git a/app/views/hacks/edit.json.jbuilder b/app/views/hacks/edit.json.jbuilder index efbf424b6..24d51385b 100644 --- a/app/views/hacks/edit.json.jbuilder +++ b/app/views/hacks/edit.json.jbuilder @@ -1,5 +1,5 @@ # 编程内容 -json.(@hack, :name, :description, :language, :difficult, :category, :time_limit) +json.(@hack, :name, :description, :language, :difficult, :category, :time_limit, :open_or_not) # 代码 json.language @hack.language From f5816b227e72d0accde7c94b3368dc10378e08fc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 09:10:40 +0800 Subject: [PATCH 22/43] fixbug --- app/views/admins/shixun_feedback_messages/shared/_list.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 370ac9df2..7737d1a47 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -13,6 +13,7 @@ <% discusses.each_with_index do |discuss, index| %> <%= (@params_page.to_i - 1) * 20 + index + 1 %> + <%# identifier = Game.find_by(challenge_id: discuss.challenge_id) %> <%= discuss.dis.name %> <%= content_safe discuss.content %> <%= discuss.user.show_real_name %> From 98d1b97a85018244f7bed7663390fee547a0a904 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 10:22:08 +0800 Subject: [PATCH 23/43] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=AE=9E=E8=AE=AD=E5=8F=8D=E9=A6=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/shixun_feedback_messages_controller.rb | 8 +++++++- app/views/admins/shixun_feedback_messages/index.js.erb | 3 ++- .../admins/shixun_feedback_messages/shared/_list.html.erb | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb index 27c3f4225..31fcc468c 100644 --- a/app/controllers/admins/shixun_feedback_messages_controller.rb +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -3,6 +3,12 @@ class Admins::ShixunFeedbackMessagesController < Admins::BaseController def index default_sort('created_at', 'desc') @params_page = params[:page] || 1 - @discusses = paginate Discuss.where(:dis_type => 'Shixun').preload(:user) + if params[:keyword] + discusses = Discuss.find_by_sql("select * from discusses join shixuns on discusses.dis_id = shixuns.id where discusses.dis_type='Shixun' AND + shixuns.name like '%#{params[:keyword]}%'") + else + discusses = Discuss.where(:dis_type => 'Shixun').includes(:user, :dis) + end + @discusses = paginate discusses end end \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/index.js.erb b/app/views/admins/shixun_feedback_messages/index.js.erb index 38c393589..6eab9be54 100644 --- a/app/views/admins/shixun_feedback_messages/index.js.erb +++ b/app/views/admins/shixun_feedback_messages/index.js.erb @@ -1 +1,2 @@ -$(".shixun_feedback_messages-list-container").html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {shixun_settings:@discusses} %>") \ No newline at end of file +$(".shixun_feedback_messages-list-container") + .html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {discusses: @discusses} %>") \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 7737d1a47..af81f9e58 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -13,8 +13,8 @@ <% discusses.each_with_index do |discuss, index| %> <%= (@params_page.to_i - 1) * 20 + index + 1 %> - <%# identifier = Game.find_by(challenge_id: discuss.challenge_id) %> - <%= discuss.dis.name %> + <% identifier = Game.find_by(challenge_id: discuss.challenge_id, user_id: discuss.user_id)&.identifier %> + <%= link_to discuss.dis.name, "/tasks/#{identifier}", target: '_blank'%> <%= content_safe discuss.content %> <%= discuss.user.show_real_name %> <%= format_time discuss.created_at %> From 8d81a78ec6f54641402edfebcdc603e4e7e60253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 26 Nov 2019 11:09:45 +0800 Subject: [PATCH 24/43] =?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/public/css/edu-all.css | 21 +++ public/react/src/modules/tpm/NewFooter.js | 148 ++++++++++++++++------ public/stylesheets/educoder/edu-all.css | 23 +++- 3 files changed, 154 insertions(+), 38 deletions(-) diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index f51e0e630..5988709eb 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -80,6 +80,27 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} .inner-footernav li{float: left;height: 50px;width: 80px;text-align: center} .inner-footernav li a{width: 100%;text-align: center;line-height: 50px;color: #888} .inner-footer_con{ width: 1200px; margin: 0 auto;} +.inner-footernavysl{ display: flex;flex-direction:initial;} +.inner-footernavysl li a { + height: 40px; + line-height: 40px; + color:#878786; + font-size: 19px; +} + +.inner-footernavysl li Link { + height: 40px; + line-height: 40px; + color:#878786; +} + +.intermediatecenter{ + width:100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} .footer_con-p{ color: #888; margin-top:10px;} /*banner图*/ .banner{width:100%;height:345px;position: relative;overflow: hidden;border-radius: 10px;} diff --git a/public/react/src/modules/tpm/NewFooter.js b/public/react/src/modules/tpm/NewFooter.js index 4ff1cc46a..f54fa1d3f 100644 --- a/public/react/src/modules/tpm/NewFooter.js +++ b/public/react/src/modules/tpm/NewFooter.js @@ -1,53 +1,127 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; -import { Link } from 'react-router-dom'; -import { getImageUrl, toPath } from 'educoder' +import React, {Component} from 'react'; +import {Redirect} from 'react-router'; +import {Link} from 'react-router-dom'; +import {getImageUrl, toPath} from 'educoder' import PropTypes from 'prop-types'; class NewFooter extends Component { - constructor(props) { - super(props) + constructor(props) { + super(props) - } + } - componentWillReceiveProps(newProps, newContext) { + componentWillReceiveProps(newProps, newContext) { - } + } - render() { - return ( -
    + render() { + return ( +
    {/*newContainers*/} -
    - {this.props.user&&this.props.user.main_site===true?
    - {/*
    +
    + {this.props.user && this.props.user.main_site === true ?
    + {/*
    高校智能化教学与实训平台 EduCoder.net
    */} -
      -
    • 网站首页
    • -
    • 关于我们
    • -
    • 联系我们
    • -
    • 合作伙伴
    • -
    • 服务协议
    • -
    • 帮助中心
    • -
    • 意见反馈
    • -
    -
    :""} -
    - {this.props.mygetHelmetapi === null ? "" : - this.props.mygetHelmetapi===undefined|| this.props.mygetHelmetapi.footer===null||this.props.mygetHelmetapi.footer===undefined? +
      +
    • 网站首页
    • +
    • 关于我们
    • +
    • 联系我们
    • +
    • 合作伙伴
    • +
    • 服务协议
    • +
    • 帮助中心
    • +
    • 意见反馈
    • +
    +
    : ""} + + +
    + {this.props.mygetHelmetapi === null ? "" : + this.props.mygetHelmetapi === undefined || this.props.mygetHelmetapi.footer === null || this.props.mygetHelmetapi.footer === undefined ?

    © 2019 EduCoder - 湘ICP备17009477号 - + 湘ICP备17009477号 + 湘公网安备43019002000962号 - Trustie   &   IntelliDE inside. 版权所有 湖南智擎科技有限公司

    @@ -56,12 +130,12 @@ class NewFooter extends Component { } -
    -
    -
    -
    - ); - } +
    +
    +
    +
    + ); + } } export default NewFooter; diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 3ed8a36c3..6fcbd3b5c 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -84,6 +84,27 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} .inner-footernav li{float: left;height: 50px;width: 80px;text-align: center} .inner-footernav li a{width: 100%;text-align: center;line-height: 50px;color: #888} .inner-footer_con{ width: 1200px; margin: 0 auto;} +.inner-footernavysl{ display: flex;flex-direction:initial;} +.inner-footernavysl li a { + height: 40px; + line-height: 40px; + color:#878786; + font-size: 19px; +} + +.inner-footernavysl li Link { + height: 40px; + line-height: 40px; + color:#878786; +} + +.intermediatecenter{ + width:100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} .footer_con-p{ color: #888; margin-top:10px;} /*banner图*/ .banner{width:100%;height:345px;position: relative;overflow: hidden;border-radius: 10px;} @@ -3773,4 +3794,4 @@ a.singlepublishtwo{ .fontweightbold{ font-weight: bold !important; -} \ No newline at end of file +} From d968c37807d85af91e95b4946783fe6f7f76010a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 11:30:37 +0800 Subject: [PATCH 25/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E6=95=99=E5=B8=88=E5=88=97=E8=A1=A8=E5=92=8C=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E4=B8=AD=E8=8B=B1=E6=96=87=E6=B7=B7?= =?UTF-8?q?=E5=90=88=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/courses_controller.rb | 25 +++++++++++++++++++- app/helpers/weapps/courses_helper.rb | 16 ++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index f35b0591a..c2335998e 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -35,6 +35,9 @@ class Weapps::CoursesController < Weapps::BaseController # 教师列表 def teachers @course = current_course + @page = (params[:page] || 1).to_i + @limit = (params[:limit] || 20).to_i + search = params[:search].present? ? params[:search].strip : "" if @course.try(:id) != 1309 || current_user.admin? || current_user.try(:id) == 15582 @teacher_list = @course.course_members.joins(:user).where("course_members.role in (1, 2, 3)") else @@ -42,17 +45,26 @@ class Weapps::CoursesController < Weapps::BaseController and course_members.role = 2))") end + if search.present? + @teacher_list = @teacher_list.joins(:user).where("LOWER(CONCAT(users.lastname, users.firstname)) like ?", "%#{search}%") + end + @teacher_list_size = @teacher_list.size @applications_size = CourseMessage.unhandled_join_course_requests_by_course(@course).size - @teacher_list = @teacher_list.preload(user: [user_extension: :school]) + @teacher_list = @teacher_list.includes(user: [user_extension: :school]) + # 中英文混合排序(忽略大小写) + @teacher_list = @teacher_list.sort {|x, y| Pinyin.t(x.user&.real_name, splitter: '').upcase <=> Pinyin.t(y.user&.real_name, splitter: '').upcase} + @teacher_list = @teacher_list[(@page-1)*@limit ... @page*@limit] end # 批量删除教师或助教 def delete_course_teachers begin @course = current_course + @page = (params[:page] || 1).to_i + @limit = (params[:limit] || 20).to_i course_members = @course.course_members.where(id: params[:course_member_ids], role: %i[PROFESSOR ASSISTANT_PROFESSOR]) user_ids = course_members.pluck(:user_id) course_members.destroy_all @@ -67,10 +79,18 @@ class Weapps::CoursesController < Weapps::BaseController def students @course = current_course + @page = (params[:page] || 1).to_i + @limit = (params[:limit] || 20).to_i + search = params[:search].present? ? params[:search].strip : nil course_group_id = params[:course_group_id].present? ? params[:course_group_id].to_i : nil @students = CourseMember.students(@course) + if search.present? + @students = @students.joins(user: :user_extension).where("LOWER(CONCAT(users.lastname, users.firstname)) like ? or + user_extensions.student_id like ?", "%#{search}%", "%#{search}%") + end + if course_group_id.present? course_group = CourseGroup.find(course_group_id) if course_group_id != 0 @students = @students.where(course_group_id: course_group&.id.to_i) @@ -78,6 +98,9 @@ class Weapps::CoursesController < Weapps::BaseController @students_count = @students.size @students = @students.includes(user: :user_extension) + # 中英文混合排序(忽略大小写) + @students = @students.sort {|x, y| Pinyin.t(x.user&.real_name, splitter: '').upcase <=> Pinyin.t(y.user&.real_name, splitter: '').upcase} + @students = @students[(@page-1)*@limit ... @page*@limit] end # 批量修改角色 diff --git a/app/helpers/weapps/courses_helper.rb b/app/helpers/weapps/courses_helper.rb index 94769fc2e..32de8f253 100644 --- a/app/helpers/weapps/courses_helper.rb +++ b/app/helpers/weapps/courses_helper.rb @@ -20,10 +20,10 @@ module Weapps::CoursesHelper end end end - data = data.sort do |a, b| - [a[:letter]] <=> [b[:letter]] - end - data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后 + # data = data.sort do |a, b| + # [a[:letter]] <=> [b[:letter]] + # end + # data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后 return data end @@ -47,10 +47,10 @@ module Weapps::CoursesHelper end end end - data = data.sort do |a, b| - [a[:letter]] <=> [b[:letter]] - end - data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后 + # data = data.sort do |a, b| + # [a[:letter]] <=> [b[:letter]] + # end + # data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后 return data end From dcff3adeaba8035b3e3de6f1c5ddf15b84ebc07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 26 Nov 2019 11:45:20 +0800 Subject: [PATCH 26/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewFooter.js | 148 ++++++---------------- 1 file changed, 37 insertions(+), 111 deletions(-) diff --git a/public/react/src/modules/tpm/NewFooter.js b/public/react/src/modules/tpm/NewFooter.js index f54fa1d3f..4ff1cc46a 100644 --- a/public/react/src/modules/tpm/NewFooter.js +++ b/public/react/src/modules/tpm/NewFooter.js @@ -1,127 +1,53 @@ -import React, {Component} from 'react'; -import {Redirect} from 'react-router'; -import {Link} from 'react-router-dom'; -import {getImageUrl, toPath} from 'educoder' +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; +import { Link } from 'react-router-dom'; +import { getImageUrl, toPath } from 'educoder' import PropTypes from 'prop-types'; class NewFooter extends Component { - constructor(props) { - super(props) + constructor(props) { + super(props) - } + } - componentWillReceiveProps(newProps, newContext) { + componentWillReceiveProps(newProps, newContext) { - } + } - render() { - return ( -
    + render() { + return ( +
    {/*newContainers*/} -
    - {this.props.user && this.props.user.main_site === true ?
    - {/*
    +
    + {this.props.user&&this.props.user.main_site===true?
    + {/*
    高校智能化教学与实训平台 EduCoder.net
    */} -
      -
    • 网站首页
    • -
    • 关于我们
    • -
    • 联系我们
    • -
    • 合作伙伴
    • -
    • 服务协议
    • -
    • 帮助中心
    • -
    • 意见反馈
    • -
    -
    : ""} - - -
    - {this.props.mygetHelmetapi === null ? "" : - this.props.mygetHelmetapi === undefined || this.props.mygetHelmetapi.footer === null || this.props.mygetHelmetapi.footer === undefined ? +
      +
    • 网站首页
    • +
    • 关于我们
    • +
    • 联系我们
    • +
    • 合作伙伴
    • +
    • 服务协议
    • +
    • 帮助中心
    • +
    • 意见反馈
    • +
    +
    :""} +
    + {this.props.mygetHelmetapi === null ? "" : + this.props.mygetHelmetapi===undefined|| this.props.mygetHelmetapi.footer===null||this.props.mygetHelmetapi.footer===undefined?

    © 2019 EduCoder - 湘ICP备17009477号 - + 湘ICP备17009477号 + 湘公网安备43019002000962号 - Trustie   &   IntelliDE inside. 版权所有 湖南智擎科技有限公司

    @@ -130,12 +56,12 @@ class NewFooter extends Component { } -
    -
    -
    -
    - ); - } +
    +
    +
    +
    + ); + } } export default NewFooter; From 861cf7d7b2218e98baac8601d8603de0f62a0a31 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 14:02:08 +0800 Subject: [PATCH 27/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tidings_controller.rb | 5 ++++- app/views/tidings/index.json.jbuilder | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/tidings_controller.rb b/app/controllers/tidings_controller.rb index 9324b2755..5acffcb16 100644 --- a/app/controllers/tidings_controller.rb +++ b/app/controllers/tidings_controller.rb @@ -6,6 +6,7 @@ class TidingsController < ApplicationController def index tidings = current_user.tidings + @onclick_time = current_user.click_time tiding_types = case params[:type] @@ -18,11 +19,13 @@ class TidingsController < ApplicationController end tidings = tidings.where(tiding_type: tiding_types) if tiding_types.present? + tidings = tidings.where(container_type: 'JoinCourse') if params[:type] == 'course_apply' + @course_apply_count = tidings.where("created_at > '#{@onclick_time}'").where(container_type: 'JoinCourse').count + tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package' @count = tidings.count @tidings = paginate(tidings.order(created_at: :desc), per_page: 10) - @onclick_time = current_user.click_time end private diff --git a/app/views/tidings/index.json.jbuilder b/app/views/tidings/index.json.jbuilder index 69f932f8f..26c31d98b 100644 --- a/app/views/tidings/index.json.jbuilder +++ b/app/views/tidings/index.json.jbuilder @@ -1,2 +1,3 @@ json.count @count json.tidings @tidings, partial: 'tidings/tiding', as: :tiding +json.course_apply_count @course_apply_count From bb3bee01d20b27908d7d72605b502477318707c9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 14:06:36 +0800 Subject: [PATCH 28/43] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 12 +++++++++++- app/views/subjects/add_shixun_to_stage.json.jbuilder | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 app/views/subjects/add_shixun_to_stage.json.jbuilder diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index d38293a8f..9ba8bb55d 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -5,7 +5,7 @@ class SubjectsController < ApplicationController before_action :find_subject, except: [:index, :create, :new, :append_to_stage] before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, - :up_member_position, :down_member_position, :update_team_title] + :up_member_position, :down_member_position, :update_team_title, :add_shixun_to_stage] before_action :require_admin, only: [:copy_subject] include ApplicationHelper @@ -212,6 +212,16 @@ class SubjectsController < ApplicationController @shixuns = Shixun.where(id: params[:shixun_id]).order("id desc") end + # 添加实训项目 + def add_shixun_to_stage + identifier = generate_identifier Shixun, 8 + ActiveRecord::Base.transaction do + @shixun = Shixun.create!(name: params[:name], user_id: current_user.id, identifier: identifier) + # 添加合作者 + @shixun.shixun_members.create!(user_id: current_user.id, role: 1) + end + end + def choose_course course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) diff --git a/app/views/subjects/add_shixun_to_stage.json.jbuilder b/app/views/subjects/add_shixun_to_stage.json.jbuilder new file mode 100644 index 000000000..45b584231 --- /dev/null +++ b/app/views/subjects/add_shixun_to_stage.json.jbuilder @@ -0,0 +1,3 @@ +json.shixun_identifier @shixun.identifier +json.shixun_name @shixun.name +json.shixun_id @shixun.id \ No newline at end of file From baf6774aab15cc51fbc5072da1721bcae3e395a3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 14:07:37 +0800 Subject: [PATCH 29/43] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 0f31c6d48..fc2ff5e3d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -325,6 +325,7 @@ Rails.application.routes.draw do get 'create_subject' get 'new_subject' post 'append_to_stage' + post :add_shixun_to_stage get 'search' end end From 11c6e54d904131dbab71c15e3b195c36867c0ba1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 14:49:37 +0800 Subject: [PATCH 30/43] =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 9ba8bb55d..f25459ee4 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -2,7 +2,7 @@ class SubjectsController < ApplicationController before_action :require_login, :check_auth, except: [:index, :show, :right_banner] # before_action :check_auth, except: [:index] before_action :check_account, except: [:index, :show, :right_banner] - before_action :find_subject, except: [:index, :create, :new, :append_to_stage] + before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage] before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :up_member_position, :down_member_position, :update_team_title, :add_shixun_to_stage] From 02fead012bf5e4ab1a35cb8337c2fba231de859c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 14:51:31 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index f25459ee4..917f3ad8e 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -5,7 +5,7 @@ class SubjectsController < ApplicationController before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage] before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, - :up_member_position, :down_member_position, :update_team_title, :add_shixun_to_stage] + :up_member_position, :down_member_position, :update_team_title] before_action :require_admin, only: [:copy_subject] include ApplicationHelper From c1bc58de8d24e17a133f502b5d2a607fefd97289 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 16:52:40 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/wechat/weapp.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/libs/wechat/weapp.rb b/app/libs/wechat/weapp.rb index ca356b28d..cbf26efd2 100644 --- a/app/libs/wechat/weapp.rb +++ b/app/libs/wechat/weapp.rb @@ -22,8 +22,8 @@ class Wechat::Weapp end def decrypt(session_key, encrypted_data, iv) - session_key = Base64.decode64(session_key) - encrypted_data = Base64.decode64(encrypted_data) + session_key = Base64.decode64(session_key).force_encoding("utf-8") + encrypted_data = Base64.decode64(encrypted_data).force_encoding("utf-8") iv = Base64.decode64(iv) cipher = OpenSSL::Cipher::AES.new(128, :CBC) From 24b7e9763302aa0ad1c09c2c0db429a99d200378 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 16:57:50 +0800 Subject: [PATCH 33/43] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E5=8D=B7=E7=8A=B6=E6=80=81=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/poll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index ea6656ca2..5c1a9a64c 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -128,7 +128,7 @@ class Poll < ApplicationRecord en_time = end_time else poll_group_setting = poll_group_settings - user_group = course.course_members.where(user_id: user_id).select(:course_group_id) + user_group = course.students.where(user_id: user_id).select(:course_group_id) if user_group.exists? user_group_id = user_group.first&.course_group_id user_p_group_setting = poll_group_setting.where(course_group_id: user_group_id).select(:publish_time,:end_time) From 91b7648d9e33487d4c2b4313e6c52e521b186ace Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 17:09:06 +0800 Subject: [PATCH 34/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/wechat/weapp.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/libs/wechat/weapp.rb b/app/libs/wechat/weapp.rb index cbf26efd2..aed14128b 100644 --- a/app/libs/wechat/weapp.rb +++ b/app/libs/wechat/weapp.rb @@ -22,8 +22,16 @@ class Wechat::Weapp end def decrypt(session_key, encrypted_data, iv) - session_key = Base64.decode64(session_key).force_encoding("utf-8") - encrypted_data = Base64.decode64(encrypted_data).force_encoding("utf-8") + session_key = Base64.decode64(session_key) + encrypted_data = Base64.decode64(encrypted_data) + cd = CharDet.detect(content) + encrypted_data = + if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8 + encrypted_data.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '}) + else + encrypted_data.force_encoding('UTF-8') + end + iv = Base64.decode64(iv) cipher = OpenSSL::Cipher::AES.new(128, :CBC) From 52528fa4c1fc03b9fa4234e7f0f2eb642fbd4b21 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 17:15:11 +0800 Subject: [PATCH 35/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/wechat/weapp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/wechat/weapp.rb b/app/libs/wechat/weapp.rb index aed14128b..0a1cc5eed 100644 --- a/app/libs/wechat/weapp.rb +++ b/app/libs/wechat/weapp.rb @@ -24,7 +24,7 @@ class Wechat::Weapp def decrypt(session_key, encrypted_data, iv) session_key = Base64.decode64(session_key) encrypted_data = Base64.decode64(encrypted_data) - cd = CharDet.detect(content) + cd = CharDet.detect(encrypted_data) encrypted_data = if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8 encrypted_data.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '}) From ac61421fb2c1c7d0c80e1cc869fe028f3b260fd7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 17:27:48 +0800 Subject: [PATCH 36/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/wechat/weapp.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/libs/wechat/weapp.rb b/app/libs/wechat/weapp.rb index 0a1cc5eed..ca356b28d 100644 --- a/app/libs/wechat/weapp.rb +++ b/app/libs/wechat/weapp.rb @@ -24,14 +24,6 @@ class Wechat::Weapp def decrypt(session_key, encrypted_data, iv) session_key = Base64.decode64(session_key) encrypted_data = Base64.decode64(encrypted_data) - cd = CharDet.detect(encrypted_data) - encrypted_data = - if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8 - encrypted_data.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '}) - else - encrypted_data.force_encoding('UTF-8') - end - iv = Base64.decode64(iv) cipher = OpenSSL::Cipher::AES.new(128, :CBC) From 1e30415c10785d745cf99f618cd6760302c4e459 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 18:06:09 +0800 Subject: [PATCH 37/43] =?UTF-8?q?OJ=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index fc2ff5e3d..4d277cd54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -57,8 +57,14 @@ Rails.application.routes.draw do get :code_debug get :code_submit match :listen_result, :via => [:get, :post] + get :submit_records end + collection do + get :record_detail + end + + end From 082650e839a700779493f0da8fff0e2535b522b1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 26 Nov 2019 18:20:45 +0800 Subject: [PATCH 38/43] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/code_sessions_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/weapps/code_sessions_controller.rb b/app/controllers/weapps/code_sessions_controller.rb index 887e97eed..2dbd08e82 100644 --- a/app/controllers/weapps/code_sessions_controller.rb +++ b/app/controllers/weapps/code_sessions_controller.rb @@ -15,6 +15,8 @@ class Weapps::CodeSessionsController < Weapps::BaseController logged = true else # 根据 code没拿到 unionid + Rails.logger.info("[Weapp] session_key: #{result['session_key']}") + Rails.logger.info("[Weapp] code: #{params[:code]}") user_info = Wechat::Weapp.decrypt(result['session_key'], params[:encrypted_data], params[:iv]) # 老用户,已绑定 From 4d6f66ea3c28ab321c8a37dc3b88bdd1d113ef13 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 19:53:26 +0800 Subject: [PATCH 39/43] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4c61fb1df..06adc676d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -404,25 +404,6 @@ class ApplicationController < ActionController::Base end end - # 处理返回非0就报错的请求 - def interface_post(uri, params, status, message) - begin - uid_logger_dubug("--uri_exec: params is #{params}, url is #{uri}") - uri = URI.parse(URI.encode(uri.strip)) - res = Net::HTTP.post_form(uri, params).body - uid_logger_dubug("--uri_exec: .....res is #{res}") - res = JSON.parse(res) - if (res && res['code'] != 0) - tip_exception(status, message) - else - res - end - rescue Exception => e - uid_logger("--uri_exec: exception #{e.message}") - raise Educoder::TipException.new("实训平台繁忙(繁忙等级:84)") - end - end - # json格式请求 def interface_json_post(uri, params, status, message) begin From b18588464a17709e099456d94c22f9ba50dbaaf3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 19:57:25 +0800 Subject: [PATCH 40/43] 1 --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 4d277cd54..070d2f383 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -42,7 +42,6 @@ Rails.application.routes.draw do member do post :publish get :start - get :result post :update_set delete :delete_set end @@ -57,6 +56,7 @@ Rails.application.routes.draw do get :code_debug get :code_submit match :listen_result, :via => [:get, :post] + get :result get :submit_records end From bf1c27666dad744ebf102066ee76cff9b3fcaf4a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 20:13:10 +0800 Subject: [PATCH 41/43] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hack_user_lastest_codes_controller.rb | 9 +++++++-- .../restore_initial_code.json.jbuilder | 1 + config/routes.rb | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 app/views/hack_user_lastest_codes/restore_initial_code.json.jbuilder diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 2d749ce75..d03b9bd7d 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -1,9 +1,9 @@ class HackUserLastestCodesController < ApplicationController before_action :require_login, except: [:listen_result] before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code, - :listen_result, :result, :submit_records] + :listen_result, :result, :submit_records, :restore_initial_code] before_action :update_user_hack_status, only: [:code_debug, :code_submit] - before_action :require_auth_identity, only: [:update_code] + before_action :require_auth_identity, only: [:update_code, :restore_initial_code] before_action :require_manager_identity, only: [:update_code] def show @@ -14,6 +14,11 @@ class HackUserLastestCodesController < ApplicationController @my_hack.update_attribute(:code, params[:code]) end + # 回复初始代码 + def restore_initial_code + @my_hack.update_attribute(:code, @hack.code) + end + # 调试代码 def code_debug exec_mode = "debug" diff --git a/app/views/hack_user_lastest_codes/restore_initial_code.json.jbuilder b/app/views/hack_user_lastest_codes/restore_initial_code.json.jbuilder new file mode 100644 index 000000000..3b272f298 --- /dev/null +++ b/app/views/hack_user_lastest_codes/restore_initial_code.json.jbuilder @@ -0,0 +1 @@ +json.code @hack.code \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 070d2f383..577428c7a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,6 +58,7 @@ Rails.application.routes.draw do match :listen_result, :via => [:get, :post] get :result get :submit_records + post :restore_initial_code end collection do From 2045fb59907aba3097fe56fd4d286a242de274dd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 27 Nov 2019 09:48:54 +0800 Subject: [PATCH 42/43] 1 --- app/controllers/concerns/login_helper.rb | 2 +- app/controllers/oauth/base_controller.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index cf0c8e1e3..ec4656e3b 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -29,7 +29,7 @@ module LoginHelper Rails.logger.info("id: #{user&.id} Successful authentication start: '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}") # Valid user self.logged_user = user - + session[:"#{default_yun_session}"] = user.id # generate a key and set cookie if autologin set_autologin_cookie(user) diff --git a/app/controllers/oauth/base_controller.rb b/app/controllers/oauth/base_controller.rb index 327f21845..6236ff02b 100644 --- a/app/controllers/oauth/base_controller.rb +++ b/app/controllers/oauth/base_controller.rb @@ -5,6 +5,10 @@ class Oauth::BaseController < ActionController::Base skip_before_action :verify_authenticity_token + included do + helper_method :default_yun_session + end + def auth_failure render_error(params[:message]) end @@ -24,4 +28,9 @@ class Oauth::BaseController < ActionController::Base Rails.logger.info("[OAuth2] omniauth.auth -> #{request.env['omniauth.auth'].inspect}") request.env['omniauth.auth'] end + + def default_yun_session + @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" + # @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" + end end \ No newline at end of file From c5217b93a95bb723dd6089d038e3aa368b8e3a53 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 27 Nov 2019 09:51:10 +0800 Subject: [PATCH 43/43] 2 --- app/controllers/oauth/base_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/oauth/base_controller.rb b/app/controllers/oauth/base_controller.rb index 6236ff02b..11ac69d71 100644 --- a/app/controllers/oauth/base_controller.rb +++ b/app/controllers/oauth/base_controller.rb @@ -2,13 +2,10 @@ class Oauth::BaseController < ActionController::Base include RenderHelper include LoginHelper include ControllerRescueHandler + include LaboratoryHelper skip_before_action :verify_authenticity_token - included do - helper_method :default_yun_session - end - def auth_failure render_error(params[:message]) end