diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index c631d56f..6e9daea1 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -140,7 +140,6 @@ module Mobile # Rails.logger.info("########### host is #{request.host}") if (Rails.env.development? && session[:user_id].blank?) || - (session[:user_id].blank? && request.host.include?("testbdweb")) || params[:action] == "privateGit" session[:user_id] = 12 #116 end diff --git a/app/api/mobile/apis/memos.rb b/app/api/mobile/apis/memos.rb index c8c0041a..a167a214 100644 --- a/app/api/mobile/apis/memos.rb +++ b/app/api/mobile/apis/memos.rb @@ -29,6 +29,15 @@ module Mobile requires :id, type: Integer, desc: "帖子ID" end 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 end diff --git a/app/api/mobile/entities/project_package.rb b/app/api/mobile/entities/project_package.rb index 278e9b85..50d4ff69 100644 --- a/app/api/mobile/entities/project_package.rb +++ b/app/api/mobile/entities/project_package.rb @@ -17,8 +17,8 @@ module Mobile expose :bidding_users_count, if: { type: :index } expose :min_price expose :max_price - expose :contact_name, if: ->(package, opts){ 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_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].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) } expose :updated_at do |package, _| package.updated_at.strftime('%Y-%m-%d %H:%M:%S') @@ -65,6 +65,7 @@ module Mobile expose :operation, if: { type: :show } do |package, opts| user = opts[:user] + return {} if user.blank? is_creator = user.id == package.creator_id is_admin = user.admin? || user.business? diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 0476b8f2..64833a14 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -377,36 +377,10 @@ class AccountController < ApplicationController else us = UsersService.new @user = us.register user_params.merge(:should_confirmation_password => false) -=begin - case Setting.self_registration - when '1' - #register_by_email_activation(@user) - 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 + # 注册时,记录是否是引流用户 + ip = request.remote_ip + ua = UserAgent.find_by_ip(ip) + ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index b0a7be31..e41e2a43 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -359,6 +359,7 @@ class AttachmentsController < ApplicationController saved = @attachment.save respond_to do |format| format.js + format.json { render json: { attachment_id: @attachment.id, url: download_attachment_path(@attachment.id) } } format.api { if saved render :action => 'upload', :status => :created diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 418015fd..fc62d664 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -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) @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") # ).order("publish_shixun_count desc, experience desc").limit(10) @teachers = @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 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 diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 1be642d7..c285fba7 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -51,7 +51,7 @@ class CompetitionTeamsController < ApplicationController end condition = "%#{params[:search].strip}%".gsub(" ","") - @teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0") + @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 def search_non_user @@ -71,7 +71,7 @@ class CompetitionTeamsController < ApplicationController end user_ids = user_ids.length > 0 ? "(" + user_ids.uniq.join(',') + ")" : "(-1)" 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 def create @@ -113,6 +113,8 @@ class CompetitionTeamsController < ApplicationController 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) end + # 创建时,记录是否是引流用户 + record_agent_user_action end end @@ -227,6 +229,8 @@ class CompetitionTeamsController < ApplicationController team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id) end + # 记录引流 + record_agent_user_action end # 退出战队 非创建者直接退出,创建者退出则解散团队 @@ -341,4 +345,11 @@ class CompetitionTeamsController < ApplicationController .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') .group('shixun_id').count 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 diff --git a/app/controllers/ecs_controller.rb b/app/controllers/ecs_controller.rb index 5d391a5d..12b6b5d9 100644 --- a/app/controllers/ecs_controller.rb +++ b/app/controllers/ecs_controller.rb @@ -1,5 +1,5 @@ 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 :school_manager, :except => [:department, :get_navigation_url] layout 'base_ec' @@ -60,7 +60,7 @@ class EcsController < ApplicationController def get_navigation_url ec_user = EcSchoolUser.where(:user_id => User.current.id).first 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 diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index 16efc0c5..b7bbf836 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -8,17 +8,22 @@ class LibrariesController < ApplicationController libraries = Library.where(nil) libraries = - if params[:type] == 'mine' + if User.current.logged? && params[:type] == 'mine' libraries.where(user_id: current_user.id).order('created_at desc') else libraries.where(status: :published).order('visited_count desc') end 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 - @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 def show @@ -44,7 +49,7 @@ class LibrariesController < ApplicationController rescue ActiveRecord::RecordInvalid => e flash[:message] = e.record.errors.full_messages.join(',') render 'new' - rescue Libraries::SubmitService::Error => ex + rescue Libraries::SubmitService::Error, Libraries::SaveService::Error => ex flash[:message] = ex.message render 'new' end @@ -68,7 +73,7 @@ class LibrariesController < ApplicationController rescue ActiveRecord::RecordInvalid => e flash[:message] = e.record.errors.full_messages.join(',') render 'edit' - rescue Libraries::SubmitService::Error => ex + rescue Libraries::SubmitService::Error, Libraries::SaveService::Error => ex flash[:message] = ex.message render 'edit' end @@ -112,6 +117,7 @@ class LibrariesController < ApplicationController hash = params[:library].presence || {} hash[:tag_ids] = params[:tag_ids].to_s.split(',') hash[:attachment_ids] = (params[:attachments].presence || []).values.map{|h| h[:attachment_id]} + hash[:cover_id] = save_cover.try(:id) || hash[:cover_id] hash end end @@ -127,4 +133,14 @@ class LibrariesController < ApplicationController def increment_visit_count @library.increment_visited_count! if @library && @library.id 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 \ No newline at end of file diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 3a66aff4..156ae951 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -28,6 +28,15 @@ class ManagementsController < ApplicationController render :json => {status: 1} 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 @levels = SubjectLevelSystem.all @@ -4437,21 +4446,24 @@ end end end if competition.max_num > 1 - sheet1.row(0).concat(["序号", "战队ID", "战队名称","指导老师", "队员姓名", "学号", "实名认证", "职业认证", "学校名称", "地区", "报名时间", "排名"]) + sheet1.row(0).concat(["序号", "战队ID", "战队名称", "战队创建者", "指导老师", "队员姓名", "手机号", "邮箱", "学号", "实名认证", "职业认证", "学校名称", "地区", "报名时间", "排名"]) members.each_with_index do |member, index| member_user = member.user sheet1[count_row,0] = index + 1 sheet1[count_row,1] = member.competition_team.try(:id) sheet1[count_row,2] = member.competition_team.try(:name) - sheet1[count_row,3] = member.competition_team.teacher.try(:show_real_name) - sheet1[count_row,4] = member_user.try(:show_real_name) - sheet1[count_row,5] = member_user.try(:student_id) - sheet1[count_row,6] = member_user.try(:authentication_status) - sheet1[count_row,7] = member_user.try(:professional_status) - sheet1[count_row,8] = member_user.try(:school_name) - sheet1[count_row,9] = member_user.user_extensions.school.try(:province) - sheet1[count_row,10] = format_time member.created_at - sheet1[count_row,11] = records.present? ? (records.map(&:id).index(member.competition_team_id).to_i + 1) : "--" + sheet1[count_row,3] = member.competition_team.user.try(:show_real_name) + sheet1[count_row,4] = member.competition_team.teacher.try(:show_real_name) + sheet1[count_row,5] = member_user.try(:show_real_name) + sheet1[count_row,6] = member_user.try(:phone) + sheet1[count_row,7] = member_user.try(:mail) + sheet1[count_row,8] = member_user.try(:student_id) + sheet1[count_row,9] = member_user.try(:authentication_status) + sheet1[count_row,10] = member_user.try(:professional_status) + 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 end else diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index d56ffa31..7368e0fb 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -47,6 +47,7 @@ class PraiseTreadController < ApplicationController end respond_to do |format| format.js + format.json { render_api_ok } end end end @@ -85,6 +86,7 @@ class PraiseTreadController < ApplicationController #@obj = User.find_by_id(@obj) respond_to do |format| format.js + format.json { render_api_ok } end end @@ -177,6 +179,8 @@ class PraiseTreadController < ApplicationController @obj = Challenge.find_by_id(id) when 'Discuss' @obj = Discuss.find_by_id(id) + when 'Library' + @obj = Library.find_by_id(id) else @obj = nil end diff --git a/app/controllers/project_packages_controller.rb b/app/controllers/project_packages_controller.rb index fe2c1c13..6721c1c4 100644 --- a/app/controllers/project_packages_controller.rb +++ b/app/controllers/project_packages_controller.rb @@ -1,7 +1,7 @@ # encoding=utf-8 # For react class ProjectPackagesController < ApplicationController - before_filter :require_login, :except => [:index] + before_filter :require_login, :except => [:index, :show] include ApplicationHelper diff --git a/app/helpers/colleges_helper.rb b/app/helpers/colleges_helper.rb index 49a7fdc2..f7238ce6 100644 --- a/app/helpers/colleges_helper.rb +++ b/app/helpers/colleges_helper.rb @@ -14,4 +14,13 @@ module CollegesHelper end type 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 diff --git a/app/helpers/libraries_helper.rb b/app/helpers/libraries_helper.rb index e2e74324..844d6124 100644 --- a/app/helpers/libraries_helper.rb +++ b/app/helpers/libraries_helper.rb @@ -1,8 +1,9 @@ module LibrariesHelper - def show_library_tags(library) + def show_library_tags(library, opts = {}) html = '' 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 raw html diff --git a/app/models/library.rb b/app/models/library.rb index 2ff3c4c4..6029f984 100644 --- a/app/models/library.rb +++ b/app/models/library.rb @@ -2,17 +2,22 @@ class Library < ActiveRecord::Base include AASM belongs_to :user + belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id has_many :library_applies, dependent: :delete_all has_many :attachments, as: :container has_many :library_library_tags, dependent: :delete_all 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 :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 @@ -44,7 +49,13 @@ class Library < ActiveRecord::Base self.uuid = uuid end - def increment_visited_count! - Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}") + def increment_visited_count!(num = 1) + 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 \ No newline at end of file diff --git a/app/models/user_agent.rb b/app/models/user_agent.rb new file mode 100644 index 00000000..acc45a8a --- /dev/null +++ b/app/models/user_agent.rb @@ -0,0 +1,6 @@ +class UserAgent < ActiveRecord::Base + + USER_AD = 1 # 广告宣传的引流 + USER_REGISTER = 2 # 引流注册 + USER_COMPETITION = 3 # 引流参加竞赛 +end diff --git a/app/services/discusses_service.rb b/app/services/discusses_service.rb index a43ccfa8..9c242554 100644 --- a/app/services/discusses_service.rb +++ b/app/services/discusses_service.rb @@ -30,14 +30,15 @@ class DiscussesService memo_count = memos.count memos = memos.offset(offset).limit(15) #实训标签使用最多的9个 - 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 - 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) - 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 - order by cnt desc limit 9").map{|ht| ht.attributes.dup} - + # 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 + # 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) + # 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 + # 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 user_info = format_for_current_user current_user hot_memos = Memo.field_for_recommend.posts.hot.limit(4) diff --git a/app/services/libraries/save_service.rb b/app/services/libraries/save_service.rb index 393d3911..4b28569f 100644 --- a/app/services/libraries/save_service.rb +++ b/app/services/libraries/save_service.rb @@ -23,20 +23,10 @@ class Libraries::SaveService library.assign_attributes(params) library.save! - new_tag_ids = LibraryTag.where(id: params[:tag_ids].presence || []).pluck(:id) - old_tag_ids = library.library_library_tags.pluck(:library_tag_id) + deal_library_tag! - # 删除标签 - 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 - - Attachment.where(id: attachment_ids).update_all(container_id: library.id, container_type: 'Library') + Attachment.where(id: attachment_ids, author_id: user.id) + .update_all(container_id: library.id, container_type: 'Library') end library @@ -46,5 +36,21 @@ class Libraries::SaveService def validate_params! 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 diff --git a/app/views/colleges/_course_statistics.html.erb b/app/views/colleges/_course_statistics.html.erb index d112c839..67e989f3 100644 --- a/app/views/colleges/_course_statistics.html.erb +++ b/app/views/colleges/_course_statistics.html.erb @@ -2,7 +2,7 @@ - + @@ -16,7 +16,9 @@ <% @courses.each do |course| %> - + diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index 98c5be73..3c842539 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -100,7 +100,12 @@

