From 3c91b68f03289135928ed9ad8ddbe858ef1db987 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 4 Jul 2019 18:06:21 +0800 Subject: [PATCH 1/2] fix --- app/controllers/competition_teams_controller.rb | 10 +++++++--- .../competition_teams/_competition_team_form.html.erb | 4 ++-- .../competition_teams/_search_teacher_list.html.erb | 9 +++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index fb41d3f8..f39c7708 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -1,7 +1,7 @@ class CompetitionTeamsController < ApplicationController include ApplicationHelper before_filter :find_team, :except => [:new, :create, :join_team, :search_non_user, :personal_enroll, :check_team_identity, :search_teacher] - before_filter :find_competition, :only => [:new, :create, :join_team, :search_non_user, :personal_enroll] + before_filter :find_competition, :only => [:new, :create, :join_team, :search_teacher, :search_non_user, :personal_enroll] before_filter :require_login skip_before_filter :verify_authenticity_token, :only => [:edit_rule] layout 'base_competition' @@ -13,6 +13,10 @@ class CompetitionTeamsController < ApplicationController end def search_teacher + if params[:team] && params[:team] != "" + @team = @competition.competition_teams.where(:id => params[:team]).first + end + condition = "%#{params[:search].strip}%".gsub(" ","") @teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0") end @@ -271,7 +275,7 @@ class CompetitionTeamsController < ApplicationController repeat_teachers = competition.team_members.where(user_id: user_ids).includes(:user).to_a if repeat_teachers.size > 0 - @status, @message = -1, "导师#{repeat_teachers.map{|t| t.user.show_real_name}}已经加入其它战队了" + @status, @message = -1, "导师#{repeat_teachers.map{|t| t.user.show_real_name}.join(',')}已经加入其它战队了" return false end @@ -284,7 +288,7 @@ class CompetitionTeamsController < ApplicationController repeat_members = competition.team_members.where(user_id: user_ids).includes(:user).to_a if repeat_members.size > 0 - @status, @message = -1, "成员#{repeat_members.map{|t| t.user.show_real_name}}已经加入其它战队了" + @status, @message = -1, "成员#{repeat_members.map{|t| t.user.show_real_name}.join(',')}已经加入其它战队了" return false end diff --git a/app/views/competition_teams/_competition_team_form.html.erb b/app/views/competition_teams/_competition_team_form.html.erb index 359a1d11..fbba4618 100644 --- a/app/views/competition_teams/_competition_team_form.html.erb +++ b/app/views/competition_teams/_competition_team_form.html.erb @@ -247,8 +247,8 @@ function search_teacher_user(){ if($("#teacher_search_input").val().trim() != ""){ - $.post("<%= search_teacher_competition_teams_path() %>", - {"search": $("#teacher_search_input").val().trim()}); + $.post("<%= search_teacher_competition_teams_path(:com_id => @competition.id) %>", + {"search": $("#teacher_search_input").val().trim(), "team": $("#team_id").val()}); } } diff --git a/app/views/competition_teams/_search_teacher_list.html.erb b/app/views/competition_teams/_search_teacher_list.html.erb index 54538382..9847daec 100644 --- a/app/views/competition_teams/_search_teacher_list.html.erb +++ b/app/views/competition_teams/_search_teacher_list.html.erb @@ -1,10 +1,15 @@

请选择指导老师,允许修改

<% @teachers.each do |teacher| %> -
  • + <% has_enroll = @competition.teacher_enroll_mutiple_limited && (@team.present? ? @competition.team_members.where("user_id = '#{teacher.id}' and id != #{@team.id}").count > 0 : @competition.team_members.where("user_id = '#{teacher.id}'").count > 0) %> + +
  • <%= teacher.show_name %> <%= teacher.identity %> <%= teacher.school_name %> + <% if has_enroll %> + 已加入其他战队 + <% end %>
  • <% end %> @@ -14,7 +19,7 @@ e.stopPropagation(); }); /*从下拉列表中选择指导老师*/ - $("#pointerTeacher li").click(function(e){ + $("#pointerTeacher li.unadded").click(function(e){ var name=$(this).find(".pt-s").html().trim(); $("#pointerTeacher").siblings("#teacher_search_input").val(name); $("#pointerTeacher").siblings("#teacher_id").val($(this).find("input").val().trim()); From a0f3a7bd1c75ba0f429bac870f470d9f1a9e3c04 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 4 Jul 2019 18:09:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_competition_team_detail.html.erb | 37 +++++++++++++++++-- .../_qg_second_course_competition.html.erb | 2 +- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/app/views/competitions/_competition_team_detail.html.erb b/app/views/competitions/_competition_team_detail.html.erb index 88dd992d..9574db58 100644 --- a/app/views/competitions/_competition_team_detail.html.erb +++ b/app/views/competitions/_competition_team_detail.html.erb @@ -1,10 +1,39 @@ -
    -

    +

    +

    战队详情 返回

    -
    +

    实训项目

    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    创建者名称学习人数fork版的学习人数有效作品数制作应用经验值
    胡莎莎 + 单链表的学习与应用(I) + 2.5万14562.5万4545667
    合计:65.5万78782.5万245364
    \ No newline at end of file diff --git a/app/views/competitions/_qg_second_course_competition.html.erb b/app/views/competitions/_qg_second_course_competition.html.erb index 50697e7b..55862a23 100644 --- a/app/views/competitions/_qg_second_course_competition.html.erb +++ b/app/views/competitions/_qg_second_course_competition.html.erb @@ -14,7 +14,7 @@ is_start = Time.now > first_section.start_time %>