Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners

dev_local
jasder 6 years ago
commit 17687f999e

@ -1,12 +1,15 @@
class CooperatesController < ApplicationController
before_filter :require_login
before_filter :find_partner, only: [:partner_list]
before_filter :is_admin, only: [:partner_list]
def partner_list
search = params[:search]
@schools = School.where(id: [179, 3181, 3216]).where("name like ?", "'%#{search}%'")
@schools = School.where(customer_id: @partner.customer_ids)
@all_count = @schools.size
unless search.blank?
@schools = @schools.where("name like ?", "'%#{search}%'")
@schools = @schools.where("name like ?", "%#{search}%")
end
@search_count = @schools.size
@schools = paginateHelper @schools, 15
@ -17,4 +20,17 @@ class CooperatesController < ApplicationController
format.html{render :layout => "base_edu"}
end
end
def find_partner
@partner = Partner.find_by_id(params[:id])
render_404 if @partner.nil? || @partner.status == -1
rescue ActiveRecord::RecordNotFound
render_404
end
def is_admin
unless User.current.admin? || (User.current.partner.present? && User.current.partner == @partner)
render_403
end
end
end

@ -61,4 +61,8 @@ class School < ActiveRecord::Base
myshixun_id !=0").first.try(:sw_count)
end
def statistic_url
dep = departments.where("identifier is not null").first
url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : ""
end
end

@ -9,29 +9,26 @@
<span class="column-2 fr">使用详情</span>
</p>
<ul class="minH-560 edu-back-white pb20 courselist">
<% @schools.each_with_index do |school, index| %>
<li class="clearfix bor-bottom-greyE" id="major_list">
<span class="column-No major_index">1</span>
<span class="column-2">国防科技大学</span>
<span class="column-2">22</span>
<span class="column-2">
33
</span>
<span class="column-2">
44
</span>
<span class="column-2">
55
</span>
<span class="column-2">
66
</span>
<span class="column-No major_index"><%= index + 1 %></span>
<span class="column-2"><%= school.name %></span>
<span class="column-2"><%= school.teacher_count %></span>
<span class="column-2"><%= school.student_count %></span>
<span class="column-2"><%= school.course_count %></span>
<span class="column-2"><%= school.shixun_count %></span>
<span class="column-2"><%= school.shixun_report_count %></span>
<span class="column-2 fr">
<a href="" class="color-blue">查看</a>
<% if school.statistic_url != "" %>
<a href="<%= school.statistic_url %>" target="_blank" class="color-blue">查看</a>
<% else %>
--
<% end %>
</span>
</li>
<% end %>
</ul>
<div class="educontent edu-txt-center mb80 mt20">
<div class="inline pages_user_show">
<ul>

@ -0,0 +1,42 @@
<div id="Auth_main">
<div class="educontent mb30 mt20">
<div class="clearfix padding20-30 bor-bottom-greyE edu-back-white">
<span class="fl font-12 mt5">
<span class="color-orange-tip mr3" id="search_partner_count"><%= @obj_count %></span>
<span class="color-grey-9">个检索结果(<span id="all_major_count"><%= @all_count %></span> 单位)</span>
</span>
<div class="fr" id="pollingPanel">
<input type="text" name="search" maxlength="20" placeholder="请输入单位名称搜索" />
<a href="javascript:void(0)" onclick="submit_search_major()"><i class="iconfont icon-sousuo font-16 color-grey-9"></i></a>
</div>
</div>
<div class="ListTableLine ListTableLines" id="partner_school_list">
<%= render :partial => "partner_item" %>
</div>
</div>
</div>
<script>
$(function(){
$("#pollingPanel").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
submit_search_major()
}
});
});
function submit_search_major(){
$.get('/cooperates/partner_list',
{ search: $("input[name='search']").val().trim()});
}
</script>

@ -0,0 +1,2 @@
$("#partner_school_list").html("<%= j(render :partial => "partner_item") %>");
$("#search_partner_count").html("<%= @obj_count %>");

@ -52,6 +52,9 @@
<li><%= link_to '我的课堂', user_path(User.current) %></li>
<li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li>
<li><%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %></li>
<% if User.current.partner.present? %>
<li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li>
<% end %>
<li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li>
<li><a>客户管理</a></li>

@ -1,86 +0,0 @@
<div id="Auth_main">
<div class="educontent clearfix edu-back-white bor-bottom-greyE">
<div class="padding20-30">
<!-- <p class="mb20"><span class="font-18 mr20">管理员</span><span class="font-12 color-grey-9"></span></p>-->
<!-- <ul class="clearfix managerPanels">-->
<!-- <a class="fl relative">-->
<!-- <img alt="头像" class="radius" height="48" src="https://www.educoder.net/images/avatars/User/6?1543479003" width="48" />-->
<!-- <i class="iconfont icon-shanchudiao userimg color-grey-9" ></i>-->
<!-- <span class="color-black">达达老师</span>-->
<!-- </a>-->
<!-- <a class="fl relative">-->
<!-- <i class="iconfont icon-tianjiafangda useradd color-grey-9"></i>-->
<!-- </a>-->
<!-- </ul>-->
<!-- <ul class="clearfix managerPanels">-->
<!-- <a class="fl font-16 padding5-20 block mr30 navItem active color-blue"><span class="fl">实训回复</span></a>-->
<!-- </ul>-->
</div>
</div>
<div class="educontent mb30">
<div class="clearfix padding20-30 bor-bottom-greyE edu-back-white">
<span class="fl font-12 mt5">
<span class="color-orange-tip mr3" id="search_major_count"><%= @obj_count %></span>
<span class="color-grey-9">个检索结果(<span id="all_major_count"><%= @major_count %></span> 单位)</span>
</span>
<div class="fr" id="pollingPanel">
<input type="text" name="search" placeholder="请输入单位名称搜索" />
<a href="javascript:void(0)" onclick="submit_search_major()"><i class="iconfont icon-sousuo font-16 color-grey-9"></i></a>
</div>
</div>
<div class="ListTableLine ListTableLines" id="school_major_list">
<%= render :partial => "department_list" %>
</div>
</div>
</div>
<script>
$(function(){
$(".MajorName i").click(function(){
$(this).parents(".MajorName").remove();
});
$("#school_major_list").on("click", ".addMajorManager", function(){
if($("#major_managers_"+$(this).attr("data-major-id")).children("span").length < 5){
var html="<%= escape_javascript(render :partial => "ecs/authList_addUnit") %>";
pop_box_new(html,572,500);
$("#object_id").val($(this).attr("data-major-id"));
$("#object_type").val('major');
$("input[name='school']").val('<%= @school.name %>');
} else {
notice_box("只能配置5个专业管理员");
}
});
$("#pollingPanel").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
submit_search_major()
}
});
});
function submit_search_major(){
$.get('/ecs/department?school_id=<%= @school.id %>',
{ search: $("input[name='search']").val().trim()});
}
</script>

@ -40,6 +40,15 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'ecloud/ps_update', to: 'ecloud#ps_update'
resources :cooperates do
member do
get 'partner_list'
end
collection do
end
end
resources :ec_course_evaluations do
member do
match 'import_score', :via => [:post]

Loading…
Cancel
Save