dev_aliyun
hjm 5 years ago
commit f8c5a67396

@ -140,7 +140,6 @@ module Mobile
# #
Rails.logger.info("########### host is #{request.host}") Rails.logger.info("########### host is #{request.host}")
if (Rails.env.development? && session[:user_id].blank?) || if (Rails.env.development? && session[:user_id].blank?) ||
(session[:user_id].blank? && request.host.include?("testbdweb")) ||
params[:action] == "privateGit" params[:action] == "privateGit"
session[:user_id] = 12 #116 session[:user_id] = 12 #116
end end

@ -29,6 +29,15 @@ module Mobile
requires :id, type: Integer, desc: "帖子ID" requires :id, type: Integer, desc: "帖子ID"
end end
get ':id' do get ':id' do
# 记录用户流量源
if params[:edu]
Rails.logger.info("####11111222##{@env['HTTP_X_REAL_IP']}")
ip = @env['HTTP_X_REAL_IP']
ua = UserAgent.find_by_ip(ip)
if ua.blank?
UserAgent.create!(:key => params[:edu].strip, :ip => ip, :agent_type => UserAgent::USER_AD)
end
end
MemosService.new.show params, current_user MemosService.new.show params, current_user
end end

@ -17,8 +17,8 @@ module Mobile
expose :bidding_users_count, if: { type: :index } expose :bidding_users_count, if: { type: :index }
expose :min_price expose :min_price
expose :max_price expose :max_price
expose :contact_name, if: ->(package, opts){ opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business? } expose :contact_name, if: ->(package, opts){ opts[:user].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) }
expose :contact_phone, if: ->(package, opts){ opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business? } expose :contact_phone, if: ->(package, opts){ opts[:user].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) }
expose :updated_at do |package, _| expose :updated_at do |package, _|
package.updated_at.strftime('%Y-%m-%d %H:%M:%S') package.updated_at.strftime('%Y-%m-%d %H:%M:%S')
@ -65,6 +65,7 @@ module Mobile
expose :operation, if: { type: :show } do |package, opts| expose :operation, if: { type: :show } do |package, opts|
user = opts[:user] user = opts[:user]
return {} if user.blank?
is_creator = user.id == package.creator_id is_creator = user.id == package.creator_id
is_admin = user.admin? || user.business? is_admin = user.admin? || user.business?

@ -377,36 +377,10 @@ class AccountController < ApplicationController
else else
us = UsersService.new us = UsersService.new
@user = us.register user_params.merge(:should_confirmation_password => false) @user = us.register user_params.merge(:should_confirmation_password => false)
=begin # 注册时,记录是否是引流用户
case Setting.self_registration ip = request.remote_ip
when '1' ua = UserAgent.find_by_ip(ip)
#register_by_email_activation(@user) ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua
unless @user.new_record?
# if params[:user][:phone] =~ /^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
# redirect_to account_email_valid_path(:mail => @user.mail, :user_id => @user.id)
# else
self.logged_user = @user
redirect_to user_info_path()
# end
# flash[:notice] = l(:notice_account_register_done)
# render action: 'email_valid', locals: {:mail => @user.mail}
end
when '3'
#register_automatically(@user)
if !@user.new_record?
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)
redirect_to user_info_path()
else
redirect_to signin_path
end
else
#register_manually_by_administrator(@user)
unless @user.new_record?
account_pending
end
end
=end
if !@user.new_record? if !@user.new_record?
self.logged_user = @user self.logged_user = @user
flash[:notice] = l(:notice_account_activated) flash[:notice] = l(:notice_account_activated)

@ -359,6 +359,7 @@ class AttachmentsController < ApplicationController
saved = @attachment.save saved = @attachment.save
respond_to do |format| respond_to do |format|
format.js format.js
format.json { render json: { attachment_id: @attachment.id, url: download_attachment_path(@attachment.id) } }
format.api { format.api {
if saved if saved
render :action => 'upload', :status => :created render :action => 'upload', :status => :created

@ -67,12 +67,12 @@ class CollegesController < ApplicationController
user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count) user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count)
@teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count, @teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count,
(SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=users.id AND c.is_delete = 0) as course_count (SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=users.id AND c.is_delete = 0) as course_count
FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
# ).order("publish_shixun_count desc, experience desc").limit(10) # ).order("publish_shixun_count desc, experience desc").limit(10)
@teachers = @teachers =
@teachers.map do |teacher| @teachers.map do |teacher|
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{teacher.id} AND c.is_delete = 0") course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}")
course_count = course_ids.size course_count = course_ids.size
homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id))
un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count

@ -51,7 +51,7 @@ class CompetitionTeamsController < ApplicationController
end end
condition = "%#{params[:search].strip}%".gsub(" ","") 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") @teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0").limit(20)
end end
def search_non_user def search_non_user
@ -71,7 +71,7 @@ class CompetitionTeamsController < ApplicationController
end end
user_ids = user_ids.length > 0 ? "(" + user_ids.uniq.join(',') + ")" : "(-1)" user_ids = user_ids.length > 0 ? "(" + user_ids.uniq.join(',') + ")" : "(-1)"
condition = "%#{params[:search].strip}%".gsub(" ","") condition = "%#{params[:search].strip}%".gsub(" ","")
@users = User.joins(:user_extensions).where("users.id not in #{user_ids} and status = 1 and user_extensions.identity = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}'") @users = User.joins(:user_extensions).where("users.id not in #{user_ids} and status = 1 and user_extensions.identity = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}'").limit(20)
end end
def create def create
@ -113,6 +113,8 @@ class CompetitionTeamsController < ApplicationController
next if user_id.to_i == User.current.id next if user_id.to_i == User.current.id
new_team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: 1) new_team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: 1)
end end
# 创建时,记录是否是引流用户
record_agent_user_action
end end
end end
@ -227,6 +229,8 @@ class CompetitionTeamsController < ApplicationController
team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id) team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id)
end end
# 记录引流
record_agent_user_action
end end
# 退出战队 非创建者直接退出,创建者退出则解散团队 # 退出战队 非创建者直接退出,创建者退出则解散团队
@ -341,4 +345,11 @@ class CompetitionTeamsController < ApplicationController
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('shixun_id').count .group('shixun_id').count
end end
def record_agent_user_action
# 记录是否是引流用户的行为
ip = request.remote_ip
ua = UserAgent.find_by_ip(ip)
ua.update_column(:agent_type, UserAgent::USER_COMPETITION) if ua
end
end end

@ -1,5 +1,5 @@
class EcsController < ApplicationController class EcsController < ApplicationController
before_filter :require_login before_filter :require_login, :except => [:get_navigation_url]
before_filter :find_school, :except => [:get_navigation_url] before_filter :find_school, :except => [:get_navigation_url]
before_filter :school_manager, :except => [:department, :get_navigation_url] before_filter :school_manager, :except => [:department, :get_navigation_url]
layout 'base_ec' layout 'base_ec'
@ -60,7 +60,7 @@ class EcsController < ApplicationController
def get_navigation_url def get_navigation_url
ec_user = EcSchoolUser.where(:user_id => User.current.id).first ec_user = EcSchoolUser.where(:user_id => User.current.id).first
ec_url = "#{department_ecs_path(:school_id => ec_user.school_id)}" if ec_user ec_url = "#{department_ecs_path(:school_id => ec_user.school_id)}" if ec_user
render :json => {ec_url: ec_url} render :json => {ec_url: ec_url, project_packages_url: "/crowdsourcing" }
end end

@ -8,17 +8,22 @@ class LibrariesController < ApplicationController
libraries = Library.where(nil) libraries = Library.where(nil)
libraries = libraries =
if params[:type] == 'mine' if User.current.logged? && params[:type] == 'mine'
libraries.where(user_id: current_user.id).order('created_at desc') libraries.where(user_id: current_user.id).order('created_at desc')
else else
libraries.where(status: :published).order('visited_count desc') libraries.where(status: :published).order('visited_count desc')
end end
search = params[:search].to_s.strip search = params[:search].to_s.strip
libraries = libraries.where('title LIKE :search OR uuid LIKE :search', search: "%#{search}%") if search.present? if search.present?
libraries = libraries.where('title LIKE :search OR author_name LIKE :search OR author_school_name LIKE :search',
search: "%#{search}%")
end
per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i
@libraries = paginateHelper libraries.includes(user: :user_extensions), per_page @libraries = paginateHelper libraries.includes(:library_tags, :praise_tread_cache, user: :user_extensions), per_page
@download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).count
end end
def show def show
@ -44,7 +49,7 @@ class LibrariesController < ApplicationController
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
flash[:message] = e.record.errors.full_messages.join(',') flash[:message] = e.record.errors.full_messages.join(',')
render 'new' render 'new'
rescue Libraries::SubmitService::Error => ex rescue Libraries::SubmitService::Error, Libraries::SaveService::Error => ex
flash[:message] = ex.message flash[:message] = ex.message
render 'new' render 'new'
end end
@ -68,7 +73,7 @@ class LibrariesController < ApplicationController
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
flash[:message] = e.record.errors.full_messages.join(',') flash[:message] = e.record.errors.full_messages.join(',')
render 'edit' render 'edit'
rescue Libraries::SubmitService::Error => ex rescue Libraries::SubmitService::Error, Libraries::SaveService::Error => ex
flash[:message] = ex.message flash[:message] = ex.message
render 'edit' render 'edit'
end end
@ -112,6 +117,7 @@ class LibrariesController < ApplicationController
hash = params[:library].presence || {} hash = params[:library].presence || {}
hash[:tag_ids] = params[:tag_ids].to_s.split(',') hash[:tag_ids] = params[:tag_ids].to_s.split(',')
hash[:attachment_ids] = (params[:attachments].presence || []).values.map{|h| h[:attachment_id]} hash[:attachment_ids] = (params[:attachments].presence || []).values.map{|h| h[:attachment_id]}
hash[:cover_id] = save_cover.try(:id) || hash[:cover_id]
hash hash
end end
end end
@ -127,4 +133,14 @@ class LibrariesController < ApplicationController
def increment_visit_count def increment_visit_count
@library.increment_visited_count! if @library && @library.id @library.increment_visited_count! if @library && @library.id
end end
def save_cover
return if params[:cover_file].blank?
attachment = Attachment.new(file: params[:cover_file])
attachment.author = User.current
attachment.filename = Redmine::Utils.random_hex(16)
attachment.save
attachment
end
end end

