diff --git a/app/controllers/admins/users_controller.rb b/app/controllers/admins/users_controller.rb index 9630394b4..b9a07ba1e 100644 --- a/app/controllers/admins/users_controller.rb +++ b/app/controllers/admins/users_controller.rb @@ -61,7 +61,7 @@ class Admins::UsersController < Admins::BaseController private def update_params - params.require(:user).permit(%i[lastname nickname gender identity technical_title student_id + params.require(:user).permit(%i[lastname nickname gender identity technical_title student_id is_shixun_marker mail phone location location_city school_id department_id admin business is_test password professional_certification authentication]) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 65c05ef2a..ac53343b5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,17 +24,19 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign Rails.logger.info("66666 #{params}") - if params[:client_key].present? - Rails.logger.info("111111 #{params[:client_key]}") - Rails.logger.info("00000 #{params[:timestamp]}") - Rails.logger.info("Time.now - params[:timestamp].to_i: #{Time.now.to_i - params[:timestamp].to_i}") - tip_exception(501, "请求超时") unless (Time.now.to_i - params[:timestamp].to_i).between?(0,5) - timestamp = params[:timestamp] - sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") - Rails.logger.info("2222 #{sign}") - tip_exception(501, "请求不合理") if sign != params[:client_key] - else - tip_exception(501, "请求不合理") + suffix = request.url.split(".").last + suffix_arr = ["xls", "xlsx"] # excel文件先注释 + unless suffix_arr.include?(suffix) + if params[:client_key].present? + randomcode = params[:randomcode] + tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) + + sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") + Rails.logger.info("2222 #{sign}") + tip_exception(501, "请求不合理") if sign != params[:client_key] + else + tip_exception(501, "请求不合理") + end end end @@ -44,6 +46,12 @@ class ApplicationController < ActionController::Base EduSetting.get(name) end + def shixun_marker + unless current_user.is_shixun_marker? || current_user.admin_or_business? + tip_exception(403, "..") + end + end + # 实训的访问权限 def shixun_access_allowed if !current_user.shixun_permission(@shixun) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 5fc81c5d5..e0dd71467 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -5,6 +5,7 @@ class AttachmentsController < ApplicationController before_action :require_login, :check_auth, except: [:show] before_action :find_file, only: %i[show destroy] before_action :attachment_candown, only: [:show] + skip_before_action :check_sign, only: [:show, :create] include ApplicationHelper diff --git a/app/controllers/departments_controller.rb b/app/controllers/departments_controller.rb index 5e82b2c51..73cb19156 100644 --- a/app/controllers/departments_controller.rb +++ b/app/controllers/departments_controller.rb @@ -1,4 +1,6 @@ class DepartmentsController < ApplicationController + skip_before_action :check_sign + def for_option render_ok(departments: current_school.departments.without_deleted.select(:id, :name).as_json) end diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index e5ca0dc1d..3eaac0648 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -44,12 +44,13 @@ class HacksController < ApplicationController begin logger.info("##########{hack_params}") hack = Hack.new(hack_params) + hack.user_id = current_user.id + hack.identifier = generate_identifier Hack, 8 ActiveRecord::Base.transaction do - hack.user_id = current_user.id - hack.identifier = generate_identifier Hack, 8 hack.save! # 创建测试集与代码 hack.hack_sets.create!(hack_sets_params) + # 新建知识点 hack_codes = hack.hack_codes.new(hack_code_params) hack_codes.modify_time = Time.now hack_codes.save! diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 395e536f4..e8554300c 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -1,6 +1,10 @@ class MainController < ApplicationController skip_before_action :check_sign + def first_stamp + render :json => { status: 0, message: Time.now.to_i } + end + def index render file: 'public/react/build/index.html', :layout => false end diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index 99ca62b4c..dc9f6c091 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -1,4 +1,5 @@ class SchoolsController < ApplicationController + skip_before_action :check_sign def school_list schools = School.all diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 8a752106c..4f2a19536 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -24,6 +24,7 @@ class ShixunsController < ApplicationController before_action :portion_allowed, only: [:copy] before_action :special_allowed, only: [:send_to_course, :search_user_courses] + before_action :shixun_marker, only: [:new, :create] ## 获取课程列表 def index @@ -1151,4 +1152,5 @@ private end md5.hexdigest end + end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 2c1b5a810..7df9aae89 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -7,6 +7,8 @@ class SubjectsController < ApplicationController :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :up_member_position, :down_member_position, :update_team_title] before_action :require_admin, only: [:copy_subject] + before_action :shixun_marker, only: [:new, :create, :add_shixun_to_stage] + include ApplicationHelper include SubjectsHelper diff --git a/app/services/admins/identity_auths/agree_apply_service.rb b/app/services/admins/identity_auths/agree_apply_service.rb index d75a6d7db..4528debb4 100644 --- a/app/services/admins/identity_auths/agree_apply_service.rb +++ b/app/services/admins/identity_auths/agree_apply_service.rb @@ -10,7 +10,6 @@ class Admins::IdentityAuths::AgreeApplyService < ApplicationService ActiveRecord::Base.transaction do apply.update!(status: 1) user.update!(authentication: true) - RewardGradeService.call(user, container_id: user.id, container_type: 'Authentication', score: 500) deal_tiding! diff --git a/app/services/admins/professional_auths/agree_apply_service.rb b/app/services/admins/professional_auths/agree_apply_service.rb index 1ca2da2fc..3d723412b 100644 --- a/app/services/admins/professional_auths/agree_apply_service.rb +++ b/app/services/admins/professional_auths/agree_apply_service.rb @@ -10,7 +10,7 @@ class Admins::ProfessionalAuths::AgreeApplyService < ApplicationService ActiveRecord::Base.transaction do apply.update!(status: 1) user.update!(professional_certification: true) - + user.update!(is_shixun_marker: true) if user.is_teacher? RewardGradeService.call(user, container_id: user.id, container_type: 'Professional', score: 500) deal_tiding! diff --git a/app/services/admins/update_user_service.rb b/app/services/admins/update_user_service.rb index 41b5065d0..6b1c0c857 100644 --- a/app/services/admins/update_user_service.rb +++ b/app/services/admins/update_user_service.rb @@ -25,6 +25,7 @@ class Admins::UpdateUserService < ApplicationService ActiveRecord::Base.transaction do user.save! user.user_extension.save! + user.update!(is_shixun_marker: true) if user.is_certification_teacher update_gitlab_password if params[:password].present? end @@ -36,7 +37,7 @@ class Admins::UpdateUserService < ApplicationService def user_attributes params.slice(*%i[lastname nickname mail phone admin business is_test - professional_certification authentication]) + professional_certification authentication is_shixun_marker]) end def user_extension_attributes diff --git a/app/views/admins/users/edit.html.erb b/app/views/admins/users/edit.html.erb index abb003cbc..b1a8cbba1 100644 --- a/app/views/admins/users/edit.html.erb +++ b/app/views/admins/users/edit.html.erb @@ -120,6 +120,7 @@
题数:{this.props.all_score}
总分:{this.props.all_questions_count}
@@ -85,7 +101,9 @@ class Paperreview_item extends Component { {/*单选题*/} { single_questions&&single_questions? -{single_questions===null?"一":"二"}、多选题
(共{multiple_questions&&multiple_questions.questions_count}题;共{multiple_questions&&multiple_questions.questions_score}分)
*/} + {/*
*/} {/* {tagArray[index]}*/} {/*
*/} {/* */} diff --git a/public/react/src/modules/question/Paperreview_multlple.js b/public/react/src/modules/question/Paperreview_multlple.js index 74f100f71..9535e35c6 100644 --- a/public/react/src/modules/question/Paperreview_multlple.js +++ b/public/react/src/modules/question/Paperreview_multlple.js @@ -61,7 +61,9 @@ class Paperreview_multlple extends Component { let {questions,totalscore,total,items} = this.state; // //console.log(params); return ( -*/} + {/*
*/} {/* {tagArray[index]}*/} {/*
*/} {/* */} diff --git a/public/react/src/modules/question/Paperreview_program.js b/public/react/src/modules/question/Paperreview_program.js index c8f847dbe..f897915d8 100644 --- a/public/react/src/modules/question/Paperreview_program.js +++ b/public/react/src/modules/question/Paperreview_program.js @@ -61,7 +61,9 @@ class Paperreview_program extends Component { let {questions,totalscore,total,items} = this.state; // //console.log(params); return ( -*/} + {/*
*/} {/* {tagArray[index]}*/} {/*
*/} {/* */} diff --git a/public/react/src/modules/question/Paperreview_single.js b/public/react/src/modules/question/Paperreview_single.js index 7730f17d7..d7c0304de 100644 --- a/public/react/src/modules/question/Paperreview_single.js +++ b/public/react/src/modules/question/Paperreview_single.js @@ -67,15 +67,35 @@ class Paperreview_single extends Component { let {objectsingle} =this.props; // //console.log(params); return ( -{objectsingle.id}
、({objectsingle.score}分)
+
{tagArray[index]}
diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index c8c518f8c..17a32fd41 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -95,7 +95,7 @@ class Listjihe extends Component { : items === undefined ||items === null? "" : items.choices.map((object, index) => { return ( -+
{tagArray[index]}
diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 54c7fbf4a..f0964780a 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -695,3 +695,39 @@ } + +.pd20{ + padding: 20px; +} + +.cretitlecolrlis{ + color: #333333; + font-size: 14px !important; +} + +.cretitlecolrlisobj{ + color: #888888; + font-size: 14px !important; + +} + +.cretitlecolrlist{ + color: #333333; + font-size: 14px !important; + +} +.lh28{ + line-height: 28px; +} +.h20{ + height: 20px; + background-color: #fff; +} +.lh20{ + line-height: 20px; + background-color: #fff; +} + +.backgroudwhites{ + background-color: #fff; +} diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 01cf7334d..fabe180bf 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -19,7 +19,9 @@ import Addcourses from '../courses/coursesPublic/Addcourses'; import LoginDialog from '../login/LoginDialog'; -import Trialapplication from '../login/Trialapplication' +import Trialapplication from '../login/Trialapplication'; + +import GotoQQgroup from '../../modal/GotoQQgroup' import 'antd/lib/modal/style/index.css'; @@ -31,6 +33,8 @@ import 'antd/lib/input/style/index.css'; import './TPMIndex.css'; + + const $ = window.$ // TODO 这部分脚本从公共脚本中直接调用 @@ -69,6 +73,7 @@ class NewHeader extends Component { headtypesonClickbool:false, headtypess:"/", mygetHelmetapi2: null, + goshowqqgtounp:false, visiblemyss:false, } console.log("176") @@ -650,6 +655,18 @@ submittojoinclass=(value)=>{ return; } + + + if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ + this.setgoshowqqgtounp(true); + return; + } + + + + + + if(url !== undefined || url!==""){ window.location.href = url; } @@ -800,6 +817,14 @@ submittojoinclass=(value)=>{ return false } } + + + // 处理弹框 + setgoshowqqgtounp=(bool)=>{ + this.setState({ + goshowqqgtounp:bool + }) + } render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 const {match} = this.props; @@ -818,6 +843,7 @@ submittojoinclass=(value)=>{ headtypesonClickbool, headtypess, mygetHelmetapi2, + goshowqqgtounp, }=this.state; /* 用户名称 用户头像url @@ -934,6 +960,14 @@ submittojoinclass=(value)=>{ {...this.props} {...this.state} />:""} + + { + goshowqqgtounp===true? +