在线实训情况

-
+ <% if @shixun_tags_name.size == 0 %> + <%= render :partial => 'welcome/no_data' %> +
+ <% else %> +
+ <% end %>
diff --git a/app/views/competitions/_competitions_name.html.erb b/app/views/competitions/_competitions_name.html.erb new file mode 100644 index 00000000..8597b4fc --- /dev/null +++ b/app/views/competitions/_competitions_name.html.erb @@ -0,0 +1,42 @@ + +
+
+ +
+
+ + diff --git a/app/views/competitions/_header.html.erb b/app/views/competitions/_header.html.erb index 18e284ec..698238cb 100644 --- a/app/views/competitions/_header.html.erb +++ b/app/views/competitions/_header.html.erb @@ -64,11 +64,30 @@ - <% if User.current.logged? %> +
+ <% 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" %> - <% else %> + + <% else %> 登录/注册 - <% end %> + <% end %> +
\ No newline at end of file diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index f0fefec5..3392f099 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -145,6 +145,7 @@
  • <%= link_to "升级通知", update_notice_managements_path %>
  • <%= link_to "门户banner设置", setting_banner_managements_path %>
  • <%= link_to "培训会", training_2018_managements_path %>
  • +
  • <%= link_to "引流情况", user_agents_managements_path %>
  • diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index e1e6aa0b..c71bc7c1 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -1,11 +1,13 @@

    上传教学案例

    - <%= form_for(@library) do |f| %> + <%= form_for(@library, html: { multipart: true }) do |f| %> <% tag_ids = @library.library_tags.map(&:id) %> <%= hidden_field_tag :apply_publish, false %> <%= hidden_field_tag :tag_ids, tag_ids.join(',') %>
    + +
    标题
  • @@ -14,8 +16,29 @@
  • 简明扼要介绍文档/视频所包含的主要的内容
    -
    -
    + +
    + 作者 +
  • + <%= f.text_field :author_name, placeholder: '请输入姓名', class: 'greyInput winput-300-35 mr20 fl winput150', width: '163', size: 30 %> +

    请输入姓名

    +
  • + 字数不能超过10个字 +
  • + <%= f.text_field :author_school_name, placeholder: '请输入作者单位名称', class: 'greyInput winput-300-35 mr20 fl', width: '163', size: 30 %> +

    请输入作者单位名称

    +
  • +
    + +
    + 标签 +
      + <% LibraryTag.where(nil).each do |tag| %> +
    • <%= tag.name %>
    • + <% end %> +
    +
    +
    描述
    @@ -25,18 +48,37 @@

    请输入描述内容

    -
    - 标签 -
      - <% LibraryTag.where(nil).each do |tag| %> -
    • <%= tag.name %>
    • - <% end %> -
    -
    + + + + + <%# LibraryTag.where(nil).each do |tag| %> + + <%# end %> + +
    <%= render partial: 'attachments/from_libraries', locals: { container: @library } %>

    请上传附件

    + +
    + <% cover_exists = @library.cover_id.present? && !@library.cover_id_changed? %> +
    封面图 (上传尺寸:120*90 px)
    + + <%= hidden_field_tag 'library[cover_id]', @library.cover_id %> + <%= hidden_field_tag 'cover_file_name', '', class: 'cover-file-name' %> + + +
    + +
    + <% cover_url = cover_exists ? download_attachment_path(@library.cover_id) : '' %> + +
    +
    + +
  • 审核说明
  • @@ -98,22 +140,73 @@ var submitForm = function(){ var title = $("input[name='library[title]']").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) { $("#title_notice").removeClass("none"); + $("#title_notice").html("请输入标题"); + $(document).scrollTop(parseInt($("#title_notice").offset().top)-150); return }else{ $("#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) { $("#des_notice").removeClass("none"); + $(document).scrollTop(parseInt($("#des_notice").offset().top)-150); return }else{ $("#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){ $("#file_notice").removeClass("none"); + $(document).scrollTop(parseInt($("#file_notice").offset().top)-150); return }else{ $("#file_notice").addClass("none"); @@ -142,5 +235,26 @@ console.log('ids', 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(); + }); }); \ No newline at end of file diff --git a/app/views/libraries/_library_list.html.erb b/app/views/libraries/_library_list.html.erb index 7ae5031c..b5551966 100644 --- a/app/views/libraries/_library_list.html.erb +++ b/app/views/libraries/_library_list.html.erb @@ -2,20 +2,31 @@ <% if @libraries.present? %> <% @libraries.each do |library| %>
  • - <%= 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') %>
    -

    - <%= link_to library.title, library_path(library),:class => "task-hide font-16 library_l_name" %> - <%= show_library_tags(library) %> +

    + <%= link_to library.title, library_path(library),:class => "task-hide font-22 library_l_name" %> + <%= show_library_tags(library, class: 'mt10 ml10') %> + + <%# if params[:type] == 'mine' %> + + <%# else %> + + <%# end %>

    - <%= link_to library.user.show_real_name, user_path(library.user) %> - <%= library.visited_count || 0 %> 浏览 - <% if params[:type] == 'mine' %> - 上传时间:<%= library.created_at.strftime('%Y-%m-%d %H:%M') %> - <% else %> - 发布时间:<%= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %> + + <%= library.author_name %> + <%= library.author_school_name %> + <% download_count = @download_count_map.try(:fetch, library.id, 0) || library.attachments.count %> + <% if download_count.nonzero? %> + <%= download_count %> 下载 <% end %> + <% if library.praise_tread_cache.try(:praise_num).to_i.nonzero? %> + <%= library.praise_tread_cache.try(:praise_num) %> 赞 + <% end %> + <%= library.visited_count || 0 %> 浏览

  • diff --git a/app/views/libraries/index.html.erb b/app/views/libraries/index.html.erb index 1c15217c..3a277f0b 100644 --- a/app/views/libraries/index.html.erb +++ b/app/views/libraries/index.html.erb @@ -1,52 +1,54 @@ - -
    -
    -

    - 教学案例 - <%= link_to '发布案例', new_library_path, class: 'white-btn edu-filter-btn-blue fr mr10 mt8', style: 'color: #4CACFF' %> -

    -
    -
      -
    • - <%= link_to '全部', libraries_path(search: params[:search]), remote: true %> -
    • -
    • - <%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %> -
    • -
    -
    - <%= hidden_field_tag(:type, params[:type]) %> - - -
    -
    -
    -
    - <%= render partial: 'library_list' %> -
    -
    - \ No newline at end of file diff --git a/app/views/libraries/show.html.erb b/app/views/libraries/show.html.erb index 0a29fc05..09515dd6 100644 --- a/app/views/libraries/show.html.erb +++ b/app/views/libraries/show.html.erb @@ -1,93 +1,102 @@ -<% - admin_or_self = admin_or_business? || @library.user_id == User.current.id -%> -
    -

    - <%= link_to '教学案例', libraries_path, class: 'color-grey-9' %> > - 详情 -

    -

    - - <%= @library.title %> - - <%= show_library_tags(@library) %> - <% if admin_or_self %> - <% if @library.pending? %> - 草稿 - <% elsif @library.processing? %> - 审核中 - <% elsif @library.refused? %> - 未通过 - <% end %> - <% end %> - <%= link_to('返回', libraries_path, class: 'fr color-grey-9 mt5') %> -

    -
    -
    -
    - <%= link_to image_tag(url_to_avatar(@library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(@library.user) %> -
    -
  • - <%= @library.user.show_real_name %> - <% if admin_or_business? || @library.user_id == User.current.id && @library.pending? %> - <%= link_to '删除', 'javascript:void(0);', data: { id: @library.id }, - class: 'white-btn edu-blueline-btn fr ml20 delete-btn' %> - <% end %> - <% if admin_or_self %> - <%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %> - <% end %> -
  • -
  • - <%= @library.user.school_name %> - - 编码:<%= @library.uuid %> - <% if @library.published? %> - 发布时间:<%= @library.published_at.strftime('%Y-%m-%d %H:%M') %> - <% else %> - 上传时间:<%= @library.created_at.strftime('%Y-%m-%d %H:%M') %> - <% end %> - -
  • -
    -
    -
    -
    - -
    -
    - <%= render partial: 'attachments/links', locals: { attachments: @library.attachments, options: {} } %> -
    -
    -
    -
    -
    - \ No newline at end of file diff --git a/app/views/managements/_reject_authorization_model.html.erb b/app/views/managements/_reject_authorization_model.html.erb index 6d7468f4..93389cd8 100644 --- a/app/views/managements/_reject_authorization_model.html.erb +++ b/app/views/managements/_reject_authorization_model.html.erb @@ -125,7 +125,7 @@ modal.hide(); }; // 隐藏弹窗 - modal.on("click", '.mask', hideRejectModalFunc); + // modal.on("click", '.mask', hideRejectModalFunc); modal.on("click", '.cancel-btn', hideRejectModalFunc); }) diff --git a/app/views/managements/_user_agent_list.html.erb b/app/views/managements/_user_agent_list.html.erb new file mode 100644 index 00000000..43886c8d --- /dev/null +++ b/app/views/managements/_user_agent_list.html.erb @@ -0,0 +1,66 @@ +
    名称创建教师管理教师 评测次数 学生 实训作业
    <%= course.name %><%= course.username %> + <%= course_managers course.teachers %> + <%= course.evaluating_count %> <%= course.student_count.to_i %> <%= course.hcm_count.to_i %>
    + + + + + + + + + + + + <% @user_agents.each do |ua| %> + <% user = User.find_by_login(ua.key) %> + <% user_extension = user.extensions %> + <% school = user_extension.school %> + + + + + + + + + + <% end %> + +
    ID代理人登录名代理人姓名学校竞赛报名状态ipip负责人
    <%= ua.id %><%= link_to ua.key, user_path(ua.key), :target => "_blank" %><%= link_to user.try(:show_real_name), user_path(user), target:'_blank' %><%= school.name %><%= "--" %><%= ua.ip %><%= "理由" %>
    +
    +
    +
    + +
    +
    +
    + \ No newline at end of file diff --git a/app/views/managements/user_agents.html.erb b/app/views/managements/user_agents.html.erb new file mode 100644 index 00000000..d29e7bec --- /dev/null +++ b/app/views/managements/user_agents.html.erb @@ -0,0 +1,19 @@ +<%= form_tag(url_for(departments_part_managements_path),:id=>"department_part_search",:method => "post",:remote=>true) do %> +
    + + 搜索 + 清除 + <%= link_to "关联代理人",add_departments_part_managements_path(),:class => "task-btn task-btn-green fr mt6 mr30" %> + +
    +<% end %> +
    + <%= render :partial => "managements/user_agent_list" %> +
    + \ No newline at end of file diff --git a/app/views/praise_tread/_new_praise.html.erb b/app/views/praise_tread/_new_praise.html.erb new file mode 100644 index 00000000..facdabad --- /dev/null +++ b/app/views/praise_tread/_new_praise.html.erb @@ -0,0 +1,42 @@ +<% + praised = PraiseTread.praised(object) + praise_num = get_praise_num(object) || 0 +%> +


    <%= praise_num %>

    +

    已赞
    <%= praise_num %>

    + + \ No newline at end of file diff --git a/app/views/users/_returnTop_btn.html.erb b/app/views/users/_returnTop_btn.html.erb index 2fa54020..9bdc31d6 100644 --- a/app/views/users/_returnTop_btn.html.erb +++ b/app/views/users/_returnTop_btn.html.erb @@ -28,4 +28,11 @@ + + +
    + + + +
    \ No newline at end of file diff --git a/config/locales/libraries/zh.yml b/config/locales/libraries/zh.yml index 3dae730c..fd514c72 100644 --- a/config/locales/libraries/zh.yml +++ b/config/locales/libraries/zh.yml @@ -6,3 +6,5 @@ library: title: '标题' content: '描述' + author_name: '作者姓名' + author_school_name: '作者单位名称' diff --git a/config/routes.rb b/config/routes.rb index a92555c1..427b4744 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -537,6 +537,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 resources :managements do collection do + get 'user_agents' get 'evaluate_simple' get 'hidden_course' match 'training_2018',:via=>[:get,:post] diff --git a/db/migrate/20190708024123_add_columns_to_libraries.rb b/db/migrate/20190708024123_add_columns_to_libraries.rb new file mode 100644 index 00000000..50566344 --- /dev/null +++ b/db/migrate/20190708024123_add_columns_to_libraries.rb @@ -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 diff --git a/db/migrate/20190716073605_create_user_agents.rb b/db/migrate/20190716073605_create_user_agents.rb new file mode 100644 index 00000000..22bc181e --- /dev/null +++ b/db/migrate/20190716073605_create_user_agents.rb @@ -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 diff --git a/db/migrate/20190718005920_modify_type_for_user_agents.rb b/db/migrate/20190718005920_modify_type_for_user_agents.rb new file mode 100644 index 00000000..72d4f99b --- /dev/null +++ b/db/migrate/20190718005920_modify_type_for_user_agents.rb @@ -0,0 +1,8 @@ +class ModifyTypeForUserAgents < ActiveRecord::Migration + def up + rename_column :user_agents, :type, :agent_type + end + + def down + end +end diff --git a/public/images/educoder/applys.png b/public/images/educoder/applys.png new file mode 100755 index 00000000..3f4e3018 Binary files /dev/null and b/public/images/educoder/applys.png differ diff --git a/public/images/educoder/competitionslog.png b/public/images/educoder/competitionslog.png new file mode 100755 index 00000000..595f35b3 Binary files /dev/null and b/public/images/educoder/competitionslog.png differ diff --git a/public/images/educoder/library-default-cover.png b/public/images/educoder/library-default-cover.png new file mode 100644 index 00000000..d54b8df0 Binary files /dev/null and b/public/images/educoder/library-default-cover.png differ diff --git a/public/images/educoder/project_packagesHead.jpg b/public/images/educoder/project_packagesHead.jpg new file mode 100644 index 00000000..181045e0 Binary files /dev/null and b/public/images/educoder/project_packagesHead.jpg differ diff --git a/public/images/educoder/roundedRectangle.png b/public/images/educoder/roundedRectangle.png new file mode 100755 index 00000000..0d2d0b0d Binary files /dev/null and b/public/images/educoder/roundedRectangle.png differ diff --git a/public/images/educoder/unite.png b/public/images/educoder/unite.png new file mode 100755 index 00000000..8ebb4984 Binary files /dev/null and b/public/images/educoder/unite.png differ diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js index 47eed534..72105371 100644 --- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js @@ -51,7 +51,7 @@ class PackageConcent extends Component { //否 string 排序,默认最新, ‘recently’, ‘price’ // 否 string 类型, front,backend,mobile,database, cloud_compute_and_big_data,devops_and_test,ai,other componentDidMount() { - window.document.title = '众包社区' + window.document.title = '众包创新' let {category,keyword,sort_by,sort_direction,page}=this.state this.setdatas(category,keyword,sort_by,sort_direction,page) diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageIndex.js b/public/react/src/modules/projectPackages/PackageIndex/PackageIndex.js index 9d51a16b..e6c7cdc9 100644 --- a/public/react/src/modules/projectPackages/PackageIndex/PackageIndex.js +++ b/public/react/src/modules/projectPackages/PackageIndex/PackageIndex.js @@ -11,7 +11,7 @@ class PackageIndex extends Component{ } componentDidMount(){ - window.document.title = '众包社区' + window.document.title = '众包创新' } render() { diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js index 9be5dfb1..0a6aeaa0 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js +++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js @@ -49,7 +49,7 @@ class PackageIndexNEITaskDetails extends Component { componentDidMount() { this.getdatas() - window.document.title = '众包社区' + window.document.title = '众包创新' } getdatas=()=>{ @@ -251,7 +251,7 @@ class PackageIndexNEITaskDetails extends Component { '} className={"fl"}> {/*{this.props.current_user.username}*/} - 众包社区 + 众包创新 {data&&data.title} diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js index 7262c9f6..281fb5be 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js @@ -75,7 +75,7 @@ class PackageIndexNEIBannerConcent extends Component { } componentDidMount() { - window.document.title = '众包社区' + window.document.title = '众包创新' if(this.props.match.params.id!=undefined){ let url=`/api/v1/project_packages/${this.props.match.params.id}.json` diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js index 0e02aa0f..9f287e90 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEISubmit.js @@ -10,7 +10,7 @@ class PackageIndexNEISubmit extends Component { } } componentDidMount() { - window.document.title = '众包社区' + window.document.title = '众包创新' } setageload=(sum)=>{ if(sum===undefined){ diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNewandEditIndex.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNewandEditIndex.js index 6f521bc7..1571fd77 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNewandEditIndex.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNewandEditIndex.js @@ -18,7 +18,7 @@ class PackageIndexNewandEditIndex extends Component{ } componentDidMount(){ - window.document.title = '众包社区' + window.document.title = '众包创新' } setPublicationfun=(ids)=>{ diff --git a/public/react/src/modules/projectPackages/ProjectPackageIndex.js b/public/react/src/modules/projectPackages/ProjectPackageIndex.js index 560a059d..097e012e 100644 --- a/public/react/src/modules/projectPackages/ProjectPackageIndex.js +++ b/public/react/src/modules/projectPackages/ProjectPackageIndex.js @@ -32,7 +32,7 @@ class ProjectPackageIndex extends Component { } componentDidMount(){ - window.document.title = '众包社区' + window.document.title = '众包创新' } render() { diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 4aa4aaa0..5a1e0e8f 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -5,6 +5,8 @@ import PropTypes from 'prop-types'; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import { Modal} from 'antd'; + // import searchImg from '../../../../images/educoder/icon/search.svg' // /images/educoder/icon/search.svg @@ -134,7 +136,8 @@ class NewHeader extends Component { ImageUrl:"", ecUrl:null, project_packages_url:null, - ImageUrlType:false + ImageUrlType:false, + competitiontype:false } } 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() { let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state; // const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 @@ -246,6 +270,7 @@ class NewHeader extends Component { let activeCareers = false; let activeCourses = false; let competitions = false; + let crowdsourcing=false; if (match.path === '/forums') { activeForums = true; } else if (match.path.startsWith('/shixuns')) { @@ -258,6 +283,8 @@ class NewHeader extends Component { activeCourses=true; }else if(match.path.startsWith('/competitions')){ competitions=true; + }else if(match.path.startsWith('/crowdsourcing')){ + crowdsourcing=true }else{ activeIndex = true; } @@ -268,6 +295,45 @@ class NewHeader extends Component { // console.log(match.path.startsWith("/ec_courses")) return (
    + + + + +
    +
    + + this.competitionfun()} id="closeIcon" + style={{position: "absolute",right: "-20px",top: "36px"}} + > + + + + + + this.setcompetitionfun()}> + + + +
    +
    +
    {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} @@ -299,12 +365,17 @@ class NewHeader extends Component {
    - {/*
  • 教学案例
  • */} -
  • 在线竞赛
  • -
  • +
  • + 在线竞赛 + +
  • + +
  • 教学案例
  • + +
  • - {project_packages_url===null||project_packages_url===undefined||project_packages_url===""?'':'众包'} + {project_packages_url===null||project_packages_url===undefined||project_packages_url===""?'':'众包创新'}
  • 交流问答
  • @@ -461,11 +532,3 @@ class NewHeader extends Component { export default NewHeader; - -// diff --git a/public/react/src/modules/tpm/SiderBar.js b/public/react/src/modules/tpm/SiderBar.js index 1710752d..fd74c759 100644 --- a/public/react/src/modules/tpm/SiderBar.js +++ b/public/react/src/modules/tpm/SiderBar.js @@ -17,37 +17,47 @@ class SiderBar extends Component { render() { return ( -
    -
    - - - -
    - -
    - - - -
    - -
    - -
    -
    - -

    微信扫一扫

    -

    关注公众号

    - -
    -
    -
    -
    - - - -
    - -
    +
    + +
    +
    + + + +
    + +
    + + + +
    + +
    + +
    +
    + +

    微信扫一扫

    +

    关注公众号

    + +
    +
    +
    +
    + + + +
    +
    + +
    + + + +
    + +
    ); } } diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 2822c384..0c3c23ce 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -2,7 +2,7 @@ /*头部导航条样式---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 .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 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} @@ -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;} .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;} -.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;} .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; } .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{ position: relative;margin-right: 30px;float: left;line-height: 35px;font-size: 16px;width: 32px; } diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index 33059917..6b8af902 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -1138,4 +1138,119 @@ html>body #ajax-indicator { position: fixed; } width: 73px; height: 30px; 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; } \ No newline at end of file diff --git a/spec/factories/user_agents.rb b/spec/factories/user_agents.rb new file mode 100644 index 00000000..c8afcb41 --- /dev/null +++ b/spec/factories/user_agents.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :user_agent do + type 1 + key "MyString" + ip "MyString" + end +end diff --git a/spec/models/user_agent_spec.rb b/spec/models/user_agent_spec.rb new file mode 100644 index 00000000..20fd5cf3 --- /dev/null +++ b/spec/models/user_agent_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe UserAgent, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end