From 16451c3dfe545a3454e76cb070d71fc031df0bb4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 5 Nov 2019 17:25:51 +0800 Subject: [PATCH 1/8] tiaozheng --- app/helpers/exercises_helper.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 44c341d6e..2c1a6f85d 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -905,16 +905,16 @@ module ExercisesHelper exercise_user_start = exercise_user&.start_at.present? ? exercise_user.start_at.to_i : 0 #用户未开始答题时,即exercise_user_start为0 if exercise_user_start == 0 - if (exercise_end_time - time_now_i) > time_mill + if (exercise_end_time.to_i - time_now_i) > time_mill user_left_time = time_mill else - user_left_time = (exercise_end_time < time_now_i) ? nil : (exercise_end_time - time_now_i) + user_left_time = (exercise_end_time.to_i < time_now_i) ? nil : (exercise_end_time.to_i - time_now_i) end else - if (exercise_user_start + time_mill) > exercise_end_time - time_mill = exercise_end_time - exercise_user_start #如果开始答题时间加试卷的限时长大于试卷的截止时间,则以试卷的截止时间到开始答题时间为试卷的限时 + if (exercise_user_start + time_mill) > exercise_end_time.to_i + time_mill = exercise_end_time.to_i - exercise_user_start.to_i #如果开始答题时间加试卷的限时长大于试卷的截止时间,则以试卷的截止时间到开始答题时间为试卷的限时 end - exercise_user_left_time = time_now_i - exercise_user_start #用户已回答的时间 + exercise_user_left_time = time_now_i - exercise_user_start.to_i #用户已回答的时间 user_left_time = (time_mill < exercise_user_left_time) ? nil : (time_mill - exercise_user_left_time) #当前用户对试卷的回答剩余时间 end end From 7176fec256b16e3c17250a8369edab760f6b39ec Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 5 Nov 2019 17:35:46 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index c2f3fb99a..dedbab55c 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1123,7 +1123,7 @@ class ExercisesController < ApplicationController # 学生提交试卷 def commit_exercise - tip_exception(-1, "试卷已提交") if @answer_committed_user.commit_status == 1 + tip_exception(0, "试卷截止时间已到,系统已自动提交") if @answer_committed_user.commit_status == 1 ActiveRecord::Base.transaction do begin can_commit_exercise = false From 088da53e16edf2a5d6e9957e917b6eaa252861dc Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 5 Nov 2019 17:45:47 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 2 +- app/jobs/end_exercise_calculate_job.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index dedbab55c..cb32f7bb3 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -886,7 +886,7 @@ class ExercisesController < ApplicationController ex_user_ids = exercise_users.pluck(:id) - EndExerciseCalculateJob.perform_later(ex_user_ids,exercise,Time.now) + EndExerciseCalculateJob.perform_later(ex_user_ids,exercise,Time.now.to_s) # exercise_users.each do |user| # if user.commit_status == 0 && user.start_at.present? # objective_score = calculate_student_score(exercise,user.user)[:total_score] diff --git a/app/jobs/end_exercise_calculate_job.rb b/app/jobs/end_exercise_calculate_job.rb index 35c6ded57..251496cb5 100644 --- a/app/jobs/end_exercise_calculate_job.rb +++ b/app/jobs/end_exercise_calculate_job.rb @@ -9,7 +9,7 @@ class EndExerciseCalculateJob < ApplicationJob exercise_users = ExerciseUser.where(id: ex_user_ids) exercise_users.each do |user| if user.commit_status == 0 && user.start_at.present? - objective_score = calculate_student_score(exercise,user.user,end_time)[:total_score] + objective_score = calculate_student_score(exercise,user.user,end_time.to_time)[:total_score] user_sub_score = user.subjective_score subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score total_score = objective_score + subjective_score From 99157669c05c1cd399a99bbe7075a2b8d65ba046 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 5 Nov 2019 17:57:49 +0800 Subject: [PATCH 4/8] modify bind open user api message --- app/services/create_bind_user_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/create_bind_user_service.rb b/app/services/create_bind_user_service.rb index f7fc5b6f6..86ac6c93b 100644 --- a/app/services/create_bind_user_service.rb +++ b/app/services/create_bind_user_service.rb @@ -17,7 +17,7 @@ class CreateBindUserService < ApplicationService bind_user = User.try_to_login(params[:username], params[:password]) raise Error, '用户名或者密码错误' if bind_user.blank? - raise Error, '该账号已被其他微信号绑定,请更换其他账号进行绑定' if bind_user.bind_open_user?(params[:type].to_s) + raise Error, '该账号已被绑定,请更换其他账号进行绑定' if bind_user.bind_open_user?(params[:type].to_s) ActiveRecord::Base.transaction do open_user.user_id = bind_user.id From eb277c4cccd5a3458c6876a2c0b6cb7be81f0090 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, 5 Nov 2019 17:59:11 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E6=96=87=E6=A1=88=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/exercise/new/SingleEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/new/SingleEditor.js b/public/react/src/modules/courses/exercise/new/SingleEditor.js index 69f63821e..08ab4fd90 100644 --- a/public/react/src/modules/courses/exercise/new/SingleEditor.js +++ b/public/react/src/modules/courses/exercise/new/SingleEditor.js @@ -297,7 +297,7 @@ class SingleEditor extends Component{
{!exerciseIsPublish ? '温馨提示:点击选项输入框可设置答案;选中的选项即为正确答案,选择多个答案即为多选题' : ' '} + style={{color: '#FF6800'}}>{'温馨提示:点击选项输入框可设置答案;选中的选项即为正确答案,选择多个答案即为多选题'} { answerTagArray && !!answerTagArray.length ? {answerTagArray.join(' ')} From 2ebfc9ea5b9b8d6390aa1870200dec3e5902f5df Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 6 Nov 2019 09:36:23 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=92=A4=E9=94=80=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=92=8C=E9=87=8D=E6=96=B0=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/account/AccountCertification.js | 65 +++++++++++++++++-- .../user/modal/RealNameCertificationModal.js | 44 +++++-------- 2 files changed, 76 insertions(+), 33 deletions(-) diff --git a/public/react/src/modules/user/account/AccountCertification.js b/public/react/src/modules/user/account/AccountCertification.js index e1bdc1372..00f8f3230 100644 --- a/public/react/src/modules/user/account/AccountCertification.js +++ b/public/react/src/modules/user/account/AccountCertification.js @@ -4,6 +4,7 @@ import { WordsBtn, getImageUrl } from 'educoder'; import RealNameCertificationModal from '../modal/RealNameCertificationModal' import '../../courses/css/Courses.css' import {CNotificationHOC} from '../../courses/common/CNotificationHOC' +import axios from 'axios'; class AccountCertification extends Component { @@ -29,6 +30,40 @@ class AccountCertification extends Component { } + + + // 撤销认证 + cancelCertification=(type)=>{ + this.props.confirm({ + okText: '确认', + content: '是否确认撤销认证?', + onOk: () => { + this.cancelCertificationAction(type); + } + }) + } + + cancelCertificationAction=(type)=>{ + let login =this.props.current_user.login; + var url = `/users/accounts/${login}/${ type == 1 ? 'authentication_apply.json':'professional_auth_apply.json'}`; + axios.delete(url).then((result)=>{ + if(result){ + this.props.showNotification("撤销成功!"); + try { + this.props.getBasicInfo(); + } catch (e) { + } + try { + this.props.Getdata(); + } catch (e) { + + } + } + }).catch((error)=>{ + console.log(error); + }) + } + showRealNameCertificationModal = (index) => { this.setState({ certification:index, @@ -75,7 +110,6 @@ class AccountCertification extends Component { color: #CDCDCD; } .flexRow .status { - width: 100px; color: #28AC7F; } `} @@ -87,9 +121,17 @@ class AccountCertification extends Component {
{ basicInfo && basicInfo.authentication =="uncertified" ? - this.checkBasicInfo(1)} >立即认证: - basicInfo && basicInfo.authentication =="applying" ? 待审核: - 已认证 + this.checkBasicInfo(1)} >立即认证: + basicInfo && basicInfo.authentication =="applying" ? + + this.cancelCertification(1)}>撤销认证 + 待审核 + + : + + this.checkBasicInfo(1)}>重新认证 + 已认证 + }
@@ -103,9 +145,18 @@ class AccountCertification extends Component {
{ basicInfo && basicInfo.professional_certification =="uncertified" ? - this.checkBasicInfo(2)} >立即认证: - basicInfo && basicInfo.professional_certification =="applying" ? 待审核: - 已认证 + this.checkBasicInfo(2)} >立即认证 + : + basicInfo && basicInfo.professional_certification =="applying" ? + + this.cancelCertification(2)}>撤销认证 + 待审核 + + : + + this.checkBasicInfo(2)} >重新认证 + 已认证 + }
diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js index 53b32f679..4ac7f3c82 100644 --- a/public/react/src/modules/user/modal/RealNameCertificationModal.js +++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js @@ -55,47 +55,45 @@ class RealNameCertificationModal extends Component{ } } - componentDidMount() { - console.log("RealNameCertificationModal"); - console.log(this.props.basicInfo); - if(this.props.basicInfo){ +// 弹框出现(visible==true)时给formitem赋值 + setVisible = (visible) => { + this.refs.modalWrapper.setVisible(visible); + if(visible && this.props.basicInfo){ this.setValue(this.props.basicInfo); this.getSchoolList(this.props.basicInfo); } } + setValue=(basicInfo)=>{ + // debugger; if(basicInfo){ this.props.form.setFieldsValue({ nickname:basicInfo.nickname, name:!basicInfo.show_realname ? this.hideRealName(basicInfo.name) : basicInfo.name, - sex:String(basicInfo.gender), job:basicInfo.identity, - org:basicInfo.school_name, - - // city:[basicInfo.location,basicInfo.location_city] + org:basicInfo.school_name }) setTimeout(() => { // 等显示后再set this.props.form.setFieldsValue({ job:basicInfo.identity, + sex:String(basicInfo.gender), student_No:basicInfo.student_id, org2:basicInfo.department_name, job1:basicInfo && basicInfo.identity=="teacher" ? basicInfo.technical_title:"教授", job2:basicInfo && basicInfo.identity=="professional" ? basicInfo.technical_title:"企业管理者", }) }, 100) - //if(basicInfo.nickname){ - this.setState({ - forDisable: true, - nameLength:basicInfo.nickname?basicInfo.nickname.length:0, - showRealName:basicInfo.show_realname, - realName: basicInfo.name, - identity:basicInfo.identity, - school_id:basicInfo.school_id, - department_id:basicInfo.department_id - }) - //} + this.setState({ + forDisable: true, + nameLength:basicInfo.nickname?basicInfo.nickname.length:0, + showRealName:basicInfo.show_realname, + realName: basicInfo.name, + identity:basicInfo.identity, + school_id:basicInfo.school_id, + department_id:basicInfo.department_id + }) } } @@ -256,10 +254,6 @@ class RealNameCertificationModal extends Component{ // } } - setVisible = (visible) => { - this.refs.modalWrapper.setVisible(visible) - } - onSendOk = () => { this.props.form.validateFieldsAndScroll((err, values) => { console.log(values); @@ -273,7 +267,7 @@ class RealNameCertificationModal extends Component{ // 实名认证 let url = `/users/accounts/${current_user && current_user.login}/authentication_apply.json` axios.post((url),{ - name:values.name, + name:values.name || basicInfo.name, gender:parseInt(values.sex), id_number:values.credentials }).then((result)=>{ @@ -289,8 +283,6 @@ class RealNameCertificationModal extends Component{ } this.setVisible(false); - - } }).catch((error)=>{ console.log(error); From f740626bee4461d6eafc89bd005bb2f780e21f08 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 6 Nov 2019 09:41:07 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/comment/Comments.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 9ef91ef46..5ff5fa8ab 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -51,6 +51,11 @@ const _origin = window.location.origin; /* + tpi讨论、交流问答帖子详情讨论、课堂讨论的公用模块: + https://www.educoder.net/tasks/n2ejvaowk6l9 + https://www.educoder.net/forums/2629 + 注意不同模块使用时的参数的不同 usingAntdModal onlySuperAdminCouldHide isChildCommentPagination等等 + 用到的props: user user_url image_url @@ -67,6 +72,8 @@ const _origin = window.location.origin; onlySuperAdminCouldHide 只有超级管理员才显示隐藏、取消隐藏 isChildCommentPagination 是否子回复分页 loadMoreChildComments function 加载所有子回复 + + usingAntdModal 是否使用antd的弹框 接口 deleteComment 删除 From 5ef251fe4ee60904eea7b856ff7ec2d09b648865 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 6 Nov 2019 10:01:15 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=B6=85=E7=AE=A1?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81=E5=92=8C=E8=81=8C?= =?UTF-8?q?=E4=B8=9A=E8=AE=A4=E8=AF=81=E3=80=81=E8=AF=95=E7=94=A8=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E7=9A=84=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users/apply_authentication_service.rb | 2 +- .../users/apply_professional_auth_service.rb | 2 +- app/services/users/apply_trail_service.rb | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index a9fa12638..c68260dcb 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -27,7 +27,7 @@ class Users::ApplyAuthenticationService < ApplicationService move_image_file! unless params[:upload_image].to_s == 'false' end - sms_notify_admin + # sms_notify_admin user end diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index ea9f3e0d1..46a4658aa 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -39,7 +39,7 @@ class Users::ApplyProfessionalAuthService < ApplicationService move_image_file! unless params[:upload_image].to_s == 'false' end - sms_notify_admin + # sms_notify_admin end private diff --git a/app/services/users/apply_trail_service.rb b/app/services/users/apply_trail_service.rb index 45abd8d1b..082a89c9a 100644 --- a/app/services/users/apply_trail_service.rb +++ b/app/services/users/apply_trail_service.rb @@ -23,12 +23,12 @@ class Users::ApplyTrailService < ApplicationService user.update!(certification: 1) apply.status = 1 - else - sms_cache = Rails.cache.read("apply_auth") - if sms_cache.nil? - send_trial_apply_notify! - Rails.cache.write("apply_auth", 1, expires_in: 5.minutes) - end + # else + # sms_cache = Rails.cache.read("apply_auth") + # if sms_cache.nil? + # send_trial_apply_notify! + # Rails.cache.write("apply_auth", 1, expires_in: 5.minutes) + # end end apply.save! end