diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index c814d957..2505a3bf 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -254,7 +254,10 @@ class CollegesController < ApplicationController def manager_auth # unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) - unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0)) + unless (User.current.admin? || + DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || + (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0) || + (@department.school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@department.school.try(:customer_id)))) render_403 end end diff --git a/app/controllers/cooperates_controller.rb b/app/controllers/cooperates_controller.rb index aecbb293..12467a36 100644 --- a/app/controllers/cooperates_controller.rb +++ b/app/controllers/cooperates_controller.rb @@ -1,6 +1,36 @@ class CooperatesController < ApplicationController + before_filter :require_login + before_filter :find_partner, only: [:partner_list] + before_filter :is_admin, only: [:partner_list] - def show + def partner_list + search = params[:search] + @schools = School.where(customer_id: @partner.customer_ids) + @all_count = @schools.size + unless search.blank? + @schools = @schools.where("name like ?", "%#{search}%") + end + @search_count = @schools.size + @schools = paginateHelper @schools, 15 + @schools = @schools.includes(:courses, users: :user_extensions) + + respond_to do |format| + format.js + format.html{render :layout => "base_edu"} + end + end + + def find_partner + @partner = Partner.find_by_id(params[:id]) + render_404 if @partner.nil? + 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 diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 3881dd3d..514d5c5a 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -796,12 +796,22 @@ class ManagementsController < ApplicationController @menu_type = 8 @sub_type = 2 @search = params[:search] + @beginTime = params[:beginTime] + @endTime = params[:endTime] if @search.present? shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id) @discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc") else @discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc") end + + if params[:beginTime] && params[:beginTime].strip != "" + @discusses = @discusses.where("created_at >= '#{Time.parse(params[:beginTime])}'") + end + if params[:endTime] && params[:endTime].strip != "" + @discusses = @discusses.where("created_at <= '#{Time.parse(params[:endTime])}'") + end + @all_discusses = @discusses @discusses_count = @discusses.count @limit = 20 @@ -1175,6 +1185,137 @@ end end end + def partners + @menu_type = 6 + @sub_type = 3 + if params[:search].blank? + @partners = Partner.includes(:school).order("partners.created_at desc") + else + @partners = Partner.where("name like ? ", "%#{params[:search]}%").includes(:school).order("partners.created_at desc") + end + + @current_partner = nil + if params[:partner] + @current_partner = @partners.find params[:partner] + else + @current_partner = @partners[0] if @partners.size > 0 + end + + respond_to do |format| + format.js + format.html + end + end + + def get_partner + @partner = Partner.find partner + + end + + # 添加客户 + def customers_list + @search = params[:search] + @province = params[:province] + partner_id = params[:partner_id] + @partner = Partner.find partner_id + @customers = @partner.customers + if @customers.present? + @schools = School.where("(partner_id != ? or partner_id is NULL) and customer_id is NULL", @partner.id) + else + @schools = School.where("customer_id is null and (partner_id != ? or partner_id is NULL)", @partner.id) + end + if params[:search] + @schools = @schools.where("name like ?", "%#{@search}%") + end + + if params[:province] && params[:province] != '0' + @schools = @schools.where("province like ?", "%#{@province}%") + end + @limit = 10 + @page = params[:page] || 1 + @schools_count = @schools.count + + @total_pages = (@schools_count / 10.0).ceil + @schools = paginateHelper @schools, @limit + respond_to do |format| + format.js + format.json { + render json: @schools + } + end + end + + def add_customers + school_ids = params[:school_ids] + if school_ids.length > 0 + school_ids.each do |s| + school = School.where("id = ?",s).first + if school.present? + customer = Customer.new(partner_id: params[:partner_id]) + customer.save! + school.update_attributes(:customer_id => customer.id) + end + end + render :json => {status: 1, message: "创建成功!"} + end + end + + def delete_customers + if params[:customer] + customer = Customer.where(id: params[:customer]).first + @current_partner = customer.partner + customer.school.update_attributes(:customer_id => nil) + customer.destroy + end + end + + def all_partners + @search = params[:search] + @province = params[:province] + @schools = School.where("partner_id IS NULL") + + if params[:search] + @schools = @schools.where("name like ?", "%#{@search}%") + end + + if params[:province] && params[:province] != '0' + @schools = @schools.where("province like ?", "%#{@province}%") + end + + @limit = 10 + @page = params[:page] || 1 + @schools_count = @schools.count + + @total_pages = (@schools_count / 10.0).ceil + @schools = paginateHelper @schools, @limit + respond_to do |format| + format.js + format.json { + render json: @schools + } + end + end + + + def add_partner + school_ids = params[:school_ids] + if school_ids.length > 0 + school_ids.each do |s| + school = School.where("id = ?",s).first + if school.present? && school.partner_id.nil? + partner = Partner.new(name: school.name) + partner.save + school.update_attributes(:partner_id => partner.id) + end + end + end + render :json => {status: 1, message: "创建成功!"} + end + + + + + # 删除部门管理员 def delete_depart_member DepartmentMember.where(:department_id => params[:depart], :user_id => params[:user_id]).destroy_all @@ -1202,8 +1343,55 @@ end @department.department_members << DepartmentMember.new(:user_id => member) end end + redirect_to partners_managments_path + + # respond_to do |format| + # format.html {render :layout => "base_edu"} + # format.js + # end + + end + + # 添加合作伙伴管理员- 弹框 + def add_partner_member_box + @partner = Partner.where(:id => params[:partner]).first + @members = + if params[:search] + User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%' AND partner_id is NULL") + else + User.where(:certification => 1, :partner_id => nil ) + end + @total_pages = (@members.count / 10.0).ceil + @members = paginateHelper @members, 10 + respond_to do |format| + format.js + format.json { + render json: member_json_data(@members) + } + end end + # 合作伙伴添加管理员 + def add_partner_member + if params[:partner] && params[:partner_member] + @partner = Partner.find_by_id params[:partner] + params[:partner_member].each do |member| + user = User.find_by_id member + user.update_attributes(partner_id: @partner.id) if !@partner.nil? && !user.nil? + end + end + end + + # 合作伙伴删除管理员 + def delete_partner_member + if params[:partner] && params[:partner_member] + @partner = Partner.find_by_id params[:partner] + user = User.find_by_id params[:partner_member] + user.update_attributes(partner_id: nil) if !@partner.nil? && !user.nil? + end + end + + # check 部门 identifier是否重复 def check_depart_identifier logger.info("###############{params}") @@ -4082,7 +4270,8 @@ end sheet1[count_row, 5] = discusses.count discusses.each_with_index do |discuss, j| user = discuss.user - sheet1[count_row, 6] = discuss.content.gsub(//, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】") + content = discuss.content.gsub(//, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】") + sheet1[count_row, 6] = strip_html content sheet1[count_row, 7] = "第#{discuss.position}关" sheet1[count_row, 8] = user.show_real_name sheet1[count_row, 9] = user.identity @@ -4221,4 +4410,19 @@ end book.write xls_report xls_report.string end + + def member_json_data mmebers + mmebers.map do |member| + real_name = member.show_real_name + identity = member.identity + school_name = member.school_name + user_phone = member.phone || "" + member.attributes.dup.except("login", "hashed_password", "salt", "status", "mail", "experience", "grade", + "authentication", "professional_certification").merge({real_name: real_name, + identity: identity, + school_name: school_name, + user_phone: user_phone}) + end + end + end diff --git a/app/controllers/partners_controller.rb b/app/controllers/partners_controller.rb new file mode 100644 index 00000000..214948cf --- /dev/null +++ b/app/controllers/partners_controller.rb @@ -0,0 +1,29 @@ +class PartnersController < ApplicationController + layout 'base_management' + + def index + @menu_type = 6 + @sub_type = 3 + + @partners = Partner.includes(:school) + end + + def new + + end + + def edit + + end + + def create + + end + + def destroy + + end + + private + +end diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 78fb4a63..367b3e99 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -9,6 +9,7 @@ class PollController < ApplicationController before_filter :require_login, :only => [:student_poll_list, :show] include PollHelper include ApplicationHelper + def index if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) render_403 @@ -18,13 +19,13 @@ class PollController < ApplicationController if @is_teacher polls = @course.polls.order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC") - elsif User.current.member_of_course?(@course) + elsif User.current.member_of_course?(@course) # 课堂成员显示为发布的和已发布的 member = @course.members.where(:user_id => User.current.id).first if member.try(:course_group_id).to_i == 0 polls = @course.polls.where("publish_time <= '#{Time.now}' and unified_setting = 1").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC") - else + else # 已分班的成员 not_poll_ids = @course.poll_group_settings.where("course_group_id = #{member.try(:course_group_id)} and (publish_time > '#{Time.now}' or publish_time is null)") - not_poll_ids = not_poll_ids.blank? ? "(-1)" : "(" + not_poll_ids.map(&:poll_id).join(",") + ")" + not_poll_ids = not_poll_ids.blank? ? "(-1)" : "(" + not_poll_ids.map(&:poll_id).join(",") + ")" # 已分班,但是成员不再 polls = @course.polls.where("publish_time <= '#{Time.now}' and id not in #{not_poll_ids}").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC") end else @@ -414,7 +415,6 @@ class PollController < ApplicationController def update_poll_question @poll_question = PollQuestion.find params[:poll_question] @poll = @poll_question.poll - @poll_question.is_necessary = params[:is_necessary] == "1" ? 1 : 0 @poll_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title] @poll_question.max_choices = params[:max_choices].to_i || 0 @poll_question.min_choices = params[:min_choices].to_i || 0 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 83ec54f8..b2761b60 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -324,9 +324,15 @@ class ShixunsController < ApplicationController @search_name = "#{sub.name} / #{tag.name}" end shixun_id = ShixunTagRepertoire.where(:tag_repertoire_id => tag).map(&:shixun_id) - @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:id => shixun_id, :hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc") + @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, + :trainee, :use_scope, :identifier, :image_text, :averge_star]) + .where(:id => shixun_id, :hidden => 0).where("status != -1") + .includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc") else - @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc") + @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, + :trainee, :use_scope, :identifier, :image_text, :averge_star]) + .where("status != ? and hidden = ?", -1, 0).includes(:challenges, :schools, :shixun_members, :users) + .order("status = 2 desc, publish_time asc") end # # 依据tag和语言推荐实训,如果tag不够,则依据语言推荐;语言不够,则取系统的三个 # @recommend_shixuns = Shixun.find_by_sql("select challenge_id from challenge_tags where name like diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 39bae842..707ff571 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -708,6 +708,8 @@ module ApplicationHelper when 6 if sub_type == 1 link_to('单位列表', departments_part_managements_path()) + "#{grandchild_type[:next_type] == 1 ? " > #{grandchild_type[:school].name}" : ""}" + elsif sub_type == 3 + "合作伙伴" else "单位部门列表" end diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 411fc3c3..1ac26aa6 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -20,11 +20,11 @@ module PollHelper def un_commit_num poll course = poll.course - member = course.members.where(:user_id => User.current.id).first - poll_users = poll.poll_users - student_count = course.student.count + member = course.members.where(:user_id => User.current.id).first ## 当前用户是否为课堂成员 + poll_users = poll.poll_users # 问卷的全部用户,包含已回答的/为回答,但是浏览的 + student_count = course.student.count # 课堂的学生数 if member.present? && member.teacher_course_groups.count > 0 - group_students = course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) + group_students = course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) ## 统计当前用户所在班级的全部学生 student_count = group_students.size poll_users = poll_users.where(:user_id => group_students) end diff --git a/app/models/customer.rb b/app/models/customer.rb new file mode 100644 index 00000000..673acd20 --- /dev/null +++ b/app/models/customer.rb @@ -0,0 +1,6 @@ +class Customer < ActiveRecord::Base + default_scope :order => 'customers.created_at desc' + belongs_to :partner + has_one :school + has_many :users +end diff --git a/app/models/message.rb b/app/models/message.rb index 6fb9bb59..63a7ce5f 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -53,6 +53,7 @@ class Message < ActiveRecord::Base has_many :tidings, :as => :container , :dependent => :destroy belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id' + has_one :message_detail, :dependent => :destroy #转发表 has_many :forwards, :as => :from, :dependent => :destroy @@ -117,6 +118,10 @@ class Message < ActiveRecord::Base self.content end + def content + self.message_detail.try(:content) + end + def topic? parent_id.nil? end diff --git a/app/models/partner.rb b/app/models/partner.rb new file mode 100644 index 00000000..217bc1a7 --- /dev/null +++ b/app/models/partner.rb @@ -0,0 +1,8 @@ +class Partner < ActiveRecord::Base + # attr_accessible :name, :active + attr_accessor :active + + has_one :school + has_many :customers + has_many :users +end diff --git a/app/models/school.rb b/app/models/school.rb index 2a33acac..62e27987 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -3,7 +3,8 @@ class School < ActiveRecord::Base attr_accessible :name, :province, :pinyin, :city, :address, :logo_link, :auto_users_trial, :shool_code, :authorization_time, - :identifier, :is_online, :video_desc, :video_name,:course_link, :course_name + :identifier, :is_online, :video_desc, :video_name,:course_link, + :course_name, :partner_id, :customer_id has_many :courses has_many :departments, :dependent => :destroy has_many :shixun_schools, :dependent => :destroy @@ -15,6 +16,9 @@ class School < ActiveRecord::Base has_many :ec_majors, :through => :ec_major_schools has_many :ec_major_schools, :dependent => :destroy + belongs_to :partner + belongs_to :customer + # banner图片信息 has_many :school_images, :dependent => :destroy @@ -26,4 +30,40 @@ class School < ActiveRecord::Base def to_s self.name.to_s end + + def teacher_count + User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON + users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND + user_extensions.`identity` = 0").first.try(:teacher_count) + end + + def student_count + User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON + users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND + user_extensions.`identity` = 1").first.try(:student_count) + end + + def course_count + Course.find_by_sql("SELECT COUNT(courses.`id`) AS course_count FROM courses LEFT JOIN user_extensions ON + courses.tea_id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND + courses.id != 1309").first.try(:course_count) + end + + def shixun_count + Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and + s.status in (2, 3) inner join user_extensions ue on u.id=ue.user_id and + ue.school_id=#{self.id}").first.try(:shixun_count) + end + + def shixun_report_count + StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in + (SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id + WHERE user_extensions.`school_id`=#{self.id}) and work_status between 1 and 2 and + 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 diff --git a/app/models/user.rb b/app/models/user.rb index 31c58f26..752ea113 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -160,6 +160,7 @@ class User < Principal ## added by xianbo for delete # has_many :biding_projects, :dependent => :destroy belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy + belongs_to :partner ##ended by xianbo #####fq diff --git a/app/views/managements/_users_list.html.erb b/app/views/cooperates/_partner_item.html.erb similarity index 54% rename from app/views/managements/_users_list.html.erb rename to app/views/cooperates/_partner_item.html.erb index 993c6db3..a094c452 100644 --- a/app/views/managements/_users_list.html.erb +++ b/app/views/cooperates/_partner_item.html.erb @@ -9,29 +9,26 @@ 使用详情