@ -28,6 +28,15 @@ class ManagementsController < ApplicationController
render :json => {status: 1} render :json => {status: 1}
end end
def user_agents
@user_agents = UserAgent.where("user_agents.key is not null")
@agents_count = @user_agents.count
limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
@offset ||= @agents_pages.offset
@user_agents = paginateHelper @user_agents, limit
end
# 实训课程等级体系 # 实训课程等级体系
def subject_level_system def subject_level_system
@levels = SubjectLevelSystem.all @levels = SubjectLevelSystem.all
@ -4437,21 +4446,24 @@ end
end end
end end
if competition.max_num > 1 if competition.max_num > 1
sheet1.row(0).concat(["序号", "战队ID", "战队名称","指导老师", "队员姓名", "学号", "实名认证", "职业认证", "学校名称", "地区", "报名时间", "排名"]) sheet1.row(0).concat(["序号", "战队ID", "战队名称", "战队创建者", "指导老师", "队员姓名", "手机号", "邮箱", "学号", "实名认证", "职业认证", "学校名称", "地区", "报名时间", "排名"])
members.each_with_index do |member, index| members.each_with_index do |member, index|
member_user = member.user member_user = member.user
sheet1[count_row,0] = index + 1 sheet1[count_row,0] = index + 1
sheet1[count_row,1] = member.competition_team.try(:id) sheet1[count_row,1] = member.competition_team.try(:id)
sheet1[count_row,2] = member.competition_team.try(:name) sheet1[count_row,2] = member.competition_team.try(:name)
sheet1[count_row,3] = member.competition_team.teacher.try(:show_real_name) sheet1[count_row,3] = member.competition_team.user.try(:show_real_name)
sheet1[count_row,4] = member_user.try(:show_real_name) sheet1[count_row,4] = member.competition_team.teacher.try(:show_real_name)
sheet1[count_row,5] = member_user.try(:student_id) sheet1[count_row,5] = member_user.try(:show_real_name)
sheet1[count_row,6] = member_user.try(:authentication_status) sheet1[count_row,6] = member_user.try(:phone)
sheet1[count_row,7] = member_user.try(:professional_status) sheet1[count_row,7] = member_user.try(:mail)
sheet1[count_row,8] = member_user.try(:school_name) sheet1[count_row,8] = member_user.try(:student_id)
sheet1[count_row,9] = member_user.user_extensions.school.try(:province) sheet1[count_row,9] = member_user.try(:authentication_status)
sheet1[count_row,10] = format_time member.created_at sheet1[count_row,10] = member_user.try(:professional_status)
sheet1[count_row,11] = records.present? ? (records.map(&:id).index(member.competition_team_id).to_i + 1) : "--" sheet1[count_row,11] = member_user.try(:school_name)
sheet1[count_row,12] = member_user.user_extensions.school.try(:province)
sheet1[count_row,13] = format_time member.created_at
sheet1[count_row,14] = records.present? ? (records.map(&:id).index(member.competition_team_id).to_i + 1) : "--"
count_row += 1 count_row += 1
end end
else else

@ -47,6 +47,7 @@ class PraiseTreadController < ApplicationController
end end
respond_to do |format| respond_to do |format|
format.js format.js
format.json { render_api_ok }
end end
end end
end end
@ -85,6 +86,7 @@ class PraiseTreadController < ApplicationController
#@obj = User.find_by_id(@obj) #@obj = User.find_by_id(@obj)
respond_to do |format| respond_to do |format|
format.js format.js
format.json { render_api_ok }
end end
end end
@ -177,6 +179,8 @@ class PraiseTreadController < ApplicationController
@obj = Challenge.find_by_id(id) @obj = Challenge.find_by_id(id)
when 'Discuss' when 'Discuss'
@obj = Discuss.find_by_id(id) @obj = Discuss.find_by_id(id)
when 'Library'
@obj = Library.find_by_id(id)
else else
@obj = nil @obj = nil
end end

@ -1,7 +1,7 @@
# encoding=utf-8 # encoding=utf-8
# For react # For react
class ProjectPackagesController < ApplicationController class ProjectPackagesController < ApplicationController
before_filter :require_login, :except => [:index] before_filter :require_login, :except => [:index, :show]
include ApplicationHelper include ApplicationHelper

@ -14,4 +14,13 @@ module CollegesHelper
end end
type type
end end
def course_managers teachers
str = ""
teachers.each_with_index do |teacher, index|
str += "" if index > 0
str += teacher.user.try(:show_real_name)
end
str
end
end end

@ -1,8 +1,9 @@
module LibrariesHelper module LibrariesHelper
def show_library_tags(library) def show_library_tags(library, opts = {})
html = '' html = ''
library.library_tags.each do |tag| library.library_tags.each do |tag|
html += content_tag(:span, tag.name, class: "edu-filter-btn fl cdefault mt3 ml10 #{library_tag_class(tag)}") klass = "edu-filter-btn fl cdefault #{library_tag_class(tag)} #{opts[:class]}"
html += content_tag(:span, tag.name, class: klass)
end end
raw html raw html

@ -2,17 +2,22 @@ class Library < ActiveRecord::Base
include AASM include AASM
belongs_to :user belongs_to :user
belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id
has_many :library_applies, dependent: :delete_all has_many :library_applies, dependent: :delete_all
has_many :attachments, as: :container has_many :attachments, as: :container
has_many :library_library_tags, dependent: :delete_all has_many :library_library_tags, dependent: :delete_all
has_many :library_tags, through: :library_library_tags has_many :library_tags, through: :library_library_tags
attr_accessible :title, :content has_one :praise_tread_cache, as: :object
validates :title, presence: true attr_accessible :title, :content, :author_name, :author_school_name, :cover_id
validates :title, presence: true, length: { maximum: 255 }
validates :content, presence: true validates :content, presence: true
validates :uuid, presence: true, uniqueness: true validates :uuid, presence: true, uniqueness: true
validates :author_name, presence: true, length: { maximum: 10 }
validates :author_school_name, presence: true, length: { maximum: 50 }
acts_as_attachable acts_as_attachable
@ -44,7 +49,13 @@ class Library < ActiveRecord::Base
self.uuid = uuid self.uuid = uuid
end end
def increment_visited_count! def increment_visited_count!(num = 1)
Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}") increment_column!(:visited_count, num)
end
private
def increment_column!(column, num = 1)
self.class.connection.execute("update #{self.class.table_name} set #{column} = COALESCE(#{column}, 0) + #{num} where id = #{id}")
end end
end end

@ -0,0 +1,6 @@
class UserAgent < ActiveRecord::Base
USER_AD = 1 # 广告宣传的引流
USER_REGISTER = 2 # 引流注册
USER_COMPETITION = 3 # 引流参加竞赛
end

@ -30,14 +30,15 @@ class DiscussesService
memo_count = memos.count memo_count = memos.count
memos = memos.offset(offset).limit(15) memos = memos.offset(offset).limit(15)
#实训标签使用最多的9个 #实训标签使用最多的9个
hot_tags = TagRepertoire.find_by_sql("select a.name, sum(a.cnt) cnt, a.id from # hot_tags = TagRepertoire.find_by_sql("select a.name, sum(a.cnt) cnt, a.id from
(select tr.id, tr.name, count(d.dis_id) cnt, d.root_id, s.status, s.hidden # (select tr.id, tr.name, count(d.dis_id) cnt, d.root_id, s.status, s.hidden
from tag_repertoires tr join (shixun_tag_repertoires str # from tag_repertoires tr join (shixun_tag_repertoires str
left join (shixuns s join discusses d on d.dis_id = s.id and d.root_id is null and s.status =2 and s.hidden=false) # left join (shixuns s join discusses d on d.dis_id = s.id and d.root_id is null and s.status =2 and s.hidden=false)
on s.id = str.shixun_id) on tr.id = str.tag_repertoire_id # on s.id = str.shixun_id) on tr.id = str.tag_repertoire_id
group by d.dis_id order by cnt desc) a group by a.name # group by d.dis_id order by cnt desc) a group by a.name
order by cnt desc limit 9").map{|ht| ht.attributes.dup} # order by cnt desc limit 9").map{|ht| ht.attributes.dup}
tag_id = ShixunTagRepertoire.joins(:shixun).order("myshixuns_count desc").pluck(:tag_repertoire_id).uniq.first(9)
hot_tags = TagRepertoire.select([:id, :name]).where(:id => tag_id).order("FIELD(id, #{tag_id.join(",")})").map{|ht| ht.attributes.dup} if tag_id
memos = memo_list memos memos = memo_list memos
user_info = format_for_current_user current_user user_info = format_for_current_user current_user
hot_memos = Memo.field_for_recommend.posts.hot.limit(4) hot_memos = Memo.field_for_recommend.posts.hot.limit(4)

