diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index aa9ddebf0..2524c53d8 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -33,7 +33,7 @@ class AccountsController < ApplicationController uid_logger("start register: verifi_code is #{verifi_code}, code is #{code}, time is #{Time.now.to_i - verifi_code.try(:created_at).to_i}") # check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60) # todo 上线前请删除万能验证码"513231" - if code != "513231" + unless code == "513231" && request.host == "47.96.87.25" return normal_status(-2, "验证码不正确") if verifi_code.try(:code) != code.strip return normal_status(-2, "验证码已失效") if !verifi_code&.effective? end diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 781ede214..c9162448b 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1566,15 +1566,22 @@ class ExercisesController < ApplicationController def check_user_id_start_answer #判断用户在开始答题时,是否有用户id传入,如果为老师,则id必需,否则为当前用户的id user_login = params[:login] - # exercise_current_user_id = params[:user_id] if user_login.blank? && @user_course_identity < Course::STUDENT #id不存在,且当前为老师/管理员等 normal_status(-1,"请输入学生登陆名!") else - @ex_answerer = User.find_by(login: user_login) #回答者 + if @user_course_identity < Course::STUDENT || @exercise.score_open + @ex_answerer = user_login.blank? ? current_user : User.find_by(login: user_login) + else + @ex_answerer = current_user + end + if @ex_answerer.blank? normal_status(404,"答题用户不存在") + elsif @user_course_identity > Course::STUDENT && !@exercise.is_public + normal_status(403,"非公开试卷") else - @exercise_current_user_id = @ex_answerer.id || current_user.id + # @exercise_current_user_id = @ex_answerer.id || current_user.id + @exercise_current_user_id = @ex_answerer.id end end end diff --git a/app/views/courses/settings.json.jbuilder b/app/views/courses/settings.json.jbuilder index be4470a66..97083d5f9 100644 --- a/app/views/courses/settings.json.jbuilder +++ b/app/views/courses/settings.json.jbuilder @@ -5,6 +5,7 @@ json.course_id @course.id json.school @course.school&.name json.class_period @course.class_period json.credit @course.credit +json.start_date @course.start_date json.end_date @course.end_date json.is_public @course.is_public json.course_module_types @course.course_modules.where(hidden: 0).pluck(:module_type) diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index a607c24a0..07c33d9e9 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -38,6 +38,8 @@ namespace :excellent_course_exercise do rand_num = index < pass_count - 1 ? 20 : rand(1..16) elsif exercise_question_ids.length == 17 rand_num = index < pass_count - 1 ? rand(13..17) : rand(1..11) + elsif exercise_question_ids.length == 39 + rand_num = index < pass_count - 1 ? rand(30..39) : rand(1..18) else rand_num = exercise_question_ids.length end diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index b28472f66..20f46f079 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -722,15 +722,19 @@ class Coursesleftnav extends Component{ let {url}=this.state; if (key === this.props.indexs) { this.props.unlocationNavfun(undefined) + this.props.history.replace(urls); } else { this.props.unlocationNavfun(key) + this.props.history.replace(urls); } if(urls!=url){ this.props.history.replace(urls); } - if(this.props.indexs===undefined){ - this.props.history.replace(urls); - } + // if(this.props.indexs===undefined){ + // + // }else{ + // + // } } maincontent=(item,key)=>{ diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index e34666294..780ed4071 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -226,10 +226,11 @@ class DetailCards extends Component{ startshixunCombattype:true, }) } else { - window.location.href = "/tasks/" + response.data.game_identifier; + // window.location.href = "/tasks/" + response.data.game_identifier; // window.location.href = path // let path="/tasks/"+response.data.game_identifier; // this.props.history.push(path); + window.open("/tasks/" + response.data.game_identifier); } }).catch((error) => { diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index 7f6cb9659..fe86db2de 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -29,7 +29,7 @@ class InfosBanner extends Component{
{data && data.name} @@ -38,9 +38,9 @@ class InfosBanner extends Component{ }
-+