+
    diff --git a/app/views/cooperates/partner_list.html.erb b/app/views/cooperates/partner_list.html.erb new file mode 100644 index 00000000..06cc0910 --- /dev/null +++ b/app/views/cooperates/partner_list.html.erb @@ -0,0 +1,42 @@ +
    +
    + +
    + + <%= @obj_count %> + 个检索结果(<%= @all_count %> 单位) + +
    + + +
    +
    + +
    + <%= render :partial => "partner_item" %> +
    +
    + +
    + + \ No newline at end of file diff --git a/app/views/cooperates/partner_list.js.erb b/app/views/cooperates/partner_list.js.erb new file mode 100644 index 00000000..7b44c9df --- /dev/null +++ b/app/views/cooperates/partner_list.js.erb @@ -0,0 +1,2 @@ +$("#partner_school_list").html("<%= j(render :partial => "partner_item") %>"); +$("#search_partner_count").html("<%= @obj_count %>"); \ No newline at end of file diff --git a/app/views/courses/index.js.erb b/app/views/courses/index.js.erb index 7ed24fff..f211e3ae 100644 --- a/app/views/courses/index.js.erb +++ b/app/views/courses/index.js.erb @@ -1 +1 @@ -$("#intelligence_course_list").html("<%= j(render :partial => "courses/courseList") %>"); \ No newline at end of file +$("#intelligence_course_list").html("<%= j(render :partial => "courses/courseList") %>"); diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 9c8f4a8d..0cfd2916 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -52,10 +52,11 @@
  • <%= link_to '我的课堂', user_path(User.current) %>
  • <%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %>
  • <%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %>
  • + <% if User.current.partner.present? %> +
  • <%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %>
  • + <% end %>
  • <%= link_to '我的项目', user_path(User.current, :type => 'a_project') %>
  • -
  • 客户管理
  • - <% if User.current.department_members.count > 0 %>
  • <%= link_to '学院统计', statistics_college_path(User.current.department_members.first.try(:department)) %>
  • <% end %> diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index c6e87870..65c444c1 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -13,6 +13,10 @@ <%= javascript_include_tag "edu/application",'edu/base_edu','edu/account', 'baiduTemplate', 'jquery.datetimepicker.js', "edu/management", 'educoder/edu_application' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> + +
    @@ -71,6 +75,7 @@
    • <%= link_to "单位列表", departments_part_managements_path, :class => "edu-admin-nav-a" %>
    • <%= link_to "单位部门列表", departments_managements_path %>
    • +
    • <%= link_to "合作伙伴", partners_managements_path %>
  • 用户 diff --git a/app/views/managements/_customer_addUnit.html.erb b/app/views/managements/_customer_addUnit.html.erb new file mode 100644 index 00000000..786c4cac --- /dev/null +++ b/app/views/managements/_customer_addUnit.html.erb @@ -0,0 +1,100 @@ +
    +
    添加客户
    +
    +
    +
    + <%= render partial: "managements/customers_search_form" %> +
    + 搜索 +
    +
    +

    + 单位 + 地区 +

    +
    + <%= render :partial => "partners_list" %> +
    +

    +
    + +
  • + 取消 + 确定 +
  • +
    +