@ -23,20 +23,10 @@ class Libraries::SaveService
library.assign_attributes(params) library.assign_attributes(params)
library.save! library.save!
new_tag_ids = LibraryTag.where(id: params[:tag_ids].presence || []).pluck(:id) deal_library_tag!
old_tag_ids = library.library_library_tags.pluck(:library_tag_id)
# 删除标签 Attachment.where(id: attachment_ids, author_id: user.id)
destroy_ids = old_tag_ids - new_tag_ids .update_all(container_id: library.id, container_type: 'Library')
library.library_library_tags.where(library_tag_id: destroy_ids).delete_all
# 创建标签
created_ids = new_tag_ids - old_tag_ids
created_ids.each do |id|
library.library_library_tags.create!(library_tag_id: id)
end
Attachment.where(id: attachment_ids).update_all(container_id: library.id, container_type: 'Library')
end end
library library
@ -46,5 +36,21 @@ class Libraries::SaveService
def validate_params! def validate_params!
raise Error, '附件不能为空' if params[:attachment_ids].try(:compact).blank? raise Error, '附件不能为空' if params[:attachment_ids].try(:compact).blank?
# raise Error , '封面不能为空' if params[:cover_id].blank?
end
def deal_library_tag!
new_tag_ids = LibraryTag.where(id: params[:tag_ids].presence || []).pluck(:id)
old_tag_ids = library.library_library_tags.pluck(:library_tag_id)
# 删除标签
destroy_ids = old_tag_ids - new_tag_ids
library.library_library_tags.where(library_tag_id: destroy_ids).delete_all
# 创建标签
created_ids = new_tag_ids - old_tag_ids
created_ids.each do |id|
library.library_library_tags.create!(library_tag_id: id)
end
end end
end end

@ -2,7 +2,7 @@
<table class="edu-pop-table head-color bor-top-greyE" cellspacing="0" cellpadding="0"> <table class="edu-pop-table head-color bor-top-greyE" cellspacing="0" cellpadding="0">
<thead> <thead>
<th width="20%" class="pl20 edu-txt-left">名称</th> <th width="20%" class="pl20 edu-txt-left">名称</th>
<th class="pl20 edu-txt-left">创建教师</th> <th class="pl20 edu-txt-left">管理教师</th>
<th>评测次数</th> <th>评测次数</th>
<th>学生</th> <th>学生</th>
<th>实训作业</th> <th>实训作业</th>
@ -16,7 +16,9 @@
<% @courses.each do |course| %> <% @courses.each do |course| %>
<tr> <tr>
<td><a href="<%= course_path(course) %>" target="_blank" class="task-hide pl20 edu-txt-left" style="max-width: 220px"><%= course.name %></a></td> <td><a href="<%= course_path(course) %>" target="_blank" class="task-hide pl20 edu-txt-left" style="max-width: 220px"><%= course.name %></a></td>
<td><a href="<%= user_path(course.tea_id) %>" class="pl20 edu-txt-left" target="_blank"><%= course.username %></a></td> <td class="task-hide" style="max-width: 220px" title="<%= course_managers course.teachers %>">
<%= course_managers course.teachers %>
</td>
<td class="edu-txt-center"><%= course.evaluating_count %></td> <td class="edu-txt-center"><%= course.evaluating_count %></td>
<td class="edu-txt-center"><%= course.student_count.to_i %></td> <td class="edu-txt-center"><%= course.student_count.to_i %></td>
<td class="edu-txt-center"><%= course.hcm_count.to_i %></td> <td class="edu-txt-center"><%= course.hcm_count.to_i %></td>

@ -100,7 +100,12 @@
<div class="fl width40"> <div class="fl width40">
<div class="online_status static_shadow"> <div class="online_status static_shadow">
<p class="font-24 padding30-20">在线实训情况</p> <p class="font-24 padding30-20">在线实训情况</p>
<div id="pieChart" style="height: 440px;width: 480px;"></div> <% if @shixun_tags_name.size == 0 %>
<%= render :partial => 'welcome/no_data' %>
<div id="pieChart"></div>
<% else %>
<div id="pieChart" style="height: 440px;width: 480px;"></div>
<% end %>
</div> </div>
</div> </div>
</div> </div>

@ -0,0 +1,42 @@
<style>
/*//登录弹窗*/
.newLogipopup{
height: 100%;
width: 100%;
background-size: 100% 100%;
position: fixed;
bottom: 0px;
right: 0px;
}
</style>
<div class="educontent newLogipopup" id="backImg" >
<div class="pr edu-txt-center height-100 pt110">
<div class="login_reg pr login_regs">
<div style="position: relative;">
<a href="javascript:void(0)" onclick="competitionfun();" id="closeIcon" style="position: absolute;right: -20px;top: 36px;">
<i class="iconfont icon-shanchudiao"></i>
</a>
<img src="/images/educoder/competitionslog.png" height="580px" width="637px" />
<a style="position: absolute;left:42%; bottom:18px;" onclick="setcompetitionfun();" >
<img height="40px" width="150px" src="/images/educoder/applys.png" />
</a>
</div>
</div>
</div>
</div>
<script>
function competitionfun(){
localStorage.setItem('competition_uid', true);
hideModal();
}
function setcompetitionfun(){
competitionfun();
window.location.href="/competitions"
}
</script>

@ -64,11 +64,30 @@
<div class="nav-border"><p id="nav-white"></p></div> <div class="nav-border"><p id="nav-white"></p></div>
</ul> </ul>
<% if User.current.logged? %> <div class="fr edu-menu-panel ml15" style="height:60px;">
<% if User.current.logged? %>
<%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fr mt15 ml40" %> <%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fr mt15 ml40" %>
<% else %> <ul class="edu-menu-list edu-menu-lists" style="top:60px;">
<span class="bor-bottom-greyE currentName task-hide"><%= User.current.show_name %></span>
<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><%= link_to '我的众包', user_path(User.current, :type => 'a_package') %></li>
<% if User.current.department_members.count > 0 %>
<li><%= link_to '学院统计', statistics_college_path(User.current.department_members.first.try(:department)) %></li>
<% end %>
<li><%= link_to '账号管理', my_account_path %></li>
<li class="bor-top-greyE"><%= link_to '退出', signout_path %></li>
</ul>
<% else %>
<span class="fr font-16 color-white mt13 ml40"><a href="<%= signin_path %>" class="color-white mr3">登录</a>/<a href="<%= user_join_path %>" class="color-white ml3">注册</a></span> <span class="fr font-16 color-white mt13 ml40"><a href="<%= signin_path %>" class="color-white mr3">登录</a>/<a href="<%= user_join_path %>" class="color-white ml3">注册</a></span>
<% end %> <% end %>
</div>
</div> </div>
</div> </div>
<script> <script>

@ -19,10 +19,10 @@
<% team.teachers.each do |teacher| %> <% team.teachers.each do |teacher| %>
<%= link_to image_tag(url_to_avatar(teacher.user), width: 26, height: 26, class: 'radius fl mr4'), user_path(teacher.user), class: 'fl', target: '_blank', data: { 'tip-down' => "指导老师:#{teacher.user.show_name}" } %> <%= link_to image_tag(url_to_avatar(teacher.user), width: 26, height: 26, class: 'radius fl mr4'), user_path(teacher.user), class: 'fl', target: '_blank', data: { 'tip-down' => "指导老师:#{teacher.user.show_name}" } %>
<% end %> <% end %>
<% team.members.each do |member| %> <% team.members[0, 8].each do |member| %>
<%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr4 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr4 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %>
<% end %> <% end %>
<% if team.members.size > 9 %> <% if team.members.size > 8 %>
<span class="team-p-s mt3">...</span> <span class="team-p-s mt3">...</span>
<% end %> <% end %>
</span> </span>

@ -76,10 +76,10 @@
<% if team.teacher_id.present? %> <% if team.teacher_id.present? %>
<a href="<%= user_path(team.teacher) %>" class="fl" target="_blank" data-tip-down="指导老师:<%= team.teacher.show_name %>"><%= image_tag(url_to_avatar(team.teacher), :width => "26", :height => "26", :class => "radius fl mr4") %></a> <a href="<%= user_path(team.teacher) %>" class="fl" target="_blank" data-tip-down="指导老师:<%= team.teacher.show_name %>"><%= image_tag(url_to_avatar(team.teacher), :width => "26", :height => "26", :class => "radius fl mr4") %></a>
<% end %> <% end %>
<% team.team_members.where("user_id != #{team.teacher_id.present? ? team.teacher_id : '-1'}")[0, 9].each do |member| %> <% team.team_members.where("user_id != #{team.teacher_id.present? ? team.teacher_id : '-1'}")[0, 8].each do |member| %>
<%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr5 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr5 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %>
<% end %> <% end %>
<% if team.team_members.size > 9 %> <% if team.team_members.size > 8 %>
<label class="mt5 team-p-s mt3">...</label> <label class="mt5 team-p-s mt3">...</label>
<% end %> <% end %>
</span> </span>

