From c3cd7517cffb3cab9589054afe7d8b09b6ecc7be Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 20 Nov 2019 20:30:42 +0800 Subject: [PATCH 01/19] 1 --- app/controllers/hack_user_lastest_codes_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index fcbecec0d..9602673e5 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -136,7 +136,9 @@ class HackUserLastestCodesController < ApplicationController if @my_hack.hack_user_debug.present? @my_hack.hack_user_debug.update_attributes!(debug_params) else - @my_hack.hack_user_debug.create!(debug_params) + debug = HackUserDebug.new(debug_params) + debug.hack_user_lastest_code_id = @my_hack.id + debug.save! end end From 1d93038691f5129147e56ae1c26c737dac449a52 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 20 Nov 2019 20:34:49 +0800 Subject: [PATCH 02/19] 1 --- db/migrate/20191120123353_add_code_forhack_user_debugs.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20191120123353_add_code_forhack_user_debugs.rb diff --git a/db/migrate/20191120123353_add_code_forhack_user_debugs.rb b/db/migrate/20191120123353_add_code_forhack_user_debugs.rb new file mode 100644 index 000000000..d3285f26b --- /dev/null +++ b/db/migrate/20191120123353_add_code_forhack_user_debugs.rb @@ -0,0 +1,5 @@ +class AddCodeForhackUserDebugs < ActiveRecord::Migration[5.2] + def change + add_column :hack_user_debugs, :code, :text + end +end From 7401bff48cf4db144cf6b8910ca7cb3b321f4388 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 09:37:38 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E3=80=81=E8=81=8C=E4=B8=9A=E8=AE=A4=E8=AF=81=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/application_controller.rb | 7 +++++++ app/services/admins/identity_auths/refuse_apply_service.rb | 1 + .../admins/professional_auths/refuse_apply_service.rb | 1 + app/services/users/apply_authentication_service.rb | 2 +- app/services/users/apply_professional_auth_service.rb | 4 ++-- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1bc2bad7d..f04d126f4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -45,6 +45,13 @@ class ApplicationController < ActionController::Base check_account tip_exception(@course.excellent ? 410 : 409, "您没有权限进入") end + if @user_course_identity == Course::STUDENT + # 实名认证和职业认证的身份判断 + tip_exception(-2, "你的实名认证和职业认证审核未通过") if @course.authentication && + @course.professional_certification && (!current_user.authentication && !current_user.professional_certification) + tip_exception(-2, "你的实名认证审核未通过") if @course.authentication && !current_user.authentication + tip_exception(-2, "你的职业认证审核未通过") if @course.professional_certification && !current_user.professional_certification + end uid_logger("###############user_course_identity:#{@user_course_identity}") end diff --git a/app/services/admins/identity_auths/refuse_apply_service.rb b/app/services/admins/identity_auths/refuse_apply_service.rb index 7ac2e6c38..dfc9168a9 100644 --- a/app/services/admins/identity_auths/refuse_apply_service.rb +++ b/app/services/admins/identity_auths/refuse_apply_service.rb @@ -10,6 +10,7 @@ class Admins::IdentityAuths::RefuseApplyService < ApplicationService def call ActiveRecord::Base.transaction do apply.update!(status: 2, remarks: reason) + user.update!(authentication: false) deal_tiding! apply.attachment&.destroy diff --git a/app/services/admins/professional_auths/refuse_apply_service.rb b/app/services/admins/professional_auths/refuse_apply_service.rb index a055488c3..014fbab0b 100644 --- a/app/services/admins/professional_auths/refuse_apply_service.rb +++ b/app/services/admins/professional_auths/refuse_apply_service.rb @@ -10,6 +10,7 @@ class Admins::ProfessionalAuths::RefuseApplyService < ApplicationService def call ActiveRecord::Base.transaction do apply.update!(status: 2, remarks: reason) + user.update!(professional_certification: false) deal_tiding! apply.attachment&.destroy diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index 1b9b02c91..b4aa8f496 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -18,7 +18,7 @@ class Users::ApplyAuthenticationService < ApplicationService user.show_realname = params[:show_realname].to_s == 'true' if params[:show_realname].to_s.present? ActiveRecord::Base.transaction do - user.authentication = false + user.authentication = true user.save! user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present? diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index 81cd11a4c..074f1cee7 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -14,13 +14,13 @@ class Users::ApplyProfessionalAuthService < ApplicationService Users::ApplyProfessionalAuthForm.new(params).validate! raise Error, '您已经申请过职业认证了' if ApplyUserAuthentication.professional_auth.processing.exists?(user_id: user.id) - user.professional_certification = false - extension = user.user_extension extension.school_id = params[:school_id] extension.department_id = params[:department_id] extension.identity = params[:identity] + user.professional_certification = extension.identity != 0 + extra = params[:extra].to_s.strip.presence if extension.identity.to_s == 'student' extension.technical_title = nil From 2f9700266804998416dfd547c2c0d4c4d28269eb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 09:55:47 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=AD=A6=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/apply_teachers.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/courses/apply_teachers.json.jbuilder b/app/views/courses/apply_teachers.json.jbuilder index bd88d5fbe..b81f5d77b 100644 --- a/app/views/courses/apply_teachers.json.jbuilder +++ b/app/views/courses/apply_teachers.json.jbuilder @@ -9,6 +9,7 @@ json.application_list do json.name_link user_path(application.application_user) json.login application.application_user.login json.image_url url_to_avatar(application.application_user) + json.school_name application.application_user.school_name json.role application.content.to_i == 3 || application.content.to_i == 7 ? "助教" : application.content.to_i == 2 || application.content.to_i == 9 ? "教师" : "" end end \ No newline at end of file From 61db2576b21314db0d4f1c70a4763cb900b8d954 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 21 Nov 2019 11:03:08 +0800 Subject: [PATCH 05/19] =?UTF-8?q?oj=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20191121025552_modify_execute_time_for_hack_user_code.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb diff --git a/db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb b/db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb new file mode 100644 index 000000000..c66e13a03 --- /dev/null +++ b/db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb @@ -0,0 +1,6 @@ +class ModifyExecuteTimeForHackUserCode < ActiveRecord::Migration[5.2] + def change + change_column :hack_user_debugs, :execute_time, :float + change_column :hack_user_codes, :execute_time, :float + end +end From de4ad7ce08658feb1700dd505c7513e294c73f32 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, 21 Nov 2019 11:08:16 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E9=BB=91=E5=AE=A2=E6=9D=BE=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E8=B0=83=E6=95=B4=20=E8=AF=BE=E5=A0=82=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E7=94=A8=E6=88=B7=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E7=94=A8=E6=88=B7=E6=8F=90=E7=A4=BA=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=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 | 36 ++++++++++++++----- .../shixunreport/ConclusionEvaluation.js | 14 ++++++-- .../src/modules/osshackathon/Osshackathon.css | 2 -- .../src/modules/osshackathon/Osshackathon.js | 1 + .../react/src/modules/user/AccountProfile.js | 29 ++++++++------- 5 files changed, 56 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 503c73a10..bf1ac2bc0 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -130,16 +130,29 @@ class CoursesBanner extends Component { axios.get(url,{params: dataqueryss }).then((result) => { - if( result!=undefined){ - let data = result.data; - this.setState({ - coursedata: data, - excellent:data.excellent, - }) - this.props.ispostexcellenttype(data.excellent) + debugger + if(result.data.status===-2){ + this.setState({ + AccountProfiletype:true, + content:result.data.message, + okText:"立即认证", + cannelText:"稍后认证", + okHref:`/account/certification`, + Accounturltype:true + }) }else{ - this.onloadupdatabanner() + if( result!=undefined){ + let data = result.data; + this.setState({ + coursedata: data, + excellent:data.excellent, + }) + this.props.ispostexcellenttype(data.excellent) + }else{ + this.onloadupdatabanner() + } } + }) }; foo=(url)=> { @@ -452,7 +465,12 @@ class CoursesBanner extends Component { hideAccountProfile=()=>{ this.setState({ - AccountProfiletype:false + AccountProfiletype:false, + content:undefined, + okText:undefined, + okHref:undefined, + cannelText:undefined, + Accounturltype:undefined }) }; ysljoinmodalCancel=()=>{ diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js index 5430b9e8c..e9771157c 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import {WordsBtn} from 'educoder'; -import {Table,Tooltip,} from "antd"; +import {Table,Tooltip} from "antd"; import {Link,Switch,Route,Redirect} from 'react-router-dom'; class ConclusionEvaluation extends Component { @@ -23,10 +23,18 @@ class ConclusionEvaluation extends Component { dataIndex: 'type', key: 'type', render: (text, record) => ( - {record.type} + + 按照总分的百分比评价,而不是分值
+ [90,100]优秀
+ [70,90]良好
+ [60,70]及格
+ [0,60]不及格
+ + }> {record.type}
), }, { - title: '获得经验值', + title:获得经验值, dataIndex: 'empirical', key: 'empirical', render: (text, record) => ( diff --git a/public/react/src/modules/osshackathon/Osshackathon.css b/public/react/src/modules/osshackathon/Osshackathon.css index 679f4afb0..227bd1150 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.css +++ b/public/react/src/modules/osshackathon/Osshackathon.css @@ -37,11 +37,9 @@ } .OsshackathonCardtitle{ - height:24px; font-size:24px; font-weight:400; color:rgba(5,16,26,1); - line-height:24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index 7edc18d63..c48b4b656 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -357,6 +357,7 @@ class Osshackathon extends Component { + 报名人数:{item.hack_users_count} {item.entry_info===true?:} diff --git a/public/react/src/modules/user/AccountProfile.js b/public/react/src/modules/user/AccountProfile.js index ea8d20b8a..1774a9fd5 100644 --- a/public/react/src/modules/user/AccountProfile.js +++ b/public/react/src/modules/user/AccountProfile.js @@ -31,18 +31,23 @@ class AccountProfile extends Component { } - gotoback=()=>{ - if(this.props.AccountProfiletype!=undefined){ - this.setState({ - AccountProfiletype:false - }) - this.props.hideAccountProfile() - }else{ + gotoback=(type)=>{ + if(type===true){ window.location.href="/"; - this.setState({ - AccountProfiletype:false - }) + }else{ + if(this.props.AccountProfiletype!=undefined){ + this.setState({ + AccountProfiletype:false + }) + this.props.hideAccountProfile() + }else{ + window.location.href="/"; + this.setState({ + AccountProfiletype:false + }) + } } + } @@ -52,7 +57,7 @@ okText: '立即完成', okHref: '/account/certification' */ render() { - const { content, okText, okHref } = this.props; + const { content, okText, okHref,cannelText,Accounturltype} = this.props; return(

{content || '您需要去完善您的个人资料,才能使用此功能'}

- this.gotoback()}>稍后完善 + this.gotoback(Accounturltype)}>{cannelText ||'稍后完善'} {okText || '立即完善'}
From 26abc5ed3ba2bb953c760c8d14d494d36ef3a7ea Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 11:23:54 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E5=B7=B2?= =?UTF-8?q?=E7=AD=94=E6=9C=AA=E7=AD=94=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 | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index fff320323..bf7f465d5 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1760,19 +1760,12 @@ class ExercisesController < ApplicationController else ques_number = q.question_number end + ques_status = 0 if q.question_type != Exercise::PRACTICAL ques_vote = q.exercise_answers.select{|answer| answer.user_id == user_id} - else - ques_vote = q.exercise_shixun_answers.select{|answer| answer.user_id == user_id} - end - ques_status = 0 - if ques_vote.present? - if q.question_type == Exercise::PRACTICAL - if ques_vote.pluck(:exercise_shixun_challenge_id).sort == q.exercise_shixun_challenges.pluck(:id).sort #用户的总得分等于问题的分数 - ques_status = 1 #全部回答了,才算已答 - question_answered += 1 - end - else #其他题目,需回答的有内容,才会为已答,否则如内容为空,视为未答 + + if ques_vote.present? + #其他题目,需回答的有内容,才会为已答,否则如内容为空,视为未答 vote_answer_id = ques_vote.pluck(:exercise_choice_id).reject(&:blank?) vote_text_count = ques_vote.pluck(:answer_text).reject(&:blank?).size if q.question_type <= Exercise::JUDGMENT #选择题和判断题的时候,需要有选项,才算回答 @@ -1780,11 +1773,6 @@ class ExercisesController < ApplicationController ques_status = 1 question_answered += 1 end - elsif q.question_type == Exercise::COMPLETION #填空题的时候,需要有选项和内容,才算回答 - if vote_answer_id.uniq.sort == q.exercise_standard_answers.pluck(:exercise_choice_id).uniq.sort - ques_status = 1 - question_answered += 1 - end else if vote_text_count > 0 #主观题,必选有内容,才算回答 ques_status = 1 @@ -1792,6 +1780,11 @@ class ExercisesController < ApplicationController end end end + else + if Myshixun.exists?(user_id: user_id, shixun_id: q.shixun_id) + ques_status = 1 + question_answered += 1 + end end question_status = { :ques_id => q.id, From a911945a4c1223da4e4338b5db82754e6fcabd8e 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, 21 Nov 2019 14:08:18 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunreport/ConclusionEvaluation.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js index e9771157c..8d678f335 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js @@ -23,18 +23,10 @@ class ConclusionEvaluation extends Component { dataIndex: 'type', key: 'type', render: (text, record) => ( - - 按照总分的百分比评价,而不是分值
- [90,100]优秀
- [70,90]良好
- [60,70]及格
- [0,60]不及格
- - }> {record.type}
+ {record.type} ), }, { - title:获得经验值, + title:'获得经验值', dataIndex: 'empirical', key: 'empirical', render: (text, record) => ( From c52c756b81ec62ef84e3642d9b656b14a332ef65 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, 21 Nov 2019 16:27:49 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E9=BB=91=E5=AE=A2=E6=9D=BE=E6=9D=83?= =?UTF-8?q?=E9=99=90=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/osshackathon/Osshackathon.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index c48b4b656..67c81381c 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -119,14 +119,11 @@ class Osshackathon extends Component { } //判断是否绑定邮箱 - if(this.props.user.email===null){ - this.props.showhideAccountPhoneemailDialog() - return - } - if(this.props.user.phone===null){ + if(this.props.user.email===null&&this.props.user.phone===null){ this.props.showhideAccountPhoneemailDialog() return } + this.props.confirm({ content: `是否确认报名?`, onOk: () => { From 707e6102a1b66d979d22b035eb77f75393e0cdcd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 21 Nov 2019 16:33:24 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/shixun_settings_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index d635ae8df..96d373459 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -65,19 +65,19 @@ class Admins::ShixunSettingsController < Admins::BaseController sheet1.row(0).default_format = blue sheet1.row(0).concat(["实训ID","实训名称","技术平台", "Fork源", "实践任务","选择题任务","挑战人数", "通关人数", "状态","创建者", "单位", "职业", "关卡序号","关卡名称","技能标签"]) count_row = 1 - shixuns.find_each do |shixun| + shixuns.includes(:challenges, :user, :myshixuns).find_each do |shixun| sheet1[count_row, 0] = shixun.identifier sheet1[count_row, 1] = shixun.name sheet1[count_row, 2] = shixun.shixun_main_name sheet1[count_row, 3] = shixun.fork_identifier sheet1[count_row, 4] = shixun.challenges.practice_type.count sheet1[count_row, 5] = shixun.challenges.choose_type.count - sheet1[count_row, 6] = shixun.myshixuns.count - sheet1[count_row, 7] = shixun.myshixuns.finished.count + sheet1[count_row, 6] = shixun.myshixuns_count + sheet1[count_row, 7] = shixun.myshixuns.map{|m| m.status = 1}.size sheet1[count_row, 8] = shixun.shixun_status - sheet1[count_row, 9] = shixun.owner.show_real_name - sheet1[count_row, 10] = shixun.owner.school_name - sheet1[count_row, 11] = shixun.owner.identity + sheet1[count_row, 9] = shixun.user.show_real_name + sheet1[count_row, 10] = shixun.user.school_name + sheet1[count_row, 11] = shixun.user.identity shixun.challenges.each do |challenge| sheet1[count_row, 12] = "第#{challenge.position}关" sheet1[count_row, 13] = challenge.subject From 50550eae9099c85b3fc4436f35ed1e4ef02d9bc0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 21 Nov 2019 16:37:59 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/shixun_settings_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 96d373459..749ce34bf 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -65,15 +65,15 @@ class Admins::ShixunSettingsController < Admins::BaseController sheet1.row(0).default_format = blue sheet1.row(0).concat(["实训ID","实训名称","技术平台", "Fork源", "实践任务","选择题任务","挑战人数", "通关人数", "状态","创建者", "单位", "职业", "关卡序号","关卡名称","技能标签"]) count_row = 1 - shixuns.includes(:challenges, :user, :myshixuns).find_each do |shixun| + shixuns.includes(:challenges, :user, :myshixuns, :mirror_repositories).find_each do |shixun| sheet1[count_row, 0] = shixun.identifier sheet1[count_row, 1] = shixun.name - sheet1[count_row, 2] = shixun.shixun_main_name + sheet1[count_row, 2] = shixun.mirror_repositories.map{|mr| mr.main_type == 1}.first&.type_name sheet1[count_row, 3] = shixun.fork_identifier - sheet1[count_row, 4] = shixun.challenges.practice_type.count - sheet1[count_row, 5] = shixun.challenges.choose_type.count + sheet1[count_row, 4] = shixun.challenges.map{|c| c.st == 0}.size + sheet1[count_row, 5] = shixun.challenges.map{|c| c.st == 1}.size sheet1[count_row, 6] = shixun.myshixuns_count - sheet1[count_row, 7] = shixun.myshixuns.map{|m| m.status = 1}.size + sheet1[count_row, 7] = shixun.myshixuns.map{|m| m.status == 1}.size sheet1[count_row, 8] = shixun.shixun_status sheet1[count_row, 9] = shixun.user.show_real_name sheet1[count_row, 10] = shixun.user.school_name From 9c7c21a513c937f324cb58eda2cee8145aabe875 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 16:45:09 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5?= =?UTF-8?q?=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/helpers/weapps/courses_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/weapps/courses_helper.rb b/app/helpers/weapps/courses_helper.rb index a58127c4c..94769fc2e 100644 --- a/app/helpers/weapps/courses_helper.rb +++ b/app/helpers/weapps/courses_helper.rb @@ -23,6 +23,7 @@ module Weapps::CoursesHelper 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 @@ -49,6 +50,7 @@ module Weapps::CoursesHelper 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 6442b1e3ab9a63c78b7a2cab593e2efb0dc91db7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 21 Nov 2019 16:48:43 +0800 Subject: [PATCH 13/19] 1 --- app/controllers/admins/shixun_settings_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 749ce34bf..822bc2bdf 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -68,12 +68,13 @@ class Admins::ShixunSettingsController < Admins::BaseController shixuns.includes(:challenges, :user, :myshixuns, :mirror_repositories).find_each do |shixun| sheet1[count_row, 0] = shixun.identifier sheet1[count_row, 1] = shixun.name - sheet1[count_row, 2] = shixun.mirror_repositories.map{|mr| mr.main_type == 1}.first&.type_name + sheet1[count_row, 2] = shixun.mirror_repositories.select{|mr| mr.main_type == "1"}.first&.type_name + sheet1[count_row, 3] = shixun.fork_identifier - sheet1[count_row, 4] = shixun.challenges.map{|c| c.st == 0}.size - sheet1[count_row, 5] = shixun.challenges.map{|c| c.st == 1}.size + sheet1[count_row, 4] = shixun.challenges.select{|c| c.st == 0}.size + sheet1[count_row, 5] = shixun.challenges.select{|c| c.st == 1}.size sheet1[count_row, 6] = shixun.myshixuns_count - sheet1[count_row, 7] = shixun.myshixuns.map{|m| m.status == 1}.size + sheet1[count_row, 7] = shixun.myshixuns.select{|m| m.status == 1}.size sheet1[count_row, 8] = shixun.shixun_status sheet1[count_row, 9] = shixun.user.show_real_name sheet1[count_row, 10] = shixun.user.school_name From 5f072638e55ae573f04ad1d32b46230054f8fe32 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, 21 Nov 2019 16:52:25 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/statistics/Statistics.js | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/public/react/src/modules/courses/statistics/Statistics.js b/public/react/src/modules/courses/statistics/Statistics.js index bb1ed9a09..412c7acbe 100644 --- a/public/react/src/modules/courses/statistics/Statistics.js +++ b/public/react/src/modules/courses/statistics/Statistics.js @@ -73,27 +73,30 @@ class Statistics extends Component{ } getDynamiclistdatas=(group_ids)=>{ - - let courseId=this.props.match.params.coursesId; - let url=`/courses/${courseId}/act_score.json`; - let data={ - group_ids:group_ids, - } - axios.get(url,{params: - data - }).then((result) => { - if (result) { + let {activeKey}=this.state; + if(activeKey==='2') { + let courseId = this.props.match.params.coursesId; + let url = `/courses/${courseId}/act_score.json`; + let data = { + group_ids: group_ids, + } + axios.get(url, { + params: + data + }).then((result) => { + if (result) { + this.setState({ + course_members: result.data.course_members, + bomisSpin: false + }) + } + }).catch((error) => { + console.log(error); this.setState({ - course_members:result.data.course_members, - bomisSpin:false + bomisSpin: false, }) - } - }).catch((error) => { - console.log(error); - this.setState({ - bomisSpin:false, }) - }) + } } getwork_scoredata=(page,group_ids,sort)=>{ From 75ab3578fdc7243eaade117675bf4c39f950310e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 16:54:20 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E5=AE=9E=E5=90=8D/=E8=81=8C=E4=B8=9A?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E9=87=8D=E6=96=B0=E8=AE=A4=E8=AF=81=E6=97=B6?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=B7=B2=E7=94=B3=E8=AF=B7=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users/apply_authentication_service.rb | 4 +++- app/services/users/apply_professional_auth_service.rb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index b4aa8f496..a6b02f431 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -10,7 +10,7 @@ class Users::ApplyAuthenticationService < ApplicationService raise Error, '请先完善基本信息' unless user.profile_completed? Users::ApplyAuthenticationForm.new(params).validate! - raise Error, '您已经申请过实名认证了' if ApplyUserAuthentication.real_name_auth.processing.exists?(user_id: user.id) + # raise Error, '您已经申请过实名认证了' if ApplyUserAuthentication.real_name_auth.processing.exists?(user_id: user.id) user.lastname = params[:name].to_s.strip user.firstname = '' @@ -18,6 +18,8 @@ class Users::ApplyAuthenticationService < ApplicationService user.show_realname = params[:show_realname].to_s == 'true' if params[:show_realname].to_s.present? ActiveRecord::Base.transaction do + ApplyUserAuthentication.real_name_auth.processing.where(user_id: user.id).destroy_all + user.authentication = true user.save! diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index 074f1cee7..c64c07cdd 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -12,7 +12,7 @@ class Users::ApplyProfessionalAuthService < ApplicationService raise Error, '请先完善基本信息' unless user.profile_completed? Users::ApplyProfessionalAuthForm.new(params).validate! - raise Error, '您已经申请过职业认证了' if ApplyUserAuthentication.professional_auth.processing.exists?(user_id: user.id) + # raise Error, '您已经申请过职业认证了' if ApplyUserAuthentication.professional_auth.processing.exists?(user_id: user.id) extension = user.user_extension extension.school_id = params[:school_id] @@ -31,6 +31,7 @@ class Users::ApplyProfessionalAuthService < ApplicationService end ActiveRecord::Base.transaction do + ApplyUserAuthentication.professional_auth.processing.where(user_id: user.id).destroy_all user.save! extension.save! From 15f695d26b5329765aabe2d6632136a7c65d7b5f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 17:10:12 +0800 Subject: [PATCH 16/19] =?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/services/users/apply_professional_auth_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index c64c07cdd..c94481890 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -19,7 +19,7 @@ class Users::ApplyProfessionalAuthService < ApplicationService extension.department_id = params[:department_id] extension.identity = params[:identity] - user.professional_certification = extension.identity != 0 + user.professional_certification = params[:identity] != "teacher" extra = params[:extra].to_s.strip.presence if extension.identity.to_s == 'student' From 3dbca5555790c4b338a9659f8dbe4c9032d8abfd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 21 Nov 2019 17:13:42 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/shixun_settings_controller.rb | 2 +- app/models/shixun.rb | 5 +++-- app/views/admins/shixun_settings/shared/_td.html.erb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 822bc2bdf..216c9d909 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -65,7 +65,7 @@ class Admins::ShixunSettingsController < Admins::BaseController sheet1.row(0).default_format = blue sheet1.row(0).concat(["实训ID","实训名称","技术平台", "Fork源", "实践任务","选择题任务","挑战人数", "通关人数", "状态","创建者", "单位", "职业", "关卡序号","关卡名称","技能标签"]) count_row = 1 - shixuns.includes(:challenges, :user, :myshixuns, :mirror_repositories).find_each do |shixun| + shixuns.includes(:fork_shixuns, :myshixuns, :mirror_repositories, challenges: [:challenge_tags], user: [user_extension: :school]).find_each do |shixun| sheet1[count_row, 0] = shixun.identifier sheet1[count_row, 1] = shixun.name sheet1[count_row, 2] = shixun.mirror_repositories.select{|mr| mr.main_type == "1"}.first&.type_name diff --git a/app/models/shixun.rb b/app/models/shixun.rb index a0f88260b..e8aa1b186 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -28,6 +28,7 @@ class Shixun < ApplicationRecord has_one :first_tag_repertoire, through: :first_shixun_tag_repertoire, source: :tag_repertoire has_many :homework_commons_shixuns, class_name: 'HomeworkCommonsShixun' + has_many :fork_shixuns, foreign_key: "fork_from", class_name: 'Shixun' #实训的关卡 has_many :exercise_shixun_challenges, :dependent => :destroy @@ -97,7 +98,7 @@ class Shixun < ApplicationRecord end def fork_identifier - self.fork_from.nil? ? "--" : Shixun.where(id: self.fork_from).first.try(:identifier) + self.fork_from.nil? ? "--" : fork_shixuns.first&.identifier end def shixun_status @@ -171,7 +172,7 @@ class Shixun < ApplicationRecord end def owner - User.find(self.user_id) + User.find_by_id(self.user_id) end def shixun_main_name diff --git a/app/views/admins/shixun_settings/shared/_td.html.erb b/app/views/admins/shixun_settings/shared/_td.html.erb index ddbbdff02..f4a05f178 100644 --- a/app/views/admins/shixun_settings/shared/_td.html.erb +++ b/app/views/admins/shixun_settings/shared/_td.html.erb @@ -27,7 +27,7 @@ <%= raw '
' if weappImageExists %> <%= javascript_void_link weappImageExists ? '重新上传' : '上传图片', class: 'action upload-shixun-weapp-image-action', data: { source_id: shixun.id, source_type: 'Shixun', suffix: '_weapp', toggle: 'modal', target: '.admin-upload-file-modal' } %> -<%= link_to shixun.owner.try(:real_name),"/users/#{shixun.owner.login}",target:'_blank' %> +<%= link_to shixun.owner.try(:real_name),"/users/#{shixun.owner&.login}",target:'_blank' %> <% if shixun.status.to_i < 3 %> <%= link_to "关闭", admins_shixun_setting_path(shixun,status:3,page_no:page_no),method: :put, :class => "", :remote => true %> From 55ab938e5497dd0fcd8a8339e128f17224712e9f 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, 21 Nov 2019 17:14:25 +0800 Subject: [PATCH 18/19] =?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 | 1 - .../modules/courses/statistics/Statistics.js | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index bf1ac2bc0..e880fbea9 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -130,7 +130,6 @@ class CoursesBanner extends Component { axios.get(url,{params: dataqueryss }).then((result) => { - debugger if(result.data.status===-2){ this.setState({ AccountProfiletype:true, diff --git a/public/react/src/modules/courses/statistics/Statistics.js b/public/react/src/modules/courses/statistics/Statistics.js index 412c7acbe..00a47a81d 100644 --- a/public/react/src/modules/courses/statistics/Statistics.js +++ b/public/react/src/modules/courses/statistics/Statistics.js @@ -72,9 +72,8 @@ class Statistics extends Component{ }) } - getDynamiclistdatas=(group_ids)=>{ - let {activeKey}=this.state; - if(activeKey==='2') { + getDynamiclistdatas=(group_ids,key)=>{ + if(key==='2') { let courseId = this.props.match.params.coursesId; let url = `/courses/${courseId}/act_score.json`; let data = { @@ -99,8 +98,8 @@ class Statistics extends Component{ } } - getwork_scoredata=(page,group_ids,sort)=>{ - let {activeKey}=this.state; + getwork_scoredata=(page,group_ids,sort,key)=>{ + this.setState({ page:page, sort:sort, @@ -108,7 +107,7 @@ class Statistics extends Component{ bomisSpin:true, }) - if(activeKey==='1'){ + if(key==='1'||key===undefined){ let courseId=this.props.match.params.coursesId; let url=`/courses/${courseId}/work_score.json`; let data={ @@ -144,10 +143,10 @@ class Statistics extends Component{ if(key==="1"){ let {page,group_ids,sort}=this.state; // this.getdatas() - this.getwork_scoredata(page,group_ids,sort) - }else{ + this.getwork_scoredata(page,group_ids,sort,key) + }else if(key==="2"){ let{group_ids}=this.state; - this.getDynamiclistdatas(group_ids) + this.getDynamiclistdatas(group_ids,key) } this.setState({ activeKey:key From 049bd864ad4ae7ae05e52d5ddd23f8431dbcf906 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, 21 Nov 2019 18:13:31 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 2 + .../courses/coursesDetail/CoursesBanner.js | 16 ++--- .../src/modules/user/Accountnewprofile.js | 69 +++++++++++++++++++ 3 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 public/react/src/modules/user/Accountnewprofile.js diff --git a/public/react/src/App.js b/public/react/src/App.js index 6b4ba7399..fedd0a3cd 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -20,6 +20,7 @@ import Trialapplicationysl from './modules/login/Trialapplicationysl'; import Trialapplicationreview from './modules/user/Trialapplicationreview'; import Addcourses from "./modules/courses/coursesPublic/Addcourses"; import AccountProfile from "./modules/user/AccountProfile"; +import Accountnewprofile from './modules/user/Accountnewprofile'; import Trialapplication from './modules/login/Trialapplication'; import Certifiedprofessional from './modules/modals/Certifiedprofessional'; import NotFoundPage from './NotFoundPage' @@ -466,6 +467,7 @@ class App extends Component { + this.Modifyloginvalue()}> diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index e880fbea9..5f3704a33 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -131,14 +131,14 @@ class CoursesBanner extends Component { dataqueryss }).then((result) => { if(result.data.status===-2){ - this.setState({ - AccountProfiletype:true, - content:result.data.message, - okText:"立即认证", - cannelText:"稍后认证", - okHref:`/account/certification`, - Accounturltype:true - }) + // this.setState({ + // AccountProfiletype:true, + // content:result.data.message, + // okText:"立即认证", + // cannelText:"稍后认证", + // okHref:`/account/certification`, + // Accounturltype:true + // }) }else{ if( result!=undefined){ let data = result.data; diff --git a/public/react/src/modules/user/Accountnewprofile.js b/public/react/src/modules/user/Accountnewprofile.js new file mode 100644 index 000000000..c8f81d340 --- /dev/null +++ b/public/react/src/modules/user/Accountnewprofile.js @@ -0,0 +1,69 @@ +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import {Modal} from 'antd'; +import axios from 'axios'; +class Accountnewprofile extends Component { + constructor(props) { + super(props); + this.state = { + newAccountProfiletype:false + } + } + componentDidMount() { + axios.interceptors.response.use((response) => { + if(response!=undefined) + if (response&&response.data.status === 411) { + this.setState({ + newAccountProfiletype:true, + content:response.data.message, + okText:"立即认证", + cannelText:"稍后认证", + okHref:`/account/certification`, + }) + } + return response; + }, (error) => { + + }); + } + + gotoback=()=>{ + window.location.href="/"; + this.setState({ + newAccountProfiletype:false + }) + } + + + + /** + content: '您需要去完成您的职业认证,才能使用此功能', + okText: '立即完成', + okHref: '/account/certification' + */ + render() { + const { content, okText, okHref,cannelText} = this.state; + return( + +
+

{content}

+ +
+
+ ) + } +} + +export default Accountnewprofile; \ No newline at end of file