+ \ No newline at end of file diff --git a/app/views/managements/_customers_search_form.html.erb b/app/views/managements/_customers_search_form.html.erb new file mode 100644 index 00000000..28c7ece0 --- /dev/null +++ b/app/views/managements/_customers_search_form.html.erb @@ -0,0 +1,19 @@ +<%= form_for "", :url => {:controller=> 'managements', :action => 'customers_list', :partner_id => @partner.id}, :html => {:id => 'partners_search_form'}, :method => "get", :remote => true do |f| %> +
+ 地区: + +
+
+ 单位: + +
+ +<% end %> + + \ No newline at end of file diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index 818a4777..c3346d77 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -1,29 +1,9 @@
添加管理员
-
-
  • - - -

    - 姓名: - 单位: -

    -
    - 职业: -
    - - -
    -

    请选择职业

    -

    教师

    -

    学生

    -

    专业人士

    -
    -
    - 搜索 -
    -
  • +
    + + 搜索

    @@ -32,28 +12,14 @@ 单位 手机号

    -
    -

    - - - - - 学生 - 湖北工业大学 - 156****9087 -

    -

    - - - - - 学生 - 湖北工业大学 - -

    -
    + <%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %> + +
    + <%= render :partial => "partner_member_search_list" %> +
    + <% end %>
    -

    +

    请至少选择一个用户

  • 取消 确定 @@ -61,10 +27,68 @@
  • \ No newline at end of file diff --git a/app/views/managements/_partner_addUnit.html.erb b/app/views/managements/_partner_addUnit.html.erb index 1001d32c..421b3ddb 100644 --- a/app/views/managements/_partner_addUnit.html.erb +++ b/app/views/managements/_partner_addUnit.html.erb @@ -1,55 +1,23 @@
    添加合作伙伴
    -
    +
    -
    - 地区: - -
    -
    - 单位: - -
    + <%= render partial: "managements/partner_search_form" %>
    - 搜索 + 搜索
    -
    +

    单位 地区

    -
    -

    - - - - - - - 湖南 -

    -

    - - - - - - - 湖南 -

    -

    - - - - - - - 湖南 -

    +
    + <%= render :partial => "partners_list" %>

    +
  • 取消 确定 @@ -57,15 +25,74 @@
  • \ No newline at end of file diff --git a/app/views/managements/_partner_customer_list.html.erb b/app/views/managements/_partner_customer_list.html.erb new file mode 100644 index 00000000..e8f643fd --- /dev/null +++ b/app/views/managements/_partner_customer_list.html.erb @@ -0,0 +1,20 @@ +
  • + 序号 + 客户名称 + +添加 + 添加时间 +
  • +<% @current_partner.try(:customers).try(:each_with_index) do |customer, index| %> +
  • + <%= index + 1 %> + <%= customer.school.name %> + + 删除 + + + <%= format_time customer.created_at %> + +
  • +<% end %> \ No newline at end of file diff --git a/app/views/managements/_partner_list.html.erb b/app/views/managements/_partner_list.html.erb new file mode 100644 index 00000000..c73dd1ff --- /dev/null +++ b/app/views/managements/_partner_list.html.erb @@ -0,0 +1,5 @@ +<% @partners.each_with_index do |partner,index| %> +
  • + <%= link_to "#{partner.name}", partners_managements_path(:partner => partner), :class => "#{partner.id == @current_partner.id ? 'active' : ''}" %> +
  • +<% end %> \ No newline at end of file diff --git a/app/views/managements/_partner_main_div.html.erb b/app/views/managements/_partner_main_div.html.erb new file mode 100644 index 00000000..53a58e88 --- /dev/null +++ b/app/views/managements/_partner_main_div.html.erb @@ -0,0 +1,25 @@ +<% if @current_partner.present? %> +
    +
    +
    +
    +

    添加时间<%= format_time @current_partner.try(:created_at) %>

    +
    + 管理员 +
      +
    • + <%= link_to '+', add_partner_member_box_managements_path(:partner => @current_partner.try(:id)), :remote => true, :class => "addManage" %> +
    • +
      + <%= render :partial => "partner_member_list", :locals => {partner: @current_partner} %> +
      +
    +
    +
    +
    + <%= render :partial => "partner_customer_list" %> +
    +
    +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/managements/_partner_member_list.html.erb b/app/views/managements/_partner_member_list.html.erb new file mode 100644 index 00000000..daf382d1 --- /dev/null +++ b/app/views/managements/_partner_member_list.html.erb @@ -0,0 +1,10 @@ +<% partner.users.each do |user| %> +
  • + <%= image_tag(url_to_avatar(user)) %> + + + + <%= user.show_real_name %> +
  • +<% end %> \ No newline at end of file diff --git a/app/views/managements/_partner_member_search_list.html.erb b/app/views/managements/_partner_member_search_list.html.erb new file mode 100644 index 00000000..ed697064 --- /dev/null +++ b/app/views/managements/_partner_member_search_list.html.erb @@ -0,0 +1,11 @@ +<% @members.each do |member| %> +

    + + + + + <%= member.identity %> + <%= member.school_name %> + <%= member.phone %> +

    +<% end %> \ No newline at end of file diff --git a/app/views/managements/_partner_search_form.html.erb b/app/views/managements/_partner_search_form.html.erb new file mode 100644 index 00000000..cf6d9450 --- /dev/null +++ b/app/views/managements/_partner_search_form.html.erb @@ -0,0 +1,19 @@ +<%= form_for "", :url => {:controller=> 'managements', :action => 'all_partners', :type => @type}, :html => {:id => 'partners_search_form'}, :method => "get", :remote => true do |f| %> +
    + 地区: + +
    +
    + 单位: + +
    + +<% end %> + + \ No newline at end of file diff --git a/app/views/managements/_partners_list.html.erb b/app/views/managements/_partners_list.html.erb new file mode 100644 index 00000000..c42f68de --- /dev/null +++ b/app/views/managements/_partners_list.html.erb @@ -0,0 +1,11 @@ +<% @schools.each do |school| %> +

    + + + + + + + <%= school.province %> +

    +<% end %> \ No newline at end of file diff --git a/app/views/managements/_profession_index.html.erb b/app/views/managements/_profession_index.html.erb index 668aa0f1..f8f906b3 100644 --- a/app/views/managements/_profession_index.html.erb +++ b/app/views/managements/_profession_index.html.erb @@ -37,13 +37,13 @@ <%= format_time career.created_at %> <%= format_time career.published_at %> - <% if !career.status %> - 发布 - <% end %> - 编辑 - <% if !career.status %> - 删除 - <% end %> + <%# if !career.status %> + + <%# end %> + + <%# if !career.status %> + + <%# end %> <% end %> \ No newline at end of file diff --git a/app/views/managements/_unit_cooperativePartner.html.erb b/app/views/managements/_unit_cooperativePartner.html.erb index 4106dfa9..b5aa0407 100644 --- a/app/views/managements/_unit_cooperativePartner.html.erb +++ b/app/views/managements/_unit_cooperativePartner.html.erb @@ -24,7 +24,11 @@ 管理员
    • +
    • -
    • +
    • + + + 胡莎莎 +
    diff --git a/app/views/managements/add_partner_member.js.erb b/app/views/managements/add_partner_member.js.erb new file mode 100644 index 00000000..017b71b0 --- /dev/null +++ b/app/views/managements/add_partner_member.js.erb @@ -0,0 +1 @@ +$("#partner_member_list").html("<%= j(render :partial => "partner_member_list", :locals => {partner: @partner}) %>") \ No newline at end of file diff --git a/app/views/managements/add_partner_member_box.js.erb b/app/views/managements/add_partner_member_box.js.erb new file mode 100644 index 00000000..7ddc34c2 --- /dev/null +++ b/app/views/managements/add_partner_member_box.js.erb @@ -0,0 +1,6 @@ +<% if params[:search] %> +$("#member_search_user_list").html("<%= j(render :partial => "partner_member_search_list") %>") +<% else %> + var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>"; + pop_box_new(html,572,500); +<% end %> \ No newline at end of file diff --git a/app/views/managements/all_partners.js.erb b/app/views/managements/all_partners.js.erb new file mode 100644 index 00000000..3ea501b3 --- /dev/null +++ b/app/views/managements/all_partners.js.erb @@ -0,0 +1,6 @@ +<% if params[:search] %> +$("#search_user_list").html("<%= j(render :partial => "partners_list") %>") +<% else %> +var html="<%= escape_javascript(render :partial => "managements/partner_addUnit",locals: {all_path: all_partners_managements_path}) %>"; +pop_box_new(html,572,500); +<% end %> diff --git a/app/views/managements/customers_list.js.erb b/app/views/managements/customers_list.js.erb new file mode 100644 index 00000000..b112b613 --- /dev/null +++ b/app/views/managements/customers_list.js.erb @@ -0,0 +1,6 @@ +<% if params[:search] %> + $("#search_customers_list").html("<%= j(render :partial => "partners_list") %>") +<% else %> + var html="<%= escape_javascript(render :partial => "managements/customer_addUnit",locals: {all_path: customers_list_managements_path}) %>"; + pop_box_new(html,572,500); +<% end %> diff --git a/app/views/managements/delete_customers.js.erb b/app/views/managements/delete_customers.js.erb new file mode 100644 index 00000000..6c72d223 --- /dev/null +++ b/app/views/managements/delete_customers.js.erb @@ -0,0 +1 @@ +$("#partner_customer_list").html("<%= j(render :partial => "partner_customer_list") %>") \ No newline at end of file diff --git a/app/views/managements/delete_partner_member.js.erb b/app/views/managements/delete_partner_member.js.erb new file mode 100644 index 00000000..017b71b0 --- /dev/null +++ b/app/views/managements/delete_partner_member.js.erb @@ -0,0 +1 @@ +$("#partner_member_list").html("<%= j(render :partial => "partner_member_list", :locals => {partner: @partner}) %>") \ No newline at end of file diff --git a/app/views/managements/partners.html.erb b/app/views/managements/partners.html.erb new file mode 100644 index 00000000..ad3af6df --- /dev/null +++ b/app/views/managements/partners.html.erb @@ -0,0 +1,32 @@ +
    +
    + + 搜索 + 清除 +
    +
    +
    + <%= link_to "+添加",all_partners_managements_path,remote:true,class:"color-blue addOperation" %> +
      + <%= render :partial => "partner_list" %> +
    +
    + +
    + <%= render :partial => "partner_main_div" %> +
    + +
    +
    + \ No newline at end of file diff --git a/app/views/managements/partners.js.erb b/app/views/managements/partners.js.erb new file mode 100644 index 00000000..0906f4e6 --- /dev/null +++ b/app/views/managements/partners.js.erb @@ -0,0 +1,2 @@ +$("#partner_list").html("<%= j(render :partial => "partner_list") %>"); +$("#partner_main_div").html("<%= j(render :partial => "partner_main_div") %>"); \ No newline at end of file diff --git a/app/views/managements/shixun_feedback_message.html.erb b/app/views/managements/shixun_feedback_message.html.erb index c987f283..ff4ecebe 100644 --- a/app/views/managements/shixun_feedback_message.html.erb +++ b/app/views/managements/shixun_feedback_message.html.erb @@ -2,11 +2,17 @@ <%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %> <% end %>
    @@ -17,4 +23,16 @@ function clearSearchCondition(){ $("#shixun_Look_name").val('') } + $("input[name='beginTime']").datetimepicker({ + allowBlank:true, + lang:'ch', + format:'Y-m-d H:i', + validateOnBlur:false + }); + $("input[name='endTime']").datetimepicker({ + allowBlank:true, + lang:'ch', + format:'Y-m-d H:i', + validateOnBlur:false + }); \ No newline at end of file diff --git a/app/views/managements/shixun_feedback_message.js.erb b/app/views/managements/shixun_feedback_message.js.erb index 135f4107..89ead852 100644 --- a/app/views/managements/shixun_feedback_message.js.erb +++ b/app/views/managements/shixun_feedback_message.js.erb @@ -1,2 +1,2 @@ $("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>"); -$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>") \ No newline at end of file +$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :beginTime => @beginTime, :endTime => @endTime,:format => "xls") %>") \ No newline at end of file diff --git a/app/views/managements/users_list.html.erb b/app/views/managements/users_list.html.erb deleted file mode 100644 index f990cca8..00000000 --- a/app/views/managements/users_list.html.erb +++ /dev/null @@ -1,86 +0,0 @@ -
    -
    -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - - -
    - -
    - - <%= @obj_count %> - 个检索结果(<%= @major_count %> 单位) - -
    - - -
    -
    - -
    - <%= render :partial => "department_list" %> -
    -
    - -
    - - \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 051ed500..3acb9123 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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] @@ -544,6 +553,13 @@ RedmineApp::Application.routes.draw do ## oauth相关 match 'classroom', :via => [:get, :post] post 'import_departments' match 'departments', :via => [:get, :post] + get 'partners' + get 'add_partner_member_box' + post 'add_partner_member' + delete 'delete_partner_member' + get 'get_partner' + get 'all_partners' + post 'add_partner' delete 'delete_depart_member' get 'add_depart_member_box' post 'add_depart_member' @@ -696,6 +712,9 @@ RedmineApp::Application.routes.draw do ## oauth相关 post 'rename_subject_level' post 'delete_subject_level' post 'update_level_for_subject' + post :add_customers + delete :delete_customers + get :customers_list end end # Enable Grack support diff --git a/db/migrate/20190403085155_create_partners.rb b/db/migrate/20190403085155_create_partners.rb new file mode 100644 index 00000000..17516692 --- /dev/null +++ b/db/migrate/20190403085155_create_partners.rb @@ -0,0 +1,9 @@ +class CreatePartners < ActiveRecord::Migration + def change + create_table :partners do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20190403085807_create_customers.rb b/db/migrate/20190403085807_create_customers.rb new file mode 100644 index 00000000..51460758 --- /dev/null +++ b/db/migrate/20190403085807_create_customers.rb @@ -0,0 +1,10 @@ +class CreateCustomers < ActiveRecord::Migration + def change + create_table :customers do |t| + t.references :partner + + t.timestamps + end + add_index :customers, :partner_id + end +end diff --git a/db/migrate/20190403091639_add_partner_id_and_customer_id_to_schools.rb b/db/migrate/20190403091639_add_partner_id_and_customer_id_to_schools.rb new file mode 100644 index 00000000..1633f149 --- /dev/null +++ b/db/migrate/20190403091639_add_partner_id_and_customer_id_to_schools.rb @@ -0,0 +1,8 @@ +class AddPartnerIdAndCustomerIdToSchools < ActiveRecord::Migration + def change + add_column :schools, :partner_id, :integer + add_index :schools, :partner_id + add_column :schools, :customer_id, :integer + add_index :schools, :customer_id + end +end diff --git a/db/migrate/20190403092802_add_partner_id_to_users.rb b/db/migrate/20190403092802_add_partner_id_to_users.rb new file mode 100644 index 00000000..22a5d101 --- /dev/null +++ b/db/migrate/20190403092802_add_partner_id_to_users.rb @@ -0,0 +1,6 @@ +class AddPartnerIdToUsers < ActiveRecord::Migration + def change + add_column :users, :partner_id, :integer + add_index :users, :partner_id + end +end diff --git a/lib/dalli-2.7.2/.rakeTasks b/lib/dalli-2.7.2/.rakeTasks index b6b932e2..c6865d9a 100644 --- a/lib/dalli-2.7.2/.rakeTasks +++ b/lib/dalli-2.7.2/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/lib/gitlab-cli/.rakeTasks b/lib/gitlab-cli/.rakeTasks index afa9557a..f349995e 100644 --- a/lib/gitlab-cli/.rakeTasks +++ b/lib/gitlab-cli/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/lib/grack/.rakeTasks b/lib/grack/.rakeTasks index 6be95750..c6865d9a 100644 --- a/lib/grack/.rakeTasks +++ b/lib/grack/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/lib/grape-swagger-0.25.3/.rakeTasks b/lib/grape-swagger-0.25.3/.rakeTasks index 6be95750..c6865d9a 100644 --- a/lib/grape-swagger-0.25.3/.rakeTasks +++ b/lib/grape-swagger-0.25.3/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/lib/plugins/acts-as-taggable-on/.rakeTasks b/lib/plugins/acts-as-taggable-on/.rakeTasks index 6be95750..c6865d9a 100644 --- a/lib/plugins/acts-as-taggable-on/.rakeTasks +++ b/lib/plugins/acts-as-taggable-on/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/lib/rails_kindeditor/.rakeTasks b/lib/rails_kindeditor/.rakeTasks index 6be95750..c6865d9a 100644 --- a/lib/rails_kindeditor/.rakeTasks +++ b/lib/rails_kindeditor/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/lib/wechat/.rakeTasks b/lib/wechat/.rakeTasks index 6be95750..c6865d9a 100644 --- a/lib/wechat/.rakeTasks +++ b/lib/wechat/.rakeTasks @@ -1,7 +1,7 @@ - + +--> diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 9a18a93a..449a1bcd 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -2984,9 +2984,10 @@ a.singlepublishtwo{ } .partnerList{max-height: 500px;overflow-y: auto;} .manageList{float: left} -.manageList li{width: 60px;height: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;} -.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;float: left;margin-right: 10px;border-radius: 50%;} +.manageList li{width: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;} +.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;margin-right: 10px;border-radius: 50%;display: block} .addManage{display: block;background: #cdcdcd;color: #fff!important;font-size: 55px;} +.managementName{display: block;width: 60px;color: #666;} .removeImg{position: absolute;right: 1px;top: -12px;} .tableList .tableHead{background: #fafafa} .tableList{min-height: 400px;} @@ -3133,40 +3134,40 @@ line-height: 20px;display: inline-block;color: rgba(65, 140, 205, 1) !important; width: calc( 100% ) } #requireTable thead .td-head-child:last-child{border-right: none;} - - -/*用户列表*/ -.managerPanels a{margin-right:24px;} -.managerPanels a:nth-child(16n){margin-right: 0px;} -.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;} -.managerPanels a:hover span{color: #4cacff!important;} -.userimg{position: absolute;top: -16px;right: -5px;} -.useradd{font-size: 42px !important; position: absolute; top: -16px;} -.ListTableLines .column-2{ - width: 150px; - text-align: center; - padding-left: 5px; - box-sizing: border-box; - color:#999999; -} -.ListTableLines .column-No{ - color:#999999; -} -.courselist .column-2{ - width: 150px; - text-align: center; - padding-left: 5px; - box-sizing: border-box; - color:#656565; -} -.courselist .column-No{ - color:#999999; -} -.poll_list a { - display: inline-block; - padding: 20px; - font-size: 18px; - text-align: center; - position: relative; - color: #05101a; + + +/*用户列表*/ +.managerPanels a{margin-right:24px;} +.managerPanels a:nth-child(16n){margin-right: 0px;} +.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;} +.managerPanels a:hover span{color: #4cacff!important;} +.userimg{position: absolute;top: -16px;right: -5px;} +.useradd{font-size: 42px !important; position: absolute; top: -16px;} +.ListTableLines .column-2{ + width: 150px; + text-align: center; + padding-left: 5px; + box-sizing: border-box; + color:#999999; +} +.ListTableLines .column-No{ + color:#999999; +} +.courselist .column-2{ + width: 150px; + text-align: center; + padding-left: 5px; + box-sizing: border-box; + color:#656565; +} +.courselist .column-No{ + color:#999999; +} +.poll_list a { + display: inline-block; + padding: 20px; + font-size: 18px; + text-align: center; + position: relative; + color: #05101a; } \ No newline at end of file