@ -18,8 +18,12 @@
</ul> </ul>
</li> </li>
<% end %> <% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>">
<%= link_to "在线竞赛", competitions_path %>
<img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>
</li>
<li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li> <li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li>
<li class="<%= params[:controller] == "project_packages" ? " active" : "" %>"><%= link_to "众包创新", project_packages_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li> <li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<% if User.current.ec_school.present? %> <% if User.current.ec_school.present? %>
<li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" id="ec_banner"> <li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" id="ec_banner">
@ -125,6 +129,20 @@
<% end %> <% end %>
<% end %> <% end %>
var begin_time = new Date();
var end_time = new Date("2019-10-10");
if (begin_time < end_time) {
if (window.localStorage) {
var uid = localStorage.getItem('competition_uid');
} else {
var uid = false
}
if (!uid) {
var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>";
pop_box_new(htmlvalue, 500, 380);
}
}
<% notice = SystemUpdateNotice.last %> <% notice = SystemUpdateNotice.last %>
<% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %> <% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %>

@ -19,8 +19,12 @@
</ul> </ul>
</li> </li>
<% end %> <% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>">
<%= link_to "在线竞赛", competitions_path %>
<img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>
</li>
<li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li> <li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li>
<li class="<%= params[:controller] == "project_packages" ? " active" : "" %>"><%= link_to "众包创新", project_packages_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li> <li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>--> <!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul> </ul>
@ -89,4 +93,17 @@
var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft); var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
document.getElementById('nHeader').style.left=sl+'px'; document.getElementById('nHeader').style.left=sl+'px';
}; };
$(function() {
if (window.localStorage) {
var uid = localStorage.getItem('competition_uid');
} else {
var uid = false
}
if(!uid){
var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>";
pop_box_new(htmlvalue, 500, 380);
}
})
</script> </script>

@ -145,6 +145,7 @@
<li style="width: 120px"><%= link_to "升级通知", update_notice_managements_path %></li> <li style="width: 120px"><%= link_to "升级通知", update_notice_managements_path %></li>
<li style="width: 120px"><%= link_to "门户banner设置", setting_banner_managements_path %></li> <li style="width: 120px"><%= link_to "门户banner设置", setting_banner_managements_path %></li>
<li style="width: 120px"><%= link_to "培训会", training_2018_managements_path %></li> <li style="width: 120px"><%= link_to "培训会", training_2018_managements_path %></li>
<li style="width: 120px"><%= link_to "引流情况", user_agents_managements_path %></li>
</ul> </ul>
</li> </li>
</ul> </ul>

@ -1,11 +1,13 @@
<p class="lineh-25 font-22 mb20">上传教学案例</p> <p class="lineh-25 font-22 mb20">上传教学案例</p>
<div class="library-form-container"> <div class="library-form-container">
<%= form_for(@library) do |f| %> <%= form_for(@library, html: { multipart: true }) do |f| %>
<% tag_ids = @library.library_tags.map(&:id) %> <% tag_ids = @library.library_tags.map(&:id) %>
<%= hidden_field_tag :apply_publish, false %> <%= hidden_field_tag :apply_publish, false %>
<%= hidden_field_tag :tag_ids, tag_ids.join(',') %> <%= hidden_field_tag :tag_ids, tag_ids.join(',') %>
<div class="edu-back-white"> <div class="edu-back-white">
<div class="padding30"> <div class="padding30">
<div class="clearfix"> <div class="clearfix">
<span class="upload_Title">标题</span> <span class="upload_Title">标题</span>
<li class="fl"> <li class="fl">
@ -14,8 +16,29 @@
</li> </li>
<span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span> <span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
</div> </div>
</div>
<div class="padding30 bor-top-greyE"> <div class="clearfix mt20">
<span class="upload_Title">作者</span>
<li class="fl">
<%= f.text_field :author_name, placeholder: '请输入姓名', class: 'greyInput winput-300-35 mr20 fl winput150', width: '163', size: 30 %>
<p style="height:20px;line-height:20px;"><span class="color-red none" id="author_name_notice">请输入姓名</span></p>
</li>
<span class="color-red none" id="title_author_name">字数不能超过10个字</span>
<li class="fl">
<%= f.text_field :author_school_name, placeholder: '请输入作者单位名称', class: 'greyInput winput-300-35 mr20 fl', width: '163', size: 30 %>
<p style="height:20px;line-height:20px;"><span class="color-red none" id="author_school_name_notice">请输入作者单位名称</span></p>
</li>
</div>
<div class="clearfix mt20 mb20">
<span class="upload_Title">标签</span>
<ul class="fl libraries_tab">
<% LibraryTag.where(nil).each do |tag| %>
<li class="<%= tag_ids.include?(tag.id) ? 'active' : '' %>" data-id="<%= tag.id %>"><%= tag.name %></li>
<% end %>
</ul>
</div>
<div class="clearfix"> <div class="clearfix">
<span class="upload_Title">描述</span> <span class="upload_Title">描述</span>
<div class="fl" style="width: 1078px"> <div class="fl" style="width: 1078px">
@ -25,18 +48,37 @@
<p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p> <p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p>
</div> </div>
</div> </div>
<div class="clearfix mb20">
<span class="upload_Title">标签</span> <!-- <div class="clearfix mb20">-->
<ul class="fl libraries_tab"> <!-- <span class="upload_Title">标签</span>-->
<% LibraryTag.where(nil).each do |tag| %> <!-- <ul class="fl libraries_tab">-->
<li class="<%= tag_ids.include?(tag.id) ? 'active' : '' %>" data-id="<%= tag.id %>"><%= tag.name %></li> <%# LibraryTag.where(nil).each do |tag| %>
<% end %> <!-- <li class="<%#= tag_ids.include?(tag.id) ? 'active' : '' %>" data-id="<%#= tag.id %>"><%#= tag.name %></li>-->
</ul> <%# end %>
</div> <!-- </ul>-->
<!-- </div>-->
<div style="padding-left: 62px"> <div style="padding-left: 62px">
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %> <%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
<p style="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p> <p style="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>
</div> </div>
<div class="clearfix lineheight35">
<% cover_exists = @library.cover_id.present? && !@library.cover_id_changed? %>
<div><span class="upload_Titles">封面图</span> <span class="color-grey-c">上传尺寸120*90 px</span></div>
<%= hidden_field_tag 'library[cover_id]', @library.cover_id %>
<%= hidden_field_tag 'cover_file_name', '', class: 'cover-file-name' %>
<input type="file" name="cover_file" accept="image/*" id="library-cover-file" style="display: none"/>
<div class="surfacePlot ml60 library-cover-select" data-tip-down="上传图片" onclick="$('#library-cover-file').click();">
<img src="/images/educoder/unite.png" class="marginuploading <%= cover_exists ? 'hidden' : '' %>" style="<%= cover_exists ? 'display:none' : '' %>"/>
<div class="library-cover-perview" style="<%= cover_exists ? '' : 'display:none' %>">
<% cover_url = cover_exists ? download_attachment_path(@library.cover_id) : '' %>
<img src="<%= cover_url %>" width="122px" height="93px"/>
</div>
</div>
<!-- <p style="height:20px;line-height:20px;"><span class="color-red ml20 none" id="cover_file_notice">请上传封面</span></p>-->
</div>
</div> </div>
<div class="padding30 bor-top-greyE"> <div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li> <li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li>
@ -98,22 +140,73 @@
var submitForm = function(){ var submitForm = function(){
var title = $("input[name='library[title]']").val(); var title = $("input[name='library[title]']").val();
var content = $("textarea[name='library[content]']").val(); var content = $("textarea[name='library[content]']").val();
var author_name = $("input[name='library[author_name]']").val();
var author_school_name = $("input[name='library[author_school_name]']").val();
var cover_file = $("input[name='cover_file").val();
if (!title || title.length == 0) { if (!title || title.length == 0) {
$("#title_notice").removeClass("none"); $("#title_notice").removeClass("none");
$("#title_notice").html("请输入标题");
$(document).scrollTop(parseInt($("#title_notice").offset().top)-150);
return return
}else{ }else{
$("#title_notice").addClass("none"); $("#title_notice").addClass("none");
} }
// if (!title || title.length >10) {
// $("#title_notice").removeClass("none");
// $("#title_notice").html("字数不能超过10个字");
// return
// }else{
// $("#title_notice").addClass("none");
// }
if (!content || content.length == 0) { if (!content || content.length == 0) {
$("#des_notice").removeClass("none"); $("#des_notice").removeClass("none");
$(document).scrollTop(parseInt($("#des_notice").offset().top)-150);
return return
}else{ }else{
$("#des_notice").addClass("none"); $("#des_notice").addClass("none");
} }
if (!author_name || author_name.length == 0) {
$("#author_name_notice").removeClass("none");
$(document).scrollTop(parseInt($("#author_name_notice").offset().top)-150);
return
}else{
$("#author_name_notice").addClass("none");
}
if (!author_name || author_name.length >10) {
$("#title_author_name").removeClass("none");
$(document).scrollTop(parseInt($("#title_author_name").offset().top)-150);
return
}else{
$("#title_author_name").addClass("none");
}
if (!author_school_name || author_school_name.length == 0) {
$("#author_school_name_notice").removeClass("none");
$(document).scrollTop(parseInt($("#author_school_name_notice").offset().top)-150);
return
}else{
$("#author_school_name_notice").addClass("none");
}
var coverId = $("input[name='library[cover_id]']").val();
// if ((!coverId || coverId.length == 0) && (!cover_file || cover_file.length == 0)) {
// $("#cover_file_notice").removeClass("none");
// return
// }else{
// $("#cover_file_notice").addClass("none");
// }
if($('.attachments_fields .attachment').length == 0){ if($('.attachments_fields .attachment').length == 0){
$("#file_notice").removeClass("none"); $("#file_notice").removeClass("none");
$(document).scrollTop(parseInt($("#file_notice").offset().top)-150);
return return
}else{ }else{
$("#file_notice").addClass("none"); $("#file_notice").addClass("none");
@ -142,5 +235,26 @@
console.log('ids', ids) console.log('ids', ids)
$('#tag_ids').val(ids); $('#tag_ids').val(ids);
}) })
$("#library-cover-file").change(function (e) {
var file = e.target.files[0] || e.dataTransfer.files[0];
$('input.cover-file-name').val(document.getElementById("library-cover-file").files[0].name);
if (file) {
var reader = new FileReader();
reader.onload = function () {
$(".library-cover-perview img").attr("src", this.result);
$('.marginuploading').addClass('hidden').hide();
$('.library-cover-perview').show();
}
reader.readAsDataURL(file);
}
});
$('.library-cover-select').hover(function(){
$('.library-cover-select .marginuploading.hidden').show();
},function(){
$('.library-cover-select .marginuploading.hidden').hide();
});
}); });
</script> </script>

