From 63d57d11bb4f1526b10d3f68b2489c42a128914f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 15 Mar 2019 14:31:31 +0800 Subject: [PATCH 01/12] response.data.message || --- public/react/src/modules/page/component/UpdateDrawer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/component/UpdateDrawer.js b/public/react/src/modules/page/component/UpdateDrawer.js index 70cade00..1a4ab2ac 100644 --- a/public/react/src/modules/page/component/UpdateDrawer.js +++ b/public/react/src/modules/page/component/UpdateDrawer.js @@ -127,7 +127,7 @@ class UpdateDrawer extends Component { const { path, status } = response.data; if (status === -1) { - showSnackbar('更新失败,服务端错误') + showSnackbar(response.data.message || '更新失败,服务端错误') } else if (status === 1) { if (path) { updateChallengePath(path); From 35f4dea04a90eba216ef6ee3ecc9cbb35bfb679b Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 15 Mar 2019 16:32:00 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/MainContentContainer.js | 3 +++ public/react/src/modules/page/main/CodeEvaluateView.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 77625b73..b24a8255 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -648,6 +648,9 @@ class MainContentContainer extends Component { } return; } + if (gameStatusResponse.data.message) { + + } const { status } = gameStatusResponse.data; if (timeOutFlag === false && (status === 2 || status === 0)) { diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index 907741f1..30ab8630 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -307,6 +307,14 @@ class CodeEvaluateView extends Component { +
+ {/* 正在编译代码。。。 */}
From b6a764f0c6a537854d4c8201234e9c480dfccf10 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 15 Mar 2019 17:20:04 +0800 Subject: [PATCH 03/12] statusMessage --- .../src/modules/page/MainContentContainer.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index b24a8255..9e7954bc 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -587,7 +587,7 @@ class MainContentContainer extends Component { // var timeOut = parseInt(<%= @myshixun.main_mirror.try(:time_limit) %>); // 超时参数 - + this.setEvaluateMiddleStatusText('') this.setState({ gameBuilding: true }) @@ -611,6 +611,9 @@ class MainContentContainer extends Component { this.setGameBuildFalse() }); } + setEvaluateMiddleStatusText = (msg) => { + window.$('#evaluateMiddleStatusText').html(msg) + } // 之前的task_commit方法 gameBuild(fileUpdateResponse, first) { const { st, challenge, output_sets, onRunCodeTestFinish, showSnackbar, time_limit } = this.props @@ -642,15 +645,16 @@ class MainContentContainer extends Component { withCredentials: true, }).then((gameStatusResponse) => { requestTimes++; - if(!gameStatusResponse.data) { - if(requestTimes >= timeOut - 1){ // 最后一次参数改为true + if(!gameStatusResponse.data || gameStatusResponse.data.statusMessage + && gameStatusResponse.data.messageStatus ) { + if(requestTimes >= timeOut - 1) { // 最后一次参数改为true timeOutFlag = true; } + if (gameStatusResponse.data.statusMessage) { + this.setEvaluateMiddleStatusText(gameStatusResponse.data.statusMessage) + } return; } - if (gameStatusResponse.data.message) { - - } const { status } = gameStatusResponse.data; if (timeOutFlag === false && (status === 2 || status === 0)) { From 27240407a0608b986b8b9c758246d2d13bea7ea9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 16 Mar 2019 09:55:42 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E8=AF=84=E6=B5=8B?= =?UTF-8?q?=E4=B8=AD=20!status=20&&=20status=20!=3D=3D=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/page/MainContentContainer.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index cce183d0..01126075 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -644,18 +644,18 @@ class MainContentContainer extends Component { axios.get(game_status_url, { withCredentials: true, }).then((gameStatusResponse) => { - requestTimes++; - if(!gameStatusResponse.data || gameStatusResponse.data.statusMessage - && gameStatusResponse.data.messageStatus ) { + requestTimes++; + const { status, running_code_message } = gameStatusResponse.data; + + if(!gameStatusResponse.data || !status && status !== 0 ) { if(requestTimes >= timeOut - 1) { // 最后一次参数改为true - timeOutFlag = true; - } - if (gameStatusResponse.data.statusMessage) { - this.setEvaluateMiddleStatusText(gameStatusResponse.data.statusMessage) - } + timeOutFlag = true; + } + if (running_code_message) { + this.setEvaluateMiddleStatusText(running_code_message) + } return; } - const { status } = gameStatusResponse.data; if (timeOutFlag === false && (status === 2 || status === 0)) { // 网络太慢或服务处理较慢的情况下,可能这里会执行第二次 From 999aba69f4faee83f1be5851ab0d3558ca6021a2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 09:14:25 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E8=AF=95=E7=94=A8=E6=8E=88=E6=9D=83=E5=AE=A1?= =?UTF-8?q?=E6=89=B9-=E5=B7=B2=E5=AE=A1=E6=89=B9=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E4=BB=A5=E5=8F=8A=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 56 +++++++++--- .../managements/trial_authorization.html.erb | 85 +++++++++--------- app/views/managements/users.html.erb | 86 +++++++++++-------- public/stylesheets/educoder/edu-main.css | 1 + 4 files changed, 140 insertions(+), 88 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 9992d000..599e8da4 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2104,25 +2104,36 @@ end condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition] if 0 == status if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.order("#{@order_key} #{@us_order}") + @users = User.where(nil) else - @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}") + @users = User.where("#{condition} like '%#{params[:research_contents]}%'") end else if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.where(:status => status).order("#{@order_key} #{@us_order}") + @users = User.where(:status => status) else - @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}") + @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'") end end + if params[:identity] && params[:identity].to_i != -1 + @users = @users.includes(:user_extensions).where("user_extensions.identity = ?", params[:identity].to_i) + end + + if params[:auto_school] && params[:auto_school].to_i != 0 + @users = @users.includes(:user_extensions => [:school]).where("schools.auto_users_trial = ?", params[:auto_school].to_i == 1 ? 1 : 0) + end + if params[:school] && params[:school] != '' school_name = params[:school] school = School.where("name like '%#{school_name}%'") school_id = school.map(&:id) user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) - @users = @users.where(:id => user_id).order("#{@order_key} #{@us_order}") + @users = @users.where(:id => user_id) end + + @users = @users.order("#{@order_key} #{@us_order}") + @page = (params['page'] || 1).to_i @users_count = @users.count @limit = 20 @@ -3186,25 +3197,44 @@ end search = params[:search] @status = trial_authorization_status(params[:status]) # @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2] - if search.blank? - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user) - else - user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user) + user_id = [] + search = false + @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status) + + unless search.blank? + user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'").map(&:id) end - if params[:sname] && params[:sname] != '' + if params[:sname] && params[:sname].strip != '' school_id = School.where("name like '%#{params[:sname]}%'") - user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) - @authorizations = @authorizations.where(:user_id => user_id).order("updated_at desc") + new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true + end + + if params[:identity] && params[:identity].to_i != -1 + new_user_id = UserExtensions.where(:identity => params[:identity].to_i).map(&:user_id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true end + if params[:auto_school] && params[:auto_school].to_i != 0 + school_id = School.where(auto_users_trial: params[:auto_school].to_i == 1 ? 1 : 0) + new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true + end + + @authorizations = user_id.size == 0 && !search ? @authorizations.order("updated_at desc") : @authorizations.where(:user_id => user_id.uniq).order("updated_at desc") + @autu_count = @authorizations.count @limit = 15 @is_remote = true @autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1 @offset ||= @autu_pages.offset @authorizations = paginateHelper @authorizations, @limit + + @authorizations = @authorizations.includes(:user) respond_to do |format| format.js format.html diff --git a/app/views/managements/trial_authorization.html.erb b/app/views/managements/trial_authorization.html.erb index 5f2c17a1..acdc4d69 100644 --- a/app/views/managements/trial_authorization.html.erb +++ b/app/views/managements/trial_authorization.html.erb @@ -28,11 +28,22 @@
-

+

全部 同意 拒绝

+ +
@@ -91,59 +102,55 @@ }); /* ----------------------- 已审批(全部) ------------------------- */ - $("#audit_all_authentication").on("click", function(){ - var iName = $("#audit_search_name").val(); - var sName = $("#school_search_name").val(); - - $.ajax({ - url: "<%= trial_authorization_managements_path %>" + ".js", - data: { name: iName, status: [1, 2], sname: sName } - }); - }); + $("#audit_all_authentication").on("click", function(){search_func([1, 2]);}); /* ----------------------- 已审批(同意) ------------------------- */ - $("#audit_agree_authentication").live("click", function(){ - var iName = $("#audit_search_name").val(); - var sName = $("#school_search_name").val(); - - $.ajax({ - url: "<%= trial_authorization_managements_path %>" +".js", - data: { name: iName, status: 1, sname: sName} - }); - }); + $("#audit_agree_authentication").live("click", function(){search_func(1);}); /* ----------------------- 已审批(拒绝) ------------------------- */ - $("#audit_reject_authentication").live("click", function(){ - var iName = $("#audit_search_name").val(); - var sName = $("#school_search_name").val(); + $("#audit_reject_authentication").live("click", function(){search_func(2);}); - $.ajax({ - url: "<%= trial_authorization_managements_path %>" +".js", - data: { name: iName, status: 2, sname: sName } - }); + /* ------------------- 按名字进行搜索(已审批)-------------------- */ + $("#audit_search").live("click", function(){search_func(0);}); + $("#user_identity").on("change", function(){search_func(0);}); + $("#auto_school").on("change", function(){search_func(0);}); + + $("#audit_search_name, #school_search_name").on("keydown", function(e){ + // 兼容FF和IE和Opera + var theEvent = e || window.event; + var code = theEvent.keyCode || theEvent.which || theEvent.charCode; + if (code == 13) { + //回车执行查询 + search_func(0); + } }); - /* ------------------- 按名字进行搜索(已审批)-------------------- */ - $("#audit_search").live("click", function(){ + function search_func(status){ var iName = $("#audit_search_name").val(); var sName = $("#school_search_name").val(); + var identity = $("#user_identity").val(); + var auto_school = $("#auto_school").val(); + var type = status; - var id = $("#audit_all_authentication").parent().find(".active").attr("id"); - var type = 0; + if(type == 0){ + var id = $("#audit_all_authentication").parent().find(".active").attr("id"); - if(id == "audit_all_authentication"){ - type = [1, 2]; - }else if(id=="audit_agree_authentication"){ - type = 1; - }else{ - type = 2; + if(id == "audit_all_authentication"){ + type = [1, 2]; + }else if(id=="audit_agree_authentication"){ + type = 1; + }else{ + type = 2; + } } -// alert(type); + $.ajax({ url: "<%= trial_authorization_managements_path %>" +".js", - data: { search: iName, status: type, sname: sName} + data: { search: iName, status: type, sname: sName, identity: identity, auto_school: auto_school} }); - }); + } + + // $(document).keyup(function(event){ // if(event.keyCode == 13){ diff --git a/app/views/managements/users.html.erb b/app/views/managements/users.html.erb index e707214e..9b01dab3 100644 --- a/app/views/managements/users.html.erb +++ b/app/views/managements/users.html.erb @@ -1,40 +1,53 @@
<%= form_tag(url_for(users_managements_path), :id => "managements_users_search", :method => "post", :remote => true) do %> -
-

全部状态

- -
    -
  • 全部状态
  • -
  • 活动的(<%= query_user_status_num 1 %>)
  • -
  • 未激活(<%= query_user_status_num 2 %>)
  • -
  • 已锁定(<%= query_user_status_num 3 %>)
  • -
-
-
-

真实姓名搜索

- -
    -
  • 真实姓名搜索
  • -
  • 用户id搜索
  • -
  • 邮箱地址搜索
  • -
  • 手机号码搜索
  • -
-
-
- -
-
  • - - -
    -
  • - +
    +

    全部状态

    + +
      +
    • 全部状态
    • +
    • 活动的(<%= query_user_status_num 1 %>)
    • +
    • 未激活(<%= query_user_status_num 2 %>)
    • +
    • 已锁定(<%= query_user_status_num 3 %>)
    • +
    +
    +
    +

    真实姓名搜索

    + +
      +
    • 真实姓名搜索
    • +
    • 用户id搜索
    • +
    • 邮箱地址搜索
    • +
    • 手机号码搜索
    • +
    +
    - 搜索 - 清除 + + - +
    + +
    +
  • + + +
    +
  • + + + 搜索 + 清除 + + 课堂添加成员 <% end %>
    @@ -42,7 +55,7 @@ <%= render :partial => "managements/user_list" %>
    \ No newline at end of file diff --git a/app/views/managements/users.html.erb b/app/views/managements/users.html.erb index 9b01dab3..3117e124 100644 --- a/app/views/managements/users.html.erb +++ b/app/views/managements/users.html.erb @@ -44,6 +44,9 @@ + + + 搜索 清除 From 99a47e1c8ec47c97714ada703b51bc94c0cc6483 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 16:08:55 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E8=87=AA=E5=8A=A8=E6=8E=88=E6=9D=83=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E5=88=97=E8=A1=A8=E4=B8=AD=EF=BC=8C=E4=BB=85=E7=BB=99?= =?UTF-8?q?=E2=80=9D=E5=AD=A6=E7=94=9F=E2=80=9C=E8=87=AA=E5=8A=A8=E6=8E=88?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 34552787..e5f4f8b4 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -1038,7 +1038,7 @@ class AccountController < ApplicationController apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization", :status => 0).first school_ids = School.where(:auto_users_trial => 1).map(&:id) user_ex = User.current.user_extensions - if (user_ex.identity == 0 || (user_ex.identity == 1 && user_ex.student_id.present?)) && !user_ex.school.nil? && school_ids.include?(user_ex.school_id) + if user_ex.identity == 1 && user_ex.student_id.present? && !user_ex.school.nil? && school_ids.include?(user_ex.school_id) User.current.update_attributes(:certification => 1) logger.warn("apply_trail #######{User.current.login} ****#{User.current.user_extensions.school_id}") @tip = "申请已提交,我们将在1分钟内完成审核" From a8fb7072305beaf3fd83a10fe720504588acb9e0 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 19 Mar 2019 16:19:06 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=BF=87=E6=9D=A5=E7=9A=84=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=9C=89?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=9A=84=E6=83=85=E5=86=B5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ecloud_controller.rb | 2 +- app/models/user.rb | 38 ++++++++++++++++------------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index c49b34a6..6ff6d1ef 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -43,7 +43,7 @@ class EcloudController < ApplicationController CLIENT_ID = '1056' CLIENT_SECRET = '2e84256a-3de4-4713-9e02-10ee88a14592' SERVER_URL = "https://221.176.53.130:44390/services/" - +q ## 签名 diff --git a/app/models/user.rb b/app/models/user.rb index fdb9566a..31c58f26 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1693,31 +1693,37 @@ class User < Principal end def self.create_with_ecoder!(info) - user = User.new - user.admin = false - user.login = "ecoder_" + info["mobile"] + user = User.find_by_phone(info["mobile"]) - user.phone = info["mobile"] + # 如果手机号存在,则直接绑定用户 + # 因为手机号可以取回密码,所以可以视为同一用户 + unless user + user = User.new + user.admin = false + user.login = "ecoder_" + info["mobile"] - unless User.find_by_mail(info["email"]) - user.mail = info["email"] - end - user.nickname = info["username"] + user.phone = info["mobile"] + + unless User.find_by_mail(info["email"]) + user.mail = info["email"] + end + user.nickname = info["username"] - user.activate - user.last_login_on = Time.now + user.activate + user.last_login_on = Time.now - user.ecoder_user_id = info["userid"] + user.ecoder_user_id = info["userid"] - user.save!(:validate => false) + user.save!(:validate => false) - UserStatus.create!(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) + UserStatus.create!(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) - ue = user.user_extensions ||= UserExtensions.new - ue.user_id = user.id - ue.save! + ue = user.user_extensions ||= UserExtensions.new + ue.user_id = user.id + ue.save! + end user end From ebe9ee145b81345058b32a1f3197fdb040eb7940 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 16:45:14 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E7=9A=84=E5=BC=80=E5=90=AF=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/shixun_work_report.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/shixun_work_report.html.erb b/app/views/student_work/shixun_work_report.html.erb index 34449b17..a7307405 100644 --- a/app/views/student_work/shixun_work_report.html.erb +++ b/app/views/student_work/shixun_work_report.html.erb @@ -76,7 +76,7 @@ 延时 <% end %> - <%= game.try(:open_time).nil? ? "--" : format_time(game.open_time) %> + <%= game.try(:open_time).nil? || game.status == 3 ? "--" : format_time(game.open_time) %> <% user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %> <%= user_query.blank? ? "--" : user_query.first[1] %> <%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %> From 0c643a82b86644eba2098bfceb3761dd8d1eb622 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 17:05:08 +0800 Subject: [PATCH 10/12] =?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/views/shixuns/_shixun_top.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index fb7dcd21..5703e66d 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -15,7 +15,7 @@ <% if @shixun.myshixuns.count > 0 %>
  • 学习人数 - <%= @shixun.myshixuns.count %> + <%= @shixun.myshixuns_count %>
  • <% end %>
  • From f1b17212b488f2a703b62a3711bcd6b6b84aded3 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 18:01:06 +0800 Subject: [PATCH 11/12] =?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/controllers/account_controller.rb | 2 +- app/controllers/managements_controller.rb | 8 +++++--- .../account/_pro_certification_form.html.erb | 3 +++ .../account/professional_certification.html.erb | 3 +++ public/javascripts/educoder/edu_account.js | 15 +++++++++------ 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index e5f4f8b4..8f3a2b53 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -891,7 +891,7 @@ class AccountController < ApplicationController @user = User.current @se = @user.extensions # 已授权的用户修改单位名称,需要重新授权 - if @se.school_id != params[:occupation].to_i && @user.certification == 1 + if (@se.school_id != params[:occupation].to_i || @se.identity != params[:identity].to_i) && @user.certification == 1 @user.certification = 0 apply_user = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization") apply_user.update_all(:status => 2) unless apply_user.blank? diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 599e8da4..7a8e6495 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -3194,15 +3194,17 @@ end def trial_authorization @menu_type =10 @sub_type = 2 - search = params[:search] + name_search = params[:search] @status = trial_authorization_status(params[:status]) # @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2] user_id = [] search = false @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status) - unless search.blank? - user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'").map(&:id) + unless name_search.blank? + new_user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{name_search}%'").map(&:id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true end if params[:sname] && params[:sname].strip != '' diff --git a/app/views/account/_pro_certification_form.html.erb b/app/views/account/_pro_certification_form.html.erb index 962843f7..8c5552af 100644 --- a/app/views/account/_pro_certification_form.html.erb +++ b/app/views/account/_pro_certification_form.html.erb @@ -10,6 +10,9 @@
    • + <% if @user.certification == 1 %> + + <% end %> + <% end %>