@ -2,20 +2,31 @@
<% if @libraries.present? %> <% if @libraries.present? %>
<% @libraries.each do |library| %> <% @libraries.each do |library| %>
<li class="library_list_item"> <li class="library_list_item">
<%= link_to image_tag(url_to_avatar(library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(library.user) %> <% image_url = library.cover.present? ? download_attachment_path(library.cover.id) : 'educoder/library-default-cover.png' %>
<%= image_tag(image_url, width: 120, height: 90, class: 'mr15 mt3 radius4') %>
<div class="flex1"> <div class="flex1">
<p class="clearfix mb15 lineh-20"> <p class="clearfix mb15 lineh-40 mt10">
<%= link_to library.title, library_path(library),:class => "task-hide font-16 library_l_name" %> <%= link_to library.title, library_path(library),:class => "task-hide font-22 library_l_name" %>
<%= show_library_tags(library) %> <%= show_library_tags(library, class: 'mt10 ml10') %>
<%# if params[:type] == 'mine' %>
<!-- <span class="color-grey-c mr20 fr">上传时间:<%#= library.created_at.strftime('%Y-%m-%d %H:%M') %></span>-->
<%# else %>
<!-- <span class="color-grey-c mr20 fr">发布时间:<%#= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %></span>-->
<%# end %>
</p> </p>
<p class="clearfix lineh-20"> <p class="clearfix lineh-20">
<span class="color-grey-3 mr20"><%= link_to library.user.show_real_name, user_path(library.user) %></span> <!-- <span class="color-grey-c">作者:</span>-->
<span class="color-grey-c mr20"><%= library.visited_count || 0 %> 浏览</span> <span class="color-grey-3 mr10"><%= library.author_name %></span>
<% if params[:type] == 'mine' %> <span class="color-grey-3 mr20"><%= library.author_school_name %></span>
<span class="color-grey-c mr20">上传时间:<%= library.created_at.strftime('%Y-%m-%d %H:%M') %></span> <% download_count = @download_count_map.try(:fetch, library.id, 0) || library.attachments.count %>
<% else %> <% if download_count.nonzero? %>
<span class="color-grey-c mr20">发布时间:<%= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %></span> <span class="color-grey-c mr20 fr"><span class=" item-group-icon mr5"><i class="fa fa-download"></i></span><%= download_count %> 下载</span>
<% end %> <% end %>
<% if library.praise_tread_cache.try(:praise_num).to_i.nonzero? %>
<span class="color-grey-c mr20 fr"><span class=" item-group-icon mr5"><i class="fa fa-thumbs-o-up"></i></span><%= library.praise_tread_cache.try(:praise_num) %> 赞</span>
<% end %>
<span class="color-grey-c mr20 fr"><span class=" item-group-icon mr5"><i class="fa fa-eye"></i></span><%= library.visited_count || 0 %> 浏览</span>
</p> </p>
</div> </div>
</li> </li>

@ -1,52 +1,54 @@
<img src="/images/educoder/teach_ex.jpg" width="100%"/> <img src="/images/educoder/teach_ex.jpg" width="100%"/>
<div class="educontent"> <div class="educontent">
<div class="edu-back-white mb30 mt30"> <div class="edu-back-white mb30 mt30">
<p class="padding20-30 clearfix bor-bottom-greyE"> <p class="padding20-30 clearfix bor-bottom-greyE">
<span class="font-18 fl color-grey-3">教学案例</span> <span class="font-18 fl color-grey-3">教学案例</span>
<%= link_to '发布案例', new_library_path, class: 'white-btn edu-filter-btn-blue fr mr10 mt8', style: 'color: #4CACFF' %> <%= link_to '发布案例', new_library_path, class: 'white-btn edu-filter-btn-blue fr mr10 mt8', style: 'color: #4CACFF' %>
</p> </p>
<div class="clearfix pl30 pr30"> <div class="clearfix pl30 pr30">
<ul class="fl library_nav mt20"> <ul class="fl library_nav mt20">
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>"> <li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %> <%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li> </li>
<li class="<%= params[:type] == 'mine' ? 'active' : '' %>"> <% if User.current.try(:logged?) %>
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %> <li class="<%= params[:type] == 'mine' ? 'active' : '' %>">
</li> <%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</ul> </li>
<div class="edu-position fr mt12"> <% end %>
<%= hidden_field_tag(:type, params[:type]) %> </ul>
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name"> <div class="edu-position fr mt12 mb10">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a> <%= hidden_field_tag(:type, params[:type]) %>
</div> <input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name">
</div> <a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
</div> </div>
<div class="library-list-container"> </div>
<%= render partial: 'library_list' %> </div>
</div> <div class="library-list-container">
</div> <%= render partial: 'library_list' %>
<script> </div>
$(function(){ </div>
$(".library_nav").on("click","li",function(){ <script>
$(".library_nav li").removeClass("active"); $(function(){
$(this).addClass("active"); $(".library_nav").on("click","li",function(){
}); $(".library_nav li").removeClass("active");
$(this).addClass("active");
var searchFunc = function() { });
var search = $("#search_name").val();
var type = $("input[name='type']").val(); var searchFunc = function() {
$.ajax({ var search = $("#search_name").val();
url: "<%= libraries_path %>", var type = $("input[name='type']").val();
dataType: 'script', $.ajax({
data: {search: search, type: type} url: "<%= libraries_path %>",
}); dataType: 'script',
}; data: {search: search, type: type}
});
$("#search").live("click", searchFunc); };
$('#search_name').bind('keypress',function(event) {
if (event.keyCode == "13") { $("#search").live("click", searchFunc);
searchFunc(); $('#search_name').bind('keypress',function(event) {
} if (event.keyCode == "13") {
}); searchFunc();
}) }
});
})
</script> </script>

@ -1,93 +1,102 @@
<% <%
admin_or_self = admin_or_business? || @library.user_id == User.current.id admin_or_self = admin_or_business? || @library.user_id == User.current.id
%> %>
<div class="educontent mb50"> <div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20"> <p class="mt10 mb20 clearfix lineh-20">
<%= link_to '教学案例', libraries_path, class: 'color-grey-9' %> &gt; <%= link_to '教学案例', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">详情</span> <span class="color-grey-3">详情</span>
</p> </p>
<p class="lineh-25 mb20 clearfix"> <p class="lineh-25 mb20 clearfix">
<span class="font-22 fl mr10 task-hide" style="max-width: 800px"> <span class="font-22 fl mr10 task-hide" style="max-width: 800px">
<%= @library.title %> <%= @library.title %>
</span> </span>
<%= show_library_tags(@library) %> <%= show_library_tags(@library, class: 'mt3 ml10') %>
<% if admin_or_self %> <% if admin_or_self %>
<% if @library.pending? %> <% if @library.pending? %>
<span class="fl edu-filter-btn edu-activity-green mt3 ml10">草稿</span> <span class="fl edu-filter-btn edu-activity-green mt3 ml10">草稿</span>
<% elsif @library.processing? %> <% elsif @library.processing? %>
<span class="fl edu-filter-btn edu-activity-green mt3 ml10">审核中</span> <span class="fl edu-filter-btn edu-activity-green mt3 ml10">审核中</span>
<% elsif @library.refused? %> <% elsif @library.refused? %>
<span class="fl edu-filter-btn edu-activity-orange mt3 ml10">未通过</span> <span class="fl edu-filter-btn edu-activity-orange mt3 ml10">未通过</span>
<% end %> <% end %>
<% end %> <% end %>
<%= link_to('返回', libraries_path, class: 'fr color-grey-9 mt5') %> <%= link_to('返回', libraries_path, class: 'fr color-grey-9 mt5') %>
</p> </p>
<div class="edu-back-white"> <div class="edu-back-white">
<div class="padding30"> <div class="padding30">
<div class="df"> <div class="df">
<%= link_to image_tag(url_to_avatar(@library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(@library.user) %> <%= link_to image_tag(url_to_avatar(@library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(@library.user) %>
<div class="flex1"> <div class="flex1">
<li class="clearfix"> <li class="clearfix">
<span class="font-16 fl"><%= @library.user.show_real_name %></span> <span class="font-16 fl"><%= @library.user.show_real_name %></span>
<% if admin_or_business? || @library.user_id == User.current.id && @library.pending? %> <% if admin_or_business? || @library.user_id == User.current.id && @library.pending? %>
<%= link_to '删除', 'javascript:void(0);', data: { id: @library.id }, <%= link_to '删除', 'javascript:void(0);', data: { id: @library.id },
class: 'white-btn edu-blueline-btn fr ml20 delete-btn' %> class: 'white-btn edu-blueline-btn fr ml20 delete-btn' %>
<% end %> <% end %>
<% if admin_or_self %> <% if admin_or_self %>
<%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %> <%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %>
<% end %> <% end %>
</li> </li>
<li class="clearfix"> <li class="clearfix">
<span class="fl color-grey-9 mr20"><%= @library.user.school_name %></span> <span class="fl color-grey-9 mr20"><%= @library.user.school_name %></span>
<span class="fr"> <span class="fr">
<span class="fl color-grey-9 mr30">编码:<span class="color-grey-6"><%= @library.uuid %></span></span> <span class="fl color-grey-9 mr30">编码:<span class="color-grey-6"><%= @library.uuid %></span></span>
<% if @library.published? %> <% if @library.published? %>
<span class="fl color-grey-9">发布时间:<span class="color-grey-6"><%= @library.published_at.strftime('%Y-%m-%d %H:%M') %></span></span> <span class="fl color-grey-9">发布时间:<span class="color-grey-6"><%= @library.published_at.strftime('%Y-%m-%d %H:%M') %></span></span>
<% else %> <% else %>
<span class="fl color-grey-9">上传时间:<span class="color-grey-6"><%= @library.created_at.strftime('%Y-%m-%d %H:%M') %></span></span> <span class="fl color-grey-9">上传时间:<span class="color-grey-6"><%= @library.created_at.strftime('%Y-%m-%d %H:%M') %></span></span>
<% end %> <% end %>
</span> </span>
</li> </li>
</div> </div>
</div> </div>
<div> <!--增加姓名大学-->
<div class="break_full_word new_li" id="labraries_editorMd_content" style="box-sizing: border-box"> <div>
<textarea style="display:none;"><%= @library.content %></textarea> <span class="fl color-grey-9">作者:</span>
</div> <%= @library.author_name %>/<%= @library.author_school_name %>
<div class="mt10 pl20"> </div>
<%= render partial: 'attachments/links', locals: { attachments: @library.attachments, options: {} } %>
</div> <div>
</div> <div class="break_full_word new_li" id="labraries_editorMd_content" style="box-sizing: border-box">
</div> <textarea style="display:none;"><%= @library.content %></textarea>
</div> </div>
</div> <div class="mt10 pl20">
<script> <%= render partial: 'attachments/links', locals: { attachments: @library.attachments, options: {} } %>
var homeworkDescr = editormd.markdownToHTML("labraries_editorMd_content", { </div>
htmlDecode: "style,script,iframe", // you can filter tags decode </div>
taskList: true, <div class="mt40">
tex: true, // 默认不解析 <%= render partial: 'praise_tread/new_praise', locals: { object: @library } %>
flowChart: true, // 默认不解析 </div>
sequenceDiagram: true // 默认不解析 </div>
}); </div>
$(function(){ </div>
// 删除 <script>
$('.delete-btn').on('click', function(){ var homeworkDescr = editormd.markdownToHTML("labraries_editorMd_content", {
var id = $(this).data('id'); htmlDecode: "style,script,iframe", // you can filter tags decode
op_confirm_tip_1("是否确认删除?", "destroyLibrary(" + id + ");") taskList: true,
}); tex: true, // 默认不解析
}) flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
function destroyLibrary (id) { });
$.ajax({ $(function(){
type: "DELETE", // 删除
url: "<%= libraries_path %>/" + id, $('.delete-btn').on('click', function(){
success: function (data) { var id = $(this).data('id');
if(data && data.status == 0){ op_confirm_tip_1("是否确认删除?", "destroyLibrary(" + id + ");")
notice_box_redirect("<%= libraries_path %>", "删除成功"); });
} else { })
notice_box(data.message);
} function destroyLibrary (id) {
} $.ajax({
}); type: "DELETE",
} url: "<%= libraries_path %>/" + id,
success: function (data) {
if(data && data.status == 0){
notice_box_redirect("<%= libraries_path %>", "删除成功");
} else {
notice_box(data.message);
}
}
});
}
</script> </script>

@ -125,7 +125,7 @@
modal.hide(); modal.hide();
}; };
// 隐藏弹窗 // 隐藏弹窗
modal.on("click", '.mask', hideRejectModalFunc); // modal.on("click", '.mask', hideRejectModalFunc);
modal.on("click", '.cancel-btn', hideRejectModalFunc); modal.on("click", '.cancel-btn', hideRejectModalFunc);
}) })
</script> </script>

@ -0,0 +1,66 @@
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<thead>
<th width="10%">ID</th>
<th width="10%">代理人登录名</th>
<th width="10%">代理人姓名</th>
<th width="20%">学校</th>
<th width="10%">竞赛报名状态</th>
<th width="10%">ip</th>
<th width="10%">ip</th>
<th width="20%">负责人</th>
</thead>
<tbody>
<% @user_agents.each do |ua| %>
<% user = User.find_by_login(ua.key) %>
<% user_extension = user.extensions %>
<% school = user_extension.school %>
<tr>
<td><%= ua.id %></td>
<td class="edu-txt-left"><span><%= link_to ua.key, user_path(ua.key), :target => "_blank" %></span></td>
<td><%= link_to user.try(:show_real_name), user_path(user), target:'_blank' %></td>
<td><%= school.name %></td>
<td><%= "--" %></td>
<td><%= ua.ip %></td>
<td><%= "理由" %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="cl"></div>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @agents_pages, @agents_count, :per_page_links => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<script>
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$.ajax({
url:"<%= shixuns_managements_path %>",
data: {sx_order:sx_order},
dateType: "script"
});
});
$(".shixun_webssh").on("click", 'input', function(ev){
var id = $(ev.target).parent().find("div").html();
var status = $(ev.target).parent().find("input").is(':checked');
$.ajax({
url:"<%= update_webssh_managements_path %>",
dataType: "script",
data:{shixun_id: id, status: status}
});
});
$(".shixun_hidden").on("click", 'input', function(ev){
var id = $(ev.target).parent().find("div").html();
$.ajax({
url:"<%= update_shixun_hidden_managements_path %>",
dataType: "script",
data:{shixun_id: id}
});
});
</script>

@ -0,0 +1,19 @@
<%= form_tag(url_for(departments_part_managements_path),:id=>"department_part_search",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix mb20 xmt10 bor-grey-e mt10">
<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" >
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt2" onclick="$('#department_part_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<%= link_to "关联代理人",add_departments_part_managements_path(),:class => "task-btn task-btn-green fr mt6 mr30" %>
<input name="sx_order" type="hidden">
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="managements_department_part_list">
<%= render :partial => "managements/user_agent_list" %>
</div>
<script>
function clearSearchCondition() {
$("#shixun_Look_name").val("");
$.get('<%= departments_part_managements_path() %>')
}
</script>

@ -0,0 +1,42 @@
<%
praised = PraiseTread.praised(object)
praise_num = get_praise_num(object) || 0
%>
<p class="noteDetailPoints plus-praise-btn" data-tip-down="点赞" style="<%= praised ? 'display:block' : 'display:none' %>"><i class="iconfont icon-dianzan"></i><br><span class="praise-num"><%= praise_num %></span></p>
<p class="noteDetailPointsBCD1E3 minus-praise-btn" data-tip-down="取消点赞" style="<%= praised ? 'display:none' : 'display:block' %>"><span>已赞</span><br><span class="praise-num"><%= praise_num %></span></p>
<script>
$(function(){
var $plusPraiseBtn = $('.plus-praise-btn');
var $minusPraiseBtn = $('.minus-praise-btn');
var praiseNum = parseInt(<%= praise_num %>);
$plusPraiseBtn.on('click', function(){
$.ajax({
method: "get",
url: "<%= praise_tread_praise_plus_path(obj_id: object.id, obj_type: object.class) %>",
dataType: 'json',
success: function(){
$plusPraiseBtn.hide();
praiseNum += 1;
$minusPraiseBtn.find('.praise-num').html(praiseNum);
$minusPraiseBtn.show();
}
})
});
$minusPraiseBtn.on('click', function(){
$.ajax({
method: "get",
url: "<%= praise_tread_praise_minus_path(obj_id: object.id, obj_type: object.class) %>",
dataType: 'json',
success: function(){
$minusPraiseBtn.hide();
praiseNum -= 1;
$plusPraiseBtn.find('.praise-num').html(praiseNum);
$plusPraiseBtn.show();
}
})
});
})
</script>

@ -28,4 +28,11 @@
</a> </a>
</div> </div>
</div>
<div class="-task-sidebars" style="right: 240px !important;">
<a href="/competitions">
<img src="/images/educoder/competition/lvmeng.png" width="150px" height="150px">
</a>
</div> </div>

@ -6,3 +6,5 @@
library: library:
title: '标题' title: '标题'
content: '描述' content: '描述'
author_name: '作者姓名'
author_school_name: '作者单位名称'

@ -537,6 +537,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
resources :managements do resources :managements do
collection do collection do
get 'user_agents'
get 'evaluate_simple' get 'evaluate_simple'
get 'hidden_course' get 'hidden_course'
match 'training_2018',:via=>[:get,:post] match 'training_2018',:via=>[:get,:post]

@ -0,0 +1,7 @@
class AddColumnsToLibraries < ActiveRecord::Migration
def change
add_column :libraries, :author_name, :string
add_column :libraries, :author_school_name, :string
add_column :libraries, :cover_id, :integer
end
end

@ -0,0 +1,12 @@
class CreateUserAgents < ActiveRecord::Migration
def change
create_table :user_agents do |t|
t.string :type
t.string :key
t.string :ip
t.timestamps
end
add_index(:user_agents, :ip, :unique => true)
end
end

@ -0,0 +1,8 @@
class ModifyTypeForUserAgents < ActiveRecord::Migration
def up
rename_column :user_agents, :type, :agent_type
end
def down
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

@ -51,7 +51,7 @@ class PackageConcent extends Component {
//否 string 排序,默认最新, recently, price //否 string 排序,默认最新, recently, price
// 否 string 类型, front,backend,mobile,database, cloud_compute_and_big_data,devops_and_test,ai,other // 否 string 类型, front,backend,mobile,database, cloud_compute_and_big_data,devops_and_test,ai,other
componentDidMount() { componentDidMount() {
window.document.title = '众包社区' window.document.title = '众包创新'
let {category,keyword,sort_by,sort_direction,page}=this.state let {category,keyword,sort_by,sort_direction,page}=this.state
this.setdatas(category,keyword,sort_by,sort_direction,page) this.setdatas(category,keyword,sort_by,sort_direction,page)

@ -11,7 +11,7 @@ class PackageIndex extends Component{
} }
componentDidMount(){ componentDidMount(){
window.document.title = '众包社区' window.document.title = '众包创新'
} }
render() { render() {

@ -49,7 +49,7 @@ class PackageIndexNEITaskDetails extends Component {
componentDidMount() { componentDidMount() {
this.getdatas() this.getdatas()
window.document.title = '众包社区' window.document.title = '众包创新'
} }
getdatas=()=>{ getdatas=()=>{
@ -251,7 +251,7 @@ class PackageIndexNEITaskDetails extends Component {
<Breadcrumb separator={'>'} className={"fl"}> <Breadcrumb separator={'>'} className={"fl"}>
{/*<Breadcrumb.Item>{this.props.current_user.username}</Breadcrumb.Item>*/} {/*<Breadcrumb.Item>{this.props.current_user.username}</Breadcrumb.Item>*/}
<Breadcrumb.Item> <Breadcrumb.Item>
<a href="/crowdsourcing">众包社区</a> <a href="/crowdsourcing">众包创新</a>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item><span className={"tabelcli"} title={data&&data.title}>{data&&data.title}</span></Breadcrumb.Item> <Breadcrumb.Item><span className={"tabelcli"} title={data&&data.title}>{data&&data.title}</span></Breadcrumb.Item>

@ -75,7 +75,7 @@ class PackageIndexNEIBannerConcent extends Component {
} }
componentDidMount() { componentDidMount() {
window.document.title = '众包社区' window.document.title = '众包创新'
if(this.props.match.params.id!=undefined){ if(this.props.match.params.id!=undefined){
let url=`/api/v1/project_packages/${this.props.match.params.id}.json` let url=`/api/v1/project_packages/${this.props.match.params.id}.json`

@ -10,7 +10,7 @@ class PackageIndexNEISubmit extends Component {
} }
} }
componentDidMount() { componentDidMount() {
window.document.title = '众包社区' window.document.title = '众包创新'
} }
setageload=(sum)=>{ setageload=(sum)=>{
if(sum===undefined){ if(sum===undefined){

@ -18,7 +18,7 @@ class PackageIndexNewandEditIndex extends Component{
} }
componentDidMount(){ componentDidMount(){
window.document.title = '众包社区' window.document.title = '众包创新'
} }
setPublicationfun=(ids)=>{ setPublicationfun=(ids)=>{

@ -32,7 +32,7 @@ class ProjectPackageIndex extends Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = '众包社区' window.document.title = '众包创新'
} }
render() { render() {

@ -5,6 +5,8 @@ import PropTypes from 'prop-types';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import { Modal} from 'antd';
// import searchImg from '../../../../images/educoder/icon/search.svg' // import searchImg from '../../../../images/educoder/icon/search.svg'
// /images/educoder/icon/search.svg // /images/educoder/icon/search.svg
@ -134,7 +136,8 @@ class NewHeader extends Component {
ImageUrl:"", ImageUrl:"",
ecUrl:null, ecUrl:null,
project_packages_url:null, project_packages_url:null,
ImageUrlType:false ImageUrlType:false,
competitiontype:false
} }
} }
componentWillMount(){ componentWillMount(){
@ -230,9 +233,30 @@ class NewHeader extends Component {
}); });
if (window.localStorage) {
var uid = localStorage.getItem('competition_uid');
} else {
var uid = false
}
if(!uid){
this.setState({
competitiontype:true
})
}
} }
setcompetitionfun=()=>{
this.competitionfun();
window.location.href="/competitions"
}
competitionfun=()=>{
this.setState({
competitiontype:false
})
localStorage.setItem('competition_uid', true);
}
render() { render() {
let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state; let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state;
// const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 // const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
@ -246,6 +270,7 @@ class NewHeader extends Component {
let activeCareers = false; let activeCareers = false;
let activeCourses = false; let activeCourses = false;
let competitions = false; let competitions = false;
let crowdsourcing=false;
if (match.path === '/forums') { if (match.path === '/forums') {
activeForums = true; activeForums = true;
} else if (match.path.startsWith('/shixuns')) { } else if (match.path.startsWith('/shixuns')) {
@ -258,6 +283,8 @@ class NewHeader extends Component {
activeCourses=true; activeCourses=true;
}else if(match.path.startsWith('/competitions')){ }else if(match.path.startsWith('/competitions')){
competitions=true; competitions=true;
}else if(match.path.startsWith('/crowdsourcing')){
crowdsourcing=true
}else{ }else{
activeIndex = true; activeIndex = true;
} }
@ -268,6 +295,45 @@ class NewHeader extends Component {
// console.log(match.path.startsWith("/ec_courses")) // console.log(match.path.startsWith("/ec_courses"))
return ( return (
<div className="newHeader" id="nHeader"> <div className="newHeader" id="nHeader">
<style>
{
`
.competitiontype .ant-modal{
width: 615px !important;
}
.competitiontype .ant-modal-content{
background-color: transparent !important;
box-shadow: none !important;
}
`
}
</style>
<Modal
visible={this.state.competitiontype}
closable={false}
footer={null}
className={"competitiontype"}
>
<div className="login_reg pr login_regs">
<div style={{position: "relative"}} >
<a onClick={()=>this.competitionfun()} id="closeIcon"
style={{position: "absolute",right: "-20px",top: "36px"}}
>
<i className="iconfont icon-shanchudiao"></i>
</a>
<img src={"/images/educoder/competitionslog.png"} height="580px" width="637px"/>
<a style={{position: "absolute",left:"42%", bottom:"18px"}} onClick={()=>this.setcompetitionfun()}>
<img height="40px" width="150px" src={"/images/educoder/applys.png"}/>
</a>
</div>
</div>
</Modal>
<div className="educontent clearfix"> <div className="educontent clearfix">
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}
<a href="/"> <a href="/">
@ -299,12 +365,17 @@ class NewHeader extends Component {
</ul> </ul>
</div> </div>
</li> </li>
{/* <li><a href="/libraries">教学案例</a></li> */}
<li className={`${competitions === true ? 'active' : ''}`} ><a href="/competitions">在线竞赛</a></li> <li className={`${competitions === true ? 'active' : ''}`} >
<li className={`${competitions === true ? 'active' : ''}`} style={{display:project_packages_url===null||project_packages_url===undefined||project_packages_url===""?'none':'block'}} > <a href="/competitions">在线竞赛</a>
<img className="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>
</li>
<li><a href="/moop_cases">教学案例</a></li>
<li className={`${crowdsourcing === true ? 'active' : ''}`} style={{display:project_packages_url===null||project_packages_url===undefined||project_packages_url===""?'none':'block'}} >
<a href="/crowdsourcing"> <a href="/crowdsourcing">
{project_packages_url===null||project_packages_url===undefined||project_packages_url===""?'':'众包'} {project_packages_url===null||project_packages_url===undefined||project_packages_url===""?'':'众包创新'}
</a> </a>
</li> </li>
<li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">交流问答</a></li> <li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">交流问答</a></li>
@ -461,11 +532,3 @@ class NewHeader extends Component {
export default NewHeader; export default NewHeader;
// <ul id="header-nav">
// <li className="active">1{/*<%= link_to "首页", home_path %>*/}</li>
// <li>2{/*<%= link_to "精选实训", shixuns_path %>*/}</li>
// <li>3{/*<%= link_to "实训路径", subjects_path %>*/}</li>
// <li>4{/*<%= link_to "在线课堂", courses_path %>*/}</li>
// <li>5{/*<%= link_to "讨论组", forums_path %>*/}</li>
// </ul>

@ -17,37 +17,47 @@ class SiderBar extends Component {
render() { render() {
return ( return (
<div className="-task-sidebar"> <div>
<div className="gotop" style={{"display":"none"}} tooltips="返回顶部">
<a href="javascript:void(0)" className="inline"> <div className="-task-sidebar">
<i class="iconfont icon-shangjiantou color-white fl mt7"></i> <div className="gotop" style={{"display": "none"}} tooltips="返回顶部">
</a> <a href="javascript:void(0)" className="inline">
</div> <i className="iconfont icon-shangjiantou color-white fl mt7"></i>
</a>
<div className="feedback" tooltips="意见反馈"> </div>
<a target="_blank" className="color_white inline" href="/help?index=6">
<i className="iconfont icon-yijianfankui color-white font-22 fl mt7"></i> <div className="feedback" tooltips="意见反馈">
</a> <a target="_blank" className="color_white inline" href="/help?index=6">
</div> <i className="iconfont icon-yijianfankui color-white font-22 fl mt7"></i>
</a>
<div className="scan pr"> </div>
<span className="inline"><i className="iconfont icon-erweima color-white font-22 fl mt7"></i></span>
<div className="scan_ewm"> <div className="scan pr">
<div className="pr padding10"> <span className="inline"><i className="iconfont icon-erweima color-white font-22 fl mt7"></i></span>
<img src={getImageUrl('/images/edu_user/EWM.jpg')} style={{"widht":"158px","height":"158px"}} /> <div className="scan_ewm">
<p className="mb0 mt8">微信扫一扫</p> <div className="pr padding10">
<p className="mb0">关注公众号</p> <img src={getImageUrl('/images/edu_user/EWM.jpg')} style={{"widht": "158px", "height": "158px"}}/>
<span className="trangle_right"></span> <p className="mb0 mt8">微信扫一扫</p>
</div> <p className="mb0">关注公众号</p>
</div> <span className="trangle_right"></span>
</div> </div>
<div className="consult" tooltips="在线咨询"> </div>
<a target="_blank" className="color_white inline" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd"> </div>
<i className="iconfont icon-qqzaixianzixun color-white font-22 fl mt7"></i> <div className="consult" tooltips="在线咨询">
</a> <a target="_blank" className="color_white inline"
</div> href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">
<i className="iconfont icon-qqzaixianzixun color-white font-22 fl mt7"></i>
</div> </a>
</div>
</div>
<div className="-task-sidebars" style={{right: "240px"}}>
<a href="/competitions">
<img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" />
</a>
</div>
</div>
); );
} }
} }

@ -2,7 +2,7 @@
/*头部导航条样式---2018-03-19--by-cs*/ /*头部导航条样式---2018-03-19--by-cs*/
.newHeader{background: #24292D;width:100%; height: 60px; min-width: 1200px;position: fixed;top: 0px;left: 0px;z-index:1000;-moz-box-shadow: 0px 0px 12px rgba(0,0,0,0.1); /* 老的 Firefox */box-shadow: 0px 0px 12px rgba(0,0,0,0.1);} .newHeader{background: #24292D;width:100%; height: 60px; min-width: 1200px;position: fixed;top: 0px;left: 0px;z-index:1000;-moz-box-shadow: 0px 0px 12px rgba(0,0,0,0.1); /* 老的 Firefox */box-shadow: 0px 0px 12px rgba(0,0,0,0.1);}
.newHeader .logoimg{margin-top:12px;float: left;width: 36px} .newHeader .logoimg{margin-top:12px;float: left;width: 36px}
.head-nav{float: left;width: 780px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;} .head-nav{float: left;width: 920px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;}
.head-nav ul#header-nav{position: absolute;top: 0px;z-index: 3;height: 60px;box-sizing: border-box;padding-left: 30px;} .head-nav ul#header-nav{position: absolute;top: 0px;z-index: 3;height: 60px;box-sizing: border-box;padding-left: 30px;}
.head-nav ul#header-nav li{float: left;height: 60px;line-height: 60px;margin-right: 30px;cursor: pointer;position: relative;font-size: 16px} .head-nav ul#header-nav li{float: left;height: 60px;line-height: 60px;margin-right: 30px;cursor: pointer;position: relative;font-size: 16px}
.head-nav ul#header-nav li a{display: block;height: 100%;width: 100%;color: #fff} .head-nav ul#header-nav li a{display: block;height: 100%;width: 100%;color: #fff}
@ -464,7 +464,7 @@ li.li-width7{width: 7%;text-align: left}
.top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;} .top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;}
.right-black-trangle{display: block;border-width: 8px;position: absolute;top: 10px;right: -16px;border-style: dashed solid dashed dashed;border-color: transparent transparent transparent rgba(5,16,26,0.6);font-size: 0;line-height: 0;} .right-black-trangle{display: block;border-width: 8px;position: absolute;top: 10px;right: -16px;border-style: dashed solid dashed dashed;border-color: transparent transparent transparent rgba(5,16,26,0.6);font-size: 0;line-height: 0;}
.activity-nav.active{color: #4CACFF!important;} .activity-nav.active{color: #4CACFF!important;}
.project_packagesHead{width: 100%;margin-bottom:40px;background-size: 100% 100%;background-image: url("/images/educoder/project_packagesHead.png");height: 240px; .project_packagesHead{width: 100%;margin-bottom:40px;background-size: 100% 100%;background-image: url("/images/educoder/project_packagesHead.jpg");height: 240px;
justify-content: center;align-items: center;display: -webkit-flex;} justify-content: center;align-items: center;display: -webkit-flex;}
.courseNewNum{display: block;background: #FF6800;border-radius:30px;padding:0px 2px;color: #fff!important;font-size: 11px; .courseNewNum{display: block;background: #FF6800;border-radius:30px;padding:0px 2px;color: #fff!important;font-size: 11px;
@ -3466,9 +3466,10 @@ line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
margin-bottom: 30px; margin-bottom: 30px;
} }
.library_list_item{ .library_list_item{
background: #fff;padding:30px;margin-bottom: 15px;display: flex; background: #fff;padding:20px 30px;margin-bottom: 30px;display: flex;
} }
.library_list_item .library_l_name{max-width: 900px;float: left;} .library_list_item:hover { box-shadow:0px 4px 8px rgba(158,158,158,0.16); }
.library_list_item .library_l_name{max-width: 600px;float: left;}
.upload_Title{ .upload_Title{
position: relative;margin-right: 30px;float: left;line-height: 35px;font-size: 16px;width: 32px; position: relative;margin-right: 30px;float: left;line-height: 35px;font-size: 16px;width: 32px;
} }

@ -1138,4 +1138,119 @@ html>body #ajax-indicator { position: fixed; }
width: 73px; width: 73px;
height: 30px; height: 30px;
text-align: center; text-align: center;
}
.noteDetailPoints{
width: 70px;
height: 70px;
background-color: #4cacff;
border-radius: 50%;
color: #fff;
text-align: center;
margin: 0 auto;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 2px 0;
cursor: pointer;
line-height: 22px;
padding-top: 12px;
}
.noteDetailPointsBCD1E3{
width: 70px;
height: 70px;
background-color: #BCD1E3;
border-radius: 50%;
color: #fff;
text-align: center;
margin: 0 auto;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 2px 0;
cursor: pointer;
line-height: 22px;
padding-top: 12px;
}
.-task-sidebars{
position: fixed;
width: 40px;
height: 180px;
right: 0;
bottom: 30px;
z-index: 10;
}
.winput150{
width:150px;
}
.upload_Titles{
position: relative;
float: left;
line-height: 35px;
font-size: 16px;
width: 50px;
}
.lineheight35{
line-height: 35px;
}
.w120{
width:120px;
}
.h90{
width:90px;
}
.decoration4CACFF{
color: #4CACFF !important;
border-bottom: 1px solid #4CACFF;
}
.surfacePlot{
cursor: pointer;
width:122px;
height:92px;
background:rgba(250,250,250,1);
border:1px solid rgba(221,221,221,1);
}
.marginuploading{
padding: 28px 43px;
position: absolute;
z-index: 10;
}
.surfacePlot:hover .marginuploading.hidden{
background: rgba(0,0,0, 0.1);
}
.roundedRectangles {
position: absolute;
top: 10px;
right: -22px;
}
.edu-menu-lists .currentName{
text-align: left;
}
.edu-menu-lists li{
text-align: left;
}
.login_regs{
width: 580px !important;
}
.login_regs a{
cursor: pointer;
}
#member_block{
height: 260px;
overflow-y: auto;
} }

@ -0,0 +1,7 @@
FactoryGirl.define do
factory :user_agent do
type 1
key "MyString"
ip "MyString"
end
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe UserAgent, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save