# Conflicts:
#	public/stylesheets/educoder/edu-main.css
dev_aliyun
hjm 6 years ago
commit 2107b875b7

@ -1188,4 +1188,12 @@ class ApplicationController < ActionController::Base
logger.info "----------------------- handle_flag: #{flag} -------------------------"
flag
end
# 用户是否完善资料
def check_account
if !User.current.profile_completed?
redirect_to my_account_path(need_profile_completed: true)
end
end
end

@ -17,7 +17,8 @@ class CompetitionTeamsController < ApplicationController
@team_user_ids = @team.team_members.pluck(:user_id)
shixuns = Shixun.where(user_id: @team_user_ids, status: 2).where('shixuns.created_at > ?', Time.parse('2018-06-01'))
shixuns = Shixun.where(user_id: @team_user_ids, status: 2)
.where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), @competition.end_time)
shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2')
shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count')
@shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator)
@ -30,18 +31,30 @@ class CompetitionTeamsController < ApplicationController
forked_myshixun_count_map = get_valid_myshixun_count(forked_shixun_map.keys)
forked_myshixun_count_map.each { |k, v| @myshixun_count_map[forked_shixun_map[k]] += v }
# todo使用新版course_members
@course_count_map = get_valid_course_count(shixun_ids)
forked_map = get_valid_course_count(forked_shixun_map.keys)
@forked_course_count_map = {}
forked_map.each do |forked_id, course_count|
@forked_course_count_map[forked_shixun_map[forked_id]] ||= 0
@forked_course_count_map[forked_shixun_map[forked_id]] += course_count
end
# 课堂
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.where('courses.created_at <= ?', @competition.end_time)
.joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)')
.where(course_members: { user_id: @team_user_ids }).pluck(:id)
courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()')
@courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count')
.group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0')
course_ids = @courses.map(&:id)
@course_myshixun_map = Myshixun.joins(student_works: :homework_common)
.where(homework_commons: { course_id: @courses.map(&:id) })
.where(homework_commons: { course_id: course_ids })
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('homework_commons.course_id').count
@course_shixun_count_map = get_valid_shixun_count(course_ids)
end
def search_teacher
@ -345,6 +358,28 @@ class CompetitionTeamsController < ApplicationController
.group('shixun_id').count
end
def get_valid_course_count(ids)
percentage_sql = StudentWork.where('homework_common_id = homework_commons.id')
.select('count(compelete_status !=0 ) as finish, count(*) as total')
.having('finish > (total / 2)').to_sql
Course.joins(shixun_homework_commons: :homework_commons_shixuns)
.where('shixun_id in (?)', ids)
.where("exists (#{percentage_sql})")
.group('shixun_id').count
end
def get_valid_shixun_count(ids)
percentage_sql = StudentWork.where('homework_common_id = homework_commons.id')
.select('count(compelete_status !=0 ) as finish, count(*) as total')
.having('finish > (total / 2)').to_sql
Shixun.joins(homework_commons_shixuns: :homework_common)
.where(homework_commons: { homework_type: 3 })
.where('course_id in (?)', ids)
.where("exists (#{percentage_sql})")
.group('course_id').count
end
def record_agent_user_action
# 记录是否是引流用户的行为
ip = request.remote_ip

@ -145,7 +145,7 @@ class CompetitionsController < ApplicationController
section = stage.competition_stage_sections.reorder("start_time asc").first
if section.present? && section.start_time.present? && section.start_time > Time.now
User.where(:id => TeamMember.where(:competition_team_id => @competition.competition_teams.pluck(:id)).pluck(:user_id).uniq).each do |user|
name = @competition.name + "#{stage.name}"
name = @competition.name + "#{@competition.sub_title}#{stage.name}"
begin
if user.phone.present?
status = Trustie::Sms.send(mobile: user.phone.to_s, code: '1', send_type:'competition_start', user_name:user.show_name, name:name, result:section.start_time.strftime('%Y-%m-%d %H:%M:%S'))
@ -246,14 +246,14 @@ class CompetitionsController < ApplicationController
# 第一阶段的得分和耗时
challenges_1 = Challenge.where(:shixun_id => shixun1_id)
challenge_rate1 = 0.5
result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1
result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1, 3
score1 = result1[0]
time1 = result1[1]
# 第二阶段的得分和耗时
challenge_rate2 = 1.0
challenges_2 = Challenge.where(:shixun_id => shixun2_id)
result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2
result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2, 3
score2 = result2[0]
time2 = result2[1]
@ -316,6 +316,92 @@ class CompetitionsController < ApplicationController
rank = @records.map(&:id).index(team.id)
team[:rank] = rank.present? ? (rank+1) : 0
end
elsif @competition.identifier == 'gcc-task-2019'
if @type == "预赛" || @type == "决赛"
if @type == "预赛"
# 'nyog9r7c','yugrij4n','48flws5g','bfgau7s6','mfv6zrj7','f398leqr','qwaffs2p','ose7482b','y5wh2ofx'
# 预赛的实训id 第一阶段118511971195 第二阶段1202, 1210, 1207 第三阶段125412551243
shixun1_id = [2303]
shixun2_id = [2994, 3012, 3024]
shixun3_id = [2944, 2938, 2943]
elsif @type == "决赛"
# '92b7vt8x','a7fxenvc','wt2xfzny','xa4m9cng','tng6heyf','am5o73er','9fla2zry','fzp3iu4w','qlsy6xb4'
# 预赛的实训id 第一阶段128913731256 第二阶段1488, 1453, 1487 第三阶段1470, 1473, 1408
shixun1_id = Shixun.where(:identifier => ['92b7vt8x','a7fxenvc','wt2xfzny']).pluck(:id)
shixun2_id = Shixun.where(:identifier => ['xa4m9cng','tng6heyf','am5o73er']).pluck(:id)
shixun3_id = Shixun.where(:identifier => ['9fla2zry','fzp3iu4w','qlsy6xb4']).pluck(:id)
end
if @competition.competition_scores.where(:competition_stage_id => @stage.id).count == 0
# 三个阶段的开始时间和结束时间
s1_time = @stage.competition_stage_sections[0].start_time
e1_time = @stage.competition_stage_sections[0].end_time
s2_time = @stage.competition_stage_sections[1].start_time
e2_time = @stage.competition_stage_sections[1].end_time
s3_time = @stage.competition_stage_sections[2].start_time
e3_time = @stage.competition_stage_sections[2].end_time
@records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]])
@records.each do |team|
user_ids = team.team_members.where(:is_teacher => 0).pluck(:user_id)
# 第一阶段的得分和耗时
challenges_1 = Challenge.where(:shixun_id => shixun1_id)
challenge_rate1 = 1.0
result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1, 2
score1 = result1[0]
time1 = result1[1]
# 第二阶段的得分和耗时
challenge_rate2 = 1.0
challenges_2 = Challenge.where(:shixun_id => shixun2_id)
result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2, 2
score2 = result2[0]
time2 = result2[1]
# 第三阶段的得分和耗时
challenges_3 = Challenge.where(:shixun_id => shixun3_id)
result3 = chart_exp_score_third user_ids, s3_time, e3_time, challenges_3
score3 = result3[0]
time3 = result3[1]
team[:s_score] = (score1 + score2 + score3).try(:round, 2)
team[:s_spend_time] = time1 + time2 + time3
# 比赛已截止且未有分数纪录 则创建
if Time.now > e3_time && team.competition_scores.where(:competition_id => @competition.id, :competition_stage_id => @stage.id).count == 0
CompetitionScore.create(:user_id => team.user_id, :competition_team_id => team.id, :competition_id => @competition.id, :competition_stage_id => @stage.id, :score => team[:s_score], :cost_time => team[:s_spend_time])
end
end
else
@records = CompetitionTeam.find_by_sql("SELECT teams.*, cs.score AS s_score, cs.cost_time AS s_spend_time FROM competition_teams teams, competition_scores cs WHERE cs.competition_team_id = teams.`id` AND cs.competition_stage_id = '#{@stage.id}'")
end
elsif @type == "总排行榜"
pre_stage = @competition.competition_stages.where(:name => "预赛").first
final_stage = @competition.competition_stages.where(:name => "决赛").first
@records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]])
@records.each do |team|
# 决赛记录
f_score = team.competition_scores.where(:competition_stage_id => final_stage.try(:id)).first
# 预赛记录
p_score = team.competition_scores.where(:competition_stage_id => pre_stage.try(:id)).first
team[:s_score] = (f_score.try(:score).to_f * 0.85 + p_score.try(:score).to_f * 0.15).try(:round, 2)
team[:s_spend_time] = f_score.try(:cost_time).to_i + p_score.try(:cost_time).to_i
end
end
@records = @records.sort do |a, b|
[b[:s_score], a[:s_spend_time]] <=> [a[:s_score], b[:s_spend_time]]
end
current_team_ids = @competition.team_members.where(:user_id => User.current.id).pluck(:competition_team_id).uniq
@user_ranks = @records.select{|com_team| current_team_ids.include?(com_team.id)}
@records = @records.select{|record| record[:s_score] > 0}
@user_ranks.each do |team|
rank = @records.map(&:id).index(team.id)
team[:rank] = rank.present? ? (rank+1) : 0
end
records_length = 97
@records = @records[0..records_length]
end
else
render_403
@ -366,8 +452,10 @@ class CompetitionsController < ApplicationController
sheet1[count_row,11] = com_spend_time user[:s_spend_time].to_i
count_row += 1
end
elsif @competition.identifier == "gcc-dev-2018"
elsif @competition.identifier == "gcc-dev-2018" || @competition.identifier == "gcc-task-2019"
records = @competition.competition_teams
f_rate = @competition.identifier == "gcc-dev-2018" ? 0.85 : 0.8
p_rate = @competition.identifier == "gcc-dev-2018" ? 0.15 : 0.2
records.each do |team|
# 决赛记录
f_score = team.competition_scores.where(:competition_stage_id => @competition.competition_stages.where(:name => "决赛").first.try(:id)).first
@ -377,7 +465,7 @@ class CompetitionsController < ApplicationController
team[:p_time] = p_score.try(:cost_time)
team[:f_score] = f_score.try(:score)
team[:f_time] = f_score.try(:cost_time)
team[:s_score] = (f_score.try(:score).to_f * 0.85 + p_score.try(:score).to_f * 0.15).try(:round, 2)
team[:s_score] = (f_score.try(:score).to_f * f_rate + p_score.try(:score).to_f * p_rate).try(:round, 2)
team[:s_spend_time] = f_score.try(:cost_time).to_i + p_score.try(:cost_time).to_i
end
records = records.sort do |a, b|
@ -655,11 +743,12 @@ class CompetitionsController < ApplicationController
# challenges 每阶段三个实训的所有关卡
# s_time 阶段开始时间 e_time 阶段结束时间
# rate 关卡经验值与分数的比值
# challenge_count 每个实训的关卡数
# 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时
def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate
def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate, challenge_count
total_score = 0
total_time = 0
length = challenges.size / 3 #每个实训的关卡数
length = challenge_count #每个实训的关卡数
for i in 1..length
score = 0
time = 0
@ -693,7 +782,7 @@ class CompetitionsController < ApplicationController
challenges.each do |challenge|
Game.where(:challenge_id => challenge.id, :user_id => user_ids, :status => 2).select{|game| game.open_time >= s_time && game.end_time <= e_time }.each do |game|
outputs = game.outputs.select{|output| !output.text_scor.nil? }
outputs = game.outputs.select{|output| !output.text_scor.nil? && output.created_at <= e_time }
if outputs.present?
outputs = outputs.sort { |a, b| b[:text_scor].to_f <=> a[:text_scor].to_f }
myshixun_score = outputs.first.text_scor.to_f

@ -239,7 +239,7 @@ class EcYearsController < ApplicationController
template_file = EcTemplate.find_by_name "课程列表导入模板"
if template_file.present?
file = template_file.attachments.first
@file_url = '' #"/attachments/download/#{file.id}/#{file.filename}"
@file_url = "/attachments/download/#{file.id}/#{file.filename}"
else
@file_url = "javascript:void(0);"
end

@ -58,8 +58,7 @@ class EcsController < ApplicationController
# 获取工程认证头部url
# GET: /ecs/get_navigation_url
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
ec_url = "#{department_ecs_path(:school_id => User.current.ec_school)}" if User.current.ec_school.present?
render :json => {ec_url: ec_url, project_packages_url: "/crowdsourcing" }
end

@ -1,7 +1,9 @@
class LibrariesController < ApplicationController
include ApplicationHelper
layout 'base_library'
before_filter :require_login, :except => [:index, :show]
before_filter :check_account, only: [:new, :create]
after_filter :increment_visit_count, only: [:show, :create, :edit, :update]
def index

@ -3,7 +3,7 @@ class ManagementsController < ApplicationController
before_filter :require_business
before_filter :require_admin, :only => [:shixun_setting_list, :mirror_repository, :mirror_picture_shixuns, :editmd_template,
:editmd_template, :subject_level_system, :subject_setting_list,
:shixun_authorization, :ec_template, :codemirror_template, :update_user,
:shixun_authorization, :ec_template, :codemirror_template,
:course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner,
:training_2018, :create_standard]
layout 'base_management'
@ -220,6 +220,9 @@ class ManagementsController < ApplicationController
@user.nickname = params[:nickname]
@user.lastname = params[:lastname]
@user.business = params[:business].to_i
if params[:admin]
@user.admin = params[:admin].to_i
end
@user.firstname = ""
@user.mail = params[:mail].strip == "" ? nil : params[:mail]
@user.phone = params[:phone].strip == "" ? nil : params[:phone]
@ -1102,12 +1105,12 @@ end
school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id)
school_ids = school_ids.size == 0 ? "(-1)" : "(" + school_ids.join(",") + ")"
location = params[:location] && params[:location] != "0" ? params[:location] : ""
@team_members = @team_members.where("user_extensions.school_id in #{school_ids} and schools.province like '%#{location}%'")
@team_members = @team_members.includes(user: { user_extensions: :school }).where("user_extensions.school_id in #{school_ids} and schools.province like '%#{location}%'")
end
@page = params[:page] || 1
@team_members = @team_members.reorder("team_members.created_at #{@order}")
all_members = @team_members
@team_members = paginateHelper(@team_members.includes(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50)
@team_members = paginateHelper(@team_members.preload(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50)
respond_to do |format|
format.js
format.html
@ -1661,7 +1664,8 @@ end
# 删除单位
def delete_school
school = School.where(:id => params[:school]).first
UserExtensions.where(:school_id => params[:school]).update_all(:school_id => nil, :department_id => nil)
UserExtensions.where(:school_id => params[:school]).update_all(school_id: nil, department_id: nil)
User.joins(:user_extension).where(user_extensions: {school_id: params[:school]}).update_all(profile_completed: false)
ApplyAddSchools.where(:school_id => params[:school]).destroy_all
ApplyAddDepartment.where(:school_id => params[:school]).destroy_all
school.destroy
@ -1752,7 +1756,7 @@ end
Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason])
# 删除学校的用户
users = UserExtensions.where("department_id = #{applied_department.department_id}")
users.update_all(:department_id => nil)
users.update_all(department_id: nil, profile_completed: false)
applied_department.department.destroy
# 已审批删除
elsif params[:tip] == "applied"
@ -1866,6 +1870,7 @@ end
# 删除学校的用户
users = UserExtensions.where("school_id = #{applied_school.school_id}")
User.where(id: users.map(&:user_id)).update_all(profile_completed: false)
# 申请了职业认证的用户撤销申请
apply_user_auth = ApplyUserAuthentication.where(:user_id => users.map(&:user_id), :auth_type => 2, :status => 0)
@ -2936,12 +2941,12 @@ end
else
for row in 2 .. rows
student_id = worksheet.cell(row, 1)
student_id = student_id.is_a?(Float) ? student_id.to_i : student_id
student_id = student_id.is_a?(Float) ? student_id.to_s.strip.to_i : student_id.to_s.strip
member_role = worksheet.cell(row, 4).to_i
course_id = worksheet.cell(row, 3)
group_name = worksheet.cell(row, 5)
school_id = worksheet.cell(row, 6).is_a?(Float) ? worksheet.cell(row, 6).to_i : worksheet.cell(row, 6)
if student_id && member_role && [9, 7, 10].include?(member_role) && course_id && school_id
if student_id && member_role && [2, 3, 4].include?(member_role) && course_id && school_id
user = User.find_by_sql("SELECT u.* FROM `users` u, `user_extensions` ue where u.id = ue.user_id and
ue.student_id = '#{student_id}' and ue.school_id= #{school_id}").first
course = Course.where(:id => course_id).first
@ -2950,18 +2955,19 @@ end
course_group = CourseGroup.where(:course_id => course.id, :name => group_name).first ||
CourseGroup.create(:name => group_name, :course_id => course.id) if group_name
member = course.course_members.where(:user_id => user.id, :role => 4).first
member = course.course_members.where(:user_id => user.id, :role => member_role).first
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
if member.present? && member.course_group_id != course_group.try(:id).to_i
if member.present? && member.role == 4 && member.course_group_id != course_group.try(:id).to_i
member.update_column("course_group_id", course_group.try(:id).to_i)
member_count += 1
elsif !member.present?
member = CourseMember.new(:role => 4, :user_id => user.id)
member = CourseMember.new(:role => member_role, :user_id => user.id)
# if member_role == 10
# StudentsForCourse.create(:student_id => user.id, :course_id => course.id)
# end
extra = member_role == 2 ? 9 : (member_role == 3 ? 7 : 10)
Tiding.create(:user_id => user.id, :trigger_user_id => course.tea_id, :container_id => course.id, :container_type => 'TeacherJoinCourse',
:belong_container_id => course.id, :belong_container_type => "Course", :tiding_type => "System", :extra => member_role)
:belong_container_id => course.id, :belong_container_type => "Course", :tiding_type => "System", :extra => extra)
member.course_group_id = course_group.try(:id).to_i
course.course_members << member
@ -3006,7 +3012,7 @@ end
if index == 0
school_id = list[0]
elsif index == 1
prefix = list[0]
prefix = list[0].to_s.strip
elsif index != 2 && list[3] && [0, 1, 2].include?(list[3].to_i)
if list[3].to_i == 1
user = User.find_by_sql("SELECT u.* FROM `users` u, `user_extensions` ue where u.id = ue.user_id and ue.identity = 1 and ue.student_id = '#{list[0]}' and ue.school_id= #{school_id.to_i}").first
@ -3020,15 +3026,16 @@ end
user = User.new
user.admin = false
user.activate
user.login = prefix + list[0]
user.lastname = list[1]
user.nickname = list[1]
user.login = prefix + list[0].to_s.strip
user.lastname = list[1].to_s.strip
user.nickname = list[1].to_s.strip
user.professional_certification = 1
user.certification = 1
user.grade = 0
user.password = "12345678"
user.phone = list[5].blank? ? nil : list[5]
if user.save
ue = UserExtensions.new(:user_id => user.id, :gender => 0, :school_id => school_id, :location => school.province, :location_city => school.city, :identity => list[3], :student_id => list[0], :department_id => department.try(:id))
ue = UserExtensions.new(:user_id => user.id, :gender => 0, :school_id => school_id, :location => school.province, :location_city => school.city, :identity => list[3].to_i, :student_id => list[0].to_s.strip, :department_id => department.try(:id))
if list[3] && list[3].to_i == 0
ue.technical_title = ["教授", "副教授", "讲师", "助教"].include?(list[4]) ? list[4] : "讲师"
elsif list[3] && list[3].to_i == 2
@ -3418,7 +3425,7 @@ end
users = users.where(schools: { province: params[:province] })
end
users = users.select('distinct users.*').order("last_login_on desc")
users = users.select('distinct users.*')
@page = (params['page'] || 1).to_i
@users_count = users.count
@ -3426,16 +3433,17 @@ end
@is_remote = true
@users_pages = Paginator.new @users_count, @limit, params['page'] || 1
@offset ||= @users_pages.offset
@users = paginateHelper users.preload(:real_name_authentication_apply, :professional_authentication_apply,
@users = paginateHelper users.order("last_login_on desc").preload(:real_name_authentication_apply, :professional_authentication_apply,
user_extensions: [:department, :school]), @limit
respond_to do |format|
format.js
format.xls{
# @export_shixun_task = @export_shixun_task.all
@xls_users = users.reorder("created_on desc").limit(3000) #导出excel用户
@xls_users = users.limit(3000) #导出excel用户
@xls_users = @xls_users.includes(:real_name_authentication_apply, :professional_authentication_apply,
user_extensions: [:department, :school])
filename = "用户列表.xls"
send_data(user_list_xls(@xls_users), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
@ -3692,7 +3700,7 @@ end
diskfile1 = disk_filename("UserAuthentication", apply_user.user_id) +"ID"
apply_user.update_attributes(:is_delete => true)
File.delete(diskfile1)
File.delete(diskfile1) if File.exist?(diskfile1)
=begin
begin

@ -159,20 +159,20 @@ class MyController < ApplicationController
# 认证
@trail_authentication = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").order("created_at desc").first
if @trail_authentication && (@trail_authentication.status == 1 || @trail_authentication.status == 2) && !@trail_authentication.noticed
@noticed_result = true
@trail_authentication.update_attribute("noticed", 1)
elsif @user.certification != 1 && (@trail_authentication.nil? || @trail_authentication.try(:status) != 0)
first_update = Grade.where(:user_id => @user.id, :container_id => @user.id, :container_type => 'Account').first
if first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400 && @user.user_day_certifications.last.present? && @user.user_day_certifications.last.status == 1
@require_trail_auth = true
@user.user_day_certifications.update_all("status = 2")
@certification_expired = 1
elsif first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400
@require_trail_auth = true
end
end
# @trail_authentication = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").order("created_at desc").first
# if @trail_authentication && (@trail_authentication.status == 1 || @trail_authentication.status == 2) && !@trail_authentication.noticed
# @noticed_result = true
# @trail_authentication.update_attribute("noticed", 1)
# elsif @user.certification != 1 && (@trail_authentication.nil? || @trail_authentication.try(:status) != 0)
# first_update = Grade.where(:user_id => @user.id, :container_id => @user.id, :container_type => 'Account').first
# if first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400 && @user.user_day_certifications.last.present? && @user.user_day_certifications.last.status == 1
# @require_trail_auth = true
# @user.user_day_certifications.update_all("status = 2")
# @certification_expired = 1
# elsif first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400
# @require_trail_auth = true
# end
# end
=begin
if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || (ue.try(:identity) == 1 && ue.try(:student_id).blank?) || (ue.try(:identity) != 1 && ue.try(:technical_title).blank?) || ue.try(:location).nil? || ue.try(:location_city).nil? || ue.try(:gender).nil? || ue.try(:school_id).nil?

@ -1,10 +1,11 @@
# encoding=utf-8
# For react
class ProjectPackagesController < ApplicationController
before_filter :require_login, :except => [:index, :show]
include ApplicationHelper
before_filter :require_login, except: [:index]
before_filter :check_account, only: [:new, :create]
def show
render_react
end

@ -30,6 +30,7 @@ class ProjectsController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
skip_before_filter :check_if_login_required, :only => [:training_task_status]
before_filter :check_authentication
before_filter :check_account, only: [:new, :create]
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,
:view_homework_attaches,:join_project, :project_home, :training_execute, :training_task_status]
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]

@ -126,21 +126,26 @@ class SchoolController < ApplicationController
chinese << char
end
end
if pinyin.size > 0
search_str = "name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'"
else
search_str = "name like '%#{chinese.join("")}%'"
end
if params[:no_school_ids]
if(condition == '')
@school = School.where("id not in #{params[:no_school_ids]}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.count
else
@school = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
@school = School.where("id not in #{params[:no_school_ids]} and #{search_str}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where("id not in #{params[:no_school_ids]} and #{search_str}").count
end
else
if(condition == '')
@school = School.reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.count
else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
@school = School.where(search_str).reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where(search_str).count
end
end

@ -54,6 +54,12 @@ class WelcomeController < ApplicationController
end
end
def join_private_courses
@invitation_code = params[:invitation_code]
respond_to do |format|
format.js
end
end
def shixun_to_local
identifiers = params[:identifiers].split(",")

@ -628,18 +628,19 @@ module ApplicationHelper
return
end
=end
user_e = UserExtensions.where(:user_id => User.current.id).first
if User.current.lastname.blank? || user_e.school_id.blank? || user_e.identity.blank? || User.current.mail.blank?
redirect_to my_account_path
Rails.logger.info("check_authentication end")
elsif User.current.certification != 1 # 系统没有授权
day_cer = UserDayCertification.where(:user_id => User.current.id).last
unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
redirect_to my_account_path
Rails.logger.info("check_authentication end")
return
end
end
# 暂时不需要试用授权
# if !User.current.profile_completed?
# redirect_to my_account_path
# Rails.logger.info("check_authentication end")
# elsif User.current.certification != 1 # 系统没有授权
# day_cer = UserDayCertification.where(:user_id => User.current.id).last
# unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
# redirect_to my_account_path
# Rails.logger.info("check_authentication end")
# return
# end
# end
end
def match_specific_symbol(str)

@ -1,22 +1,31 @@
module EcMajorSchoolsHelper
def total_graduation_count year
g_count = EcGraduationSubitem.where(:ec_graduation_requirement_id => year.ec_graduation_requirements).count
def total_graduation_count(year)
g_count = year.ec_graduation_subitems.count
g_count == 0 ? "--" : g_count
# 36
end
def sigle_graduation_count
'--'
# 30
def sigle_graduation_count(ec_year)
return '--' if ec_year.ec_graduation_subitems.count.zero?
subitem_ids = ec_year.ec_graduation_subitems.reorder(nil).pluck(:id)
relations = EcGraduationRequirementCalculation.joins(ec_course_support: :ec_graduation_subitem_courses).where('ec_graduation_subitem_id in (?)', subitem_ids)
reached_map = relations.where(status: true).group('ec_graduation_subitem_id').count
reached_map.keys.size
end
def total_graduation_course_count ec_year
ec_year.ec_courses.count == 0 ? '--' : ec_year.ec_courses.count
# 64
ec_year.ec_courses.count.zero? ? '--' : ec_year.ec_courses.count
end
def sigle_graduation_course_count
'--'
# 60
def sigle_graduation_course_count(ec_year)
return '--' if ec_year.ec_courses.count.zero?
course_ids = ec_year.ec_courses.map(&:id)
target_count_map = EcCourseTarget.where(ec_course_id: course_ids).group(:ec_course_id).count
ec_year.ec_courses.sum { |course| course.complete_target_count == target_count_map[course.id] ? 1 : 0 }
end
end

@ -26,7 +26,7 @@ module WelcomeHelper
def register_info user_agent
case user_agent.register_status
when 0
"IP未登录"
"IP未登录"
when 1
"代理之前注册"
when 2

@ -4,4 +4,82 @@ class CourseMember < ActiveRecord::Base
belongs_to :course, counter_cache: true
belongs_to :user
belongs_to :course_group, counter_cache: true
after_create :create_student_works, :create_exercise_users, :create_poll_users, :create_graduation_works
#加入班级时创建作业的作品
def create_student_works
if role == 4
course = self.course
str = ""
homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_type in (1, 3, 4)")
if homeworks.count != 0
homeworks.each do |hw|
str += "," if str != ""
str += "('#{hw.name}的作品提交',#{hw.id},#{user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
if str != ""
sql = "insert into student_works (name, homework_common_id, user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
end
# 加入班级时创建已发布试卷的作品
def create_exercise_users
if role == 4
course = self.course
str = ""
exercises = course.exercises
if exercises.count != 0
exercises.each do |ex|
str += "," if str != ""
str += "(#{ex.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
if str != ""
sql = "insert into exercise_users (exercise_id, user_id, commit_status, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
end
# 加入班级时创建已发布问卷的作品
def create_poll_users
if role == 4
course = self.course
str = ""
polls = course.polls
if polls.count != 0
polls.each do |poll|
str += "," if str != ""
str += "(#{poll.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
if str != ""
sql = "insert into poll_users (poll_id, user_id, commit_status, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
end
# 创建毕设任务作品
def create_graduation_works
if role == 4
course = self.course
str = ""
tasks = course.graduation_tasks
if tasks.count != 0
tasks.each do |task|
str += "," if str != ""
str += "(#{task.id}, #{user_id}, #{course.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
if str != ""
sql = "insert into graduation_works (graduation_task_id, user_id, course_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
end
end

@ -9,6 +9,7 @@ class EcYear < ActiveRecord::Base
# 毕业要求
has_many :ec_graduation_requirements, :dependent => :destroy
has_many :ec_graduation_subitems, through: :ec_graduation_requirements
# 培养目标
has_one :ec_training_objective, :dependent => :destroy

@ -129,7 +129,8 @@ class Myshixun < ActiveRecord::Base
if current_game.blank?
current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first
end
return current_game
return current_game.blank? ? games.first : current_game
#
# if self.status == 1
# current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first

@ -32,7 +32,7 @@ class Shixun < ActiveRecord::Base
has_many :users, :through => :shixun_members
has_many :shixun_members, :dependent => :destroy
has_one :repository, :dependent => :destroy
has_many :homework_commons_shixunses
has_many :homework_commons_shixuns, class_name: 'HomeworkCommonsShixuns'
has_many :homework_challenge_settings, :dependent => :destroy
has_many :challenges, :dependent => :destroy
has_many :myshixuns, :dependent => :destroy

@ -506,7 +506,7 @@ class CareersService
{username: current_user.show_name, login: current_user.login,
user_id: current_user.id, image_url: url_to_avatar(current_user),
admin: current_user.admin?, is_teacher: current_user.user_extensions.try(:identity) == 0,
tidding_count: count, phone: current_user.phone}
tidding_count: count, phone: current_user.phone, is_student: current_user.user_extensions.try(:identity) == 1}
end
def find_career id

@ -9,12 +9,12 @@
<% if @is_teacher && @is_teacher == 1 %>
<li class="clearfix mb10 none">
<label class="panel-form-label fl">项目邀请码:</label>
<input type="text" style="width: 285px;" class="input-60-40 fl" name="invite_code" value="<%=@project.invite_code %>" placeholder="请输入六位项目邀请码">
<input type="text" style="width: 285px;" class="input-60-40 fl" name="invite_code" value="<%=@project.invite_code %>" placeholder="请输入六位项目邀请码" maxlength="6">
</li>
<% else %>
<li class="clearfix mb10">
<label class="panel-form-label fl">项目邀请码:</label>
<input type="text" style="width: 285px;" class="input-60-40 fl" name="invite_code" placeholder="请输入六位项目邀请码">
<input type="text" style="width: 285px;" class="input-60-40 fl" name="invite_code" placeholder="请输入六位项目邀请码" maxlength="6">
<div class="cl"></div>
</li>
<% end %>

@ -20,11 +20,23 @@
<%
total_myshixun_count = 0
total_forked_myshixun_count = 0
total_shixun_score = 0
%>
<% @shixuns.each do |shixun| %>
<%
total_myshixun_count += shixun.myshixuns_count
total_forked_myshixun_count += shixun['forked_myshixun_count'].to_i
valid_course_count = @course_count_map.fetch(shixun.id, 0)
valid_student_count = @myshixun_count_map.fetch(shixun.id, 0)
score =
if shixun.fork_from.blank?
500 + 50 * valid_course_count + 10 * valid_student_count
else
100 + 10 * valid_course_count + 5 * valid_student_count
end
score += @forked_course_count_map.fetch(shixun.id, 0)
total_shixun_score += score
%>
<tr>
<td width="10%"><%= shixun.creator.show_real_name %></td>
@ -39,7 +51,7 @@
<td width="10%"><%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %></td>
<td width="15%"><%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %></td>
<td width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></td>
<td width="15%">--</td>
<td width="15%"><%= score.zero? ? '--' : score %></td>
</tr>
<% end %>
</tbody>
@ -50,7 +62,7 @@
<th width="10%"><%= total_myshixun_count %></th>
<th width="15%"><%= total_forked_myshixun_count %></th>
<th width="10%"><%= @myshixun_count_map.values.reduce(:+) %></th>
<th width="15%">--</th>
<th width="15%"><%= total_shixun_score %></th>
</tr>
</tfoot>
</table>
@ -73,11 +85,15 @@
<%
total_members_count = 0
total_shixun_homework_count = 0
total_course_score = 0
%>
<% @courses.each do |course| %>
<%
total_members_count += course.members_count.to_i
total_shixun_homework_count += course['shixun_homework_count'].to_i
score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0)
total_course_score += score
%>
<tr>
<td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td>
@ -89,7 +105,7 @@
<td width="10%"><%= course.members_count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>
<td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td>
<td width="15%">--</td>
<td width="15%"><%= score.zero? ? '--' : score %></td>
</tr>
<% end %>
</tbody>
@ -99,8 +115,8 @@
<th width="40%" class="edu-txt-left"><%= @courses.size %></th>
<th width="10%"><%= total_members_count %></th>
<th width="15%"><%= total_shixun_homework_count %></th>
<th width="10%"><%= @course_myshixun_map.values.reduce(:+) %></th>
<th width="15%">--</th>
<th width="10%"><%= @course_myshixun_map.values.reduce(:+) || 0 %></th>
<th width="15%"><%= total_course_score %></th>
</tr>
</tfoot>
</table>

@ -1,134 +1,171 @@
<% index = 0 %>
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1%>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [
[
{
name: 'Java项目',
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法',
link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
},
{
name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
{
name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
],
[{},{},{}],
[{},{},{}]
]
%>
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>">
<% if i.zero? %>
<p class="challenge_title"><%= stage.name %></p>
<% end %>
<ul class="clearfix challenge_sub_title">
<li class="fl">
<span class="mr20"><%= first_section.try(:name) %></span>
<span><%= format_time first_section.start_time %> ~ <%= com_end_time first_section.end_time %></span>
</li>
<li class="fr">
<span class="mr20"><%= second_section.try(:name) %></span>
<span><%= format_time second_section.try(:start_time) %> ~ <%= com_end_time second_section.try(:end_time) %></span>
</li>
</ul>
<p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
<% first_section.competition_entries.each_with_index do |entry, j| %>
<% row_data = data[i][j] %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
<%
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
<p class="challenge_b_d">项目简介</p>
<p class="break-word challenge_b_des"><%= raw row_data[:description] %></p>
<p class="challenge_b_d">标注任务</p>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 60px"><%= row_data[:task] %></p>
<p class="challenge_b_d">经典算法解读:</p>
<ul class="clearfix algorithm">
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
<% end %>
</ul>
</div>
</div>
<% index += 1 %>
<% end %>
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn .setNewBnt.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
<% index = 0 %>
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1%>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [
[
{
name: 'Java项目',
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法',
link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
},
{
name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
{
name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
],
[{
name: 'Java项目',
description: "CoreNLP是一个Java自然语言分析库是斯坦福大学自然语言处理小组的研究成果它集成了所有的自然语言处理工具分词、词性标注、依存句法分析、命名实体识别等。<br/><br/>本项目的stanford/nlp/parser/目录中包含了Lexparser、nndep以及Shiftreduce等句法分析算法的Java实现。",
task: '标注../stanford/nlp/parser/目录下的所有代码文件(包括子目录)。',
link_name: 'CSDN, 使用Stanford Parser进行句法分析',
link_url: 'https://blog.csdn.net/u010239102/article/details/78111760'
},{
name: 'C++项目',
description: "Sentencepiece是Google公司开发的一个C++自然语言处理工具包,它实现了数据驱动、跨语言、高性能、轻量级的面向神经网络文本生成系统的无监督文本词条化工具。<br/><br/>本项目的src/目录中包含了BPE、Unigram以及Char等文本分词算法的C++实现。",
task: '标注../src/目录下的所有.cc和.h代码文件不包括子目录。',
link_name: 'CSDN, sentencePiece入门小结',
link_url: 'https://blog.csdn.net/sinat_33455447/article/details/90265938'
},{
name: 'Python项目',
description: "NLTK是宾西法尼亚大学计算机和信息科学系开发的一个Python自然语言处理工具包它提供了易于使用的接口通过这些接口可以访问超过50个语料库和词汇资源如WordNet还有一套用于分类、标记化、词干标记、解析和语义推理的文本处理库。<br/><br/>本项目的nltk/stem/目录中包含了Lancaster、Porter以及Snowball等文本分词算法的Python实现。",
task: '标注../nltk/stem/目录下的所有代码文件。',
link_name: 'CSDN, 英文分词的算法和原理',
link_url: 'https://blog.csdn.net/wisdom77/article/details/79446674'
}],
[{
name: 'Java项目',
description: "Deeplearning4j是Eclipse公司开发的支持各种深度学习算法的运算框架它可以实施的技术包括受限玻尔兹曼机、深度置信网络、深度自动编码器、堆叠式降噪自动编码器、循环神经张量网络以及word2vec、doc2vec和GloVe等。<br/><br/>本项目的nn/layers/recurrent/目录中包含了循环神经网络RNN中LSTM、Bidirectional LSTM等算法的Java实现。",
task: '标注../nn/layers/recurrent/目录下的所有代码文件。',
link_name: '官方DL4J快速入门指南',
link_url: 'https://deeplearning4j.org/cn/quickstart'
},{
name: 'C++项目',
description: "TensorFlow是谷歌人工智能团队开发的用于机器学习和深度神经网络研究的开源框架它在图形分类、音频处理、推荐系统和自然语言处理等场景下都有丰富的应用提供了丰富的API包括基本的向量矩阵计算、各种优化算法、各种卷积神经网络和循环神经网络基本单元的实现、以及可视化的辅助工具等。<br/><br/>本项目的core/kernels/rnn/目录中包含了循环神经网络RNN中卷积GEMM、LSTM以及GRU算法的C++实现。",
task: '标注../core/kernels/rnn/目录下的所有代码文件。',
link_name: 'CSDN, 深度学习之RNN(循环神经网络)',
link_url: 'https://blog.csdn.net/qq_32241189/article/details/80461635'
},{
name: 'Python项目',
description: "Keras是Google公司开发的高度模块化的神经网络学习框架它是一个高层神经网络API能够支持简易和快速的原型设计支持CNN和RNN或二者的结合且能够支持无缝CPU和GPU切换。<br/><br/>本项目的keras/layers/目录中包含了神经网络运算层中Embedding、CNN以及RNN等算法的Python实现。",
task: '标注../keras/layers/目录下的所有代码文件。',
link_name: '官方, Keras说明文档',
link_url: 'https://keras.io/layers/about-keras-layers/'
}]
]
%>
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>">
<p class="challenge_title"><%= index == 2 ? '经典算法阅读与标注' : index == 3 ? '自然语言处理NLP' : '深度学习框架' %></p>
<ul class="clearfix challenge_sub_title">
<li class="fl">
<span class="mr20"><%= first_section.try(:name) %></span>
<span><%= format_time first_section.start_time %> ~ <%= com_end_time first_section.end_time %></span>
</li>
<li class="fr">
<span class="mr20"><%= second_section.try(:name) %></span>
<span><%= format_time second_section.try(:start_time) %> ~ <%= com_end_time second_section.try(:end_time) %></span>
</li>
</ul>
<p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
<% first_section.competition_entries.each_with_index do |entry, j| %>
<% row_data = data[i][j] %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
<%
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
<p class="challenge_b_d">项目简介</p>
<p class="break-word challenge_b_des"><%= raw row_data[:description] %></p>
<p class="challenge_b_d">标注任务</p>
<% if index ==2 %>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 60px"><%= row_data[:task] %></p>
<% else %>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 80px"><%= row_data[:task] %></p>
<% end %>
<p class="challenge_b_d">经典算法解读:</p>
<ul class="clearfix algorithm">
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
<% end %>
</ul>
</div>
</div>
<% index += 1 %>
<% end %>
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn .setNewBnt.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
</script>

@ -1,7 +1,7 @@
<div id="competition-header" class="clearfix">
<a href="/" style="margin: 10px 20px; display: inline-block;">
<a href="/" style="margin: 10px 0; display: inline-block;">
<img alt="高校智能化教学与实训平台" class="logoimg"
src="/images/educoder/headNavLogo.png?1526520218" style="width:40px">
src="/images/educoder/headNavLogo.png?1526520218" style="margin-top:6px">
</a>
<div class="inline fr">
<ul class="nav-game fl">
@ -68,7 +68,7 @@
<div class="nav-border"><p id="nav-white"></p></div>
</ul>
<div class="fr edu-menu-panel ml15" style="height:60px;">
<div class="fr edu-menu-panel" 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" %>
<ul class="edu-menu-list edu-menu-lists" style="top:60px;">

@ -17,6 +17,7 @@
first_stage = @competition.competition_stages.first
first_section = first_stage.competition_stage_sections.first
first_entry = first_section.competition_entries.first
second_entry = first_section.competition_entries.second
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{first_entry.url}?eid=#{User.current.id}" : "#{first_entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
@ -44,8 +45,8 @@
user_enrolled = false
invite_code = nil
if first_entry.url.present?
course_id = first_entry.url.split('/')[-2, 1]
if first_entry.url.present? && second_entry.url.present?
course_id = second_entry.url
course = Course.find_by_id(course_id)
if course.present? && @user && @user.logged?
@ -56,6 +57,14 @@
%>
var userEnrolled = <%= user_enrolled %>;
var userProfileModal = function(url, str) {
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="'+ url +'" class="task-btn task-btn-orange fr" target="_blank" onclick="hideModal();">立即完善</a></div></div>';
pop_box_new(htmlvalue, 480, 205);
}
$(".enroll-btn.active").on("click", function(){
var url = $(this).data("url");
@ -64,6 +73,11 @@
return;
}
if (<%= !@user.profile_completed? %>) {
userProfileModal('/my/account?need_profile_completed=true', '您需要去完善您的个人资料,才能使用此功能');
return
}
if (!userEnrolled) {
$.ajax({
url: "/api/courses/apply_to_join_course.json",

@ -1,4 +1,4 @@
<% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" %>
<% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-task-2019" %>
<div class="competion-ranking">
<div class="ranking-nav edu-txt-center clearfix">
<div class="inline">
@ -13,7 +13,7 @@
<% end %>
<% @max_min_stage.reverse.each do |section| %>
<% stage = section.competition_stage %>
<% if stage.name != "模拟赛" %>
<% if stage.name != "模拟赛" && !stage.name.blank? %>
<% if section.min_start_time < Time.now %>
<li class="<%= @type == stage.name ? "active" : "" %>"><a href="<%= charts_competition_path(@competition, :stage_id => stage.id) %>" data-remote="true"><%= stage.name %>排行榜</a></li>
<% end %>

@ -5,8 +5,10 @@
<% if @maximum_staff > 1 %>
<p class="sub_title"><%= @competition.sub_title %></p>
<p class="edu-txt-right inline mt20">
<% unless User.current.logged? %>
<% if !User.current.logged? %>
<%= link_to "创建战队", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %>
<% elsif !User.current.try(:profile_completed?) %>
<%= link_to "创建战队", 'javascript:void(0)', :class => "enroll-in-b enroll-in-b-green fr", onclick: "userProfileModal()" %>
<% else %>
<% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if !@can_enroll %>
@ -19,8 +21,10 @@
<% end %>
<% end %>
<% unless User.current.logged? %>
<% if !User.current.logged? %>
<%= link_to "加入战队", signin_path, :remote => true, :class => "enroll-in-b fr" %>
<% elsif !User.current.try(:profile_completed?) %>
<%= link_to "加入战队", 'javascript:void(0)', :class => "enroll-in-b fr", onclick: "userProfileModal()" %>
<% else %>
<% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if !@can_enroll %>
@ -153,6 +157,14 @@
pop_box_new(htmlvalue, 500, 205);
}
function userProfileModal() {
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">您需要去完善您的个人资料,才能使用此功能</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="/my/account?need_profile_completed=true" class="task-btn task-btn-orange fr" onclick="hideModal();">立即完善</a></div></div>';
pop_box_new(htmlvalue, 480, 205);
}
function joinSure() {
if ($("#codeinput").val().trim() == "") {
$("#codeInput-notice").html("请输入邀请码");

@ -27,22 +27,30 @@
<%= courses > 0 ? courses : @btn_text %>
</a>
</span>
<%
reached_graduation_count = sigle_graduation_count(year)
graduation_count = total_graduation_count(year)
graduation_reached = reached_graduation_count.to_i == graduation_count.to_i
reached_course_count = sigle_graduation_course_count(year)
course_count = total_graduation_course_count(year)
%>
<span class="column-6 fl">
<a href="javascript:void(0)" class="color-grey-c" data-tip-down="<%= sigle_graduation_course_count %> 已达成课程 / <%= total_graduation_course_count(year) %> 总课程"><%= sigle_graduation_course_count %> / <%= total_graduation_course_count(year) %></a>
<a href="javascript:void(0)" class="color-grey-c" data-tip-down="<%= reached_course_count %> 已达成课程 / <%= course_count %> 总课程"><%= reached_course_count %> / <%= course_count %></a>
</span>
<span class="column-5 fl edu-txt-center task-hide">
<a href="javascript:void(0)" data-tip-down="<%= sigle_graduation_count %> 已达成毕业要求指标点 / <%= total_graduation_count(year) %> 总毕业要求指标点" class="<%= sigle_graduation_count == total_graduation_count(year) ? 'color-green' : 'color-orange' %>">
<%= sigle_graduation_count %> / <%= total_graduation_count(year) %>
<a href="javascript:void(0)" data-tip-down="<%= reached_graduation_count %> 已达成毕业要求指标点 / <%= graduation_count %> 总毕业要求指标点" class="<%= graduation_count != "--" && graduation_reached ? 'color-green' : 'color-orange' %>">
<%= reached_graduation_count %> / <%= graduation_count %>
</a>
</span>
<span class="column-5 fl edu-txt-center <%= (total_graduation_count(year) != "--" && sigle_graduation_count == total_graduation_count(year)) ? 'color-green' : 'color-orange' %>">
<% if year.ec_courses.count == 0 %>
--
<span class="column-5 fl edu-txt-center <%= graduation_count != "--" && graduation_reached ? 'color-green' : 'color-orange' %>">
<% if year.ec_courses.count == 0 || graduation_count == "--" %>
--
<% else %>
<%= sigle_graduation_count == total_graduation_count(year) ? '已达成' : '未达成' %>
<%= graduation_reached ? '已达成' : '未达成' %>
<% end %>
</span>
<span class="column-5 fl edu-txt-center <%= (total_graduation_count(year) != "--" && sigle_graduation_count == total_graduation_count(year)) ? 'color-green' : 'color-orange' %>">
<span class="column-5 fl edu-txt-center <%= graduation_count != "--" && graduation_reached ? 'color-green' : 'color-orange' %>">
<!--<span class="fl mr20 mt2">-->
<!--<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml-3 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>-->
<!--<label class="ListTablecheckbox" for="join_course_role_9"></label>-->

@ -28,21 +28,29 @@
</p>
<div class="minH-560">
<% @years.each do |year| %>
<%
reached_graduation_count = sigle_graduation_count(year)
graduation_count = total_graduation_count(year)
graduation_reached = reached_graduation_count.to_i == graduation_count.to_i
reached_course_count = sigle_graduation_course_count(year)
course_count = total_graduation_course_count(year)
%>
<li class="clearfix">
<span class="column-1"><%= year.year %>年份</span>
<span class="column-2">
<font data-tip-down="<%= sigle_graduation_course_count %> 已达成课程/<%= total_graduation_course_count %> 总课程"><%= sigle_graduation_course_count %>/<%= total_graduation_course_count %></font>
<font data-tip-down="<%= reached_course_count %> 已达成课程/<%= course_count %> 总课程"><%= reached_course_count %>/<%= course_count %></font>
</span>
<span class="column-3 edu-txt-center task-hide">
<font data-tip-down="<%= sigle_graduation_count %> 已达成毕业要求指标点/<%= total_graduation_count %> 总毕业要求指标点" class="<%= sigle_graduation_count == total_graduation_count ? 'color-green' : 'color-orange' %>">
<%= sigle_graduation_count %>/<%= total_graduation_count %></font>
<font data-tip-down="<%= reached_graduation_count %> 已达成毕业要求指标点/<%= graduation_count %> 总毕业要求指标点" class="<%= graduation_reached ? 'color-green' : 'color-orange' %>">
<%= reached_graduation_count %>/<%= graduation_count %></font>
</span>
<span class="column-2 fr edu-txt-center">
<%= link_to '删除', ec_major_ec_year_path(year, :ec_major_id => @ec_major), method: :delete, :class => "mr15 color-grey-c", data: { confirm: '您确定要删除吗' } %>
<a href="javascript:void(0)" data-tip-down="导出本学年所有数据" class="mr15 color-blue">导出</a>
<%= link_to "查看详情", training_objectives_ec_major_ec_year_path(year, :ec_major_id => @ec_major) %>
</span>
<span class="column-2 fr edu-txt-center <%= sigle_graduation_count == total_graduation_count ? 'color-green' : 'color-orange' %>"><%= sigle_graduation_count == total_graduation_count ? '已达成' : '未达成' %></span>
<span class="column-2 fr edu-txt-center <%= graduation_reached ? 'color-green' : 'color-orange' %>"><%= graduation_reached ? '已达成' : '未达成' %></span>
</li>
<% end %>
</div>

@ -22,7 +22,7 @@
<div class="ListTableLine">
<p class="clearfix">
<span class="column-second">指标点</span>
<span class="flex1">内容</span>
<span class="column-second">内容</span>
<span class="fr edu-txt-right">
<% if @template_major %>
<a href="javascript:void(0)" class="newAddSubentry" onclick="ShowPanel();" data-tip-down="添加"><i class="iconfont icon-tianjiafangda color-green"></i></a>

@ -1,6 +1,10 @@
<div class="newFooter edu-txt-center"> <!-- 底部导航栏 -->
<div class="inner-footer_con">
<div class="footercon">
<!-- <div class="inline mt40">-->
<%#= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台" , width: "70px"), home_path,:class => "fl",:style => "height:70px" %>
<!-- <span class="fl color-grey-c cdefault font-28 ml30" style="line-height:74px">EduCoder.NET</span>-->
<!-- </div>-->
<ul class="clearfix inner-footernav">
<li><a href="<%= home_path %>" class="fl">网站首页</a></li>
<li><a href="<%= help_path(:index => 1) %>" class="fl">关于我们</a></li>

@ -1,7 +1,9 @@
<div class="educontent clearfix">
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl ml25 mr60"), home_path %>
<div class="educontents fl">
<div class="head-nav pr">
<ul id="header-nav">
<li class="<%= params[:controller] == "welcome" ? 'active' : '' %>"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实践课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 -->
@ -31,82 +33,91 @@
</li>
<% end %>
</ul>
<div class="posi-search" id="posi-search" style="display: none">
<div class="search-all clearfix">
<div class="fl pr search-clear edu-menu-panel" style="display: none">
<input type="hidden" id="search_type" value="1">
<span class="searchkey">实训</span><i class="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" class="edu-menu-list edu-txt-center" style="min-width: 80px;right: -10px;top: 60px;z-index: 2;">
<li><a href="javascript:void(0)">实训</a></li>
<li><a href="javascript:void(0)">课堂</a></li>
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" class="search-icon fl" id="header_keyword_search">
<i class="iconfont icon-sousuo color-blue mt14 fl"></i>
</a>
</div>
</div>
</div>
<div class="fr edu-menu-panel ml15" style="height:60px;">
<%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius mt13", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fl" %>
<ul class="edu-menu-list" 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>
</div>
<div class="fr head-right">
<a href="javascript:void(0)" id="search-open" class="fl headIcon pointer">
<i class="iconfont icon-sousuo color-white"></i>
</div>
<div class="posi-search" id="posi-search" style="
display: none; right:110px;">
<div class="search-all clearfix">
<div class="fl pr search-clear edu-menu-panel" style="display: none">
<input type="hidden" id="search_type" value="1">
<span class="searchkey">实训</span><i class="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" class="edu-menu-list edu-txt-center" style="min-width: 80px;right: -10px;top: 60px;z-index: 2;">
<li><a href="javascript:void(0)">实训</a></li>
<li><a href="javascript:void(0)">课堂</a></li>
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" class="search-icon fl" id="header_keyword_search">
<i class="iconfont icon-sousuo color-blue mt14 fl"></i>
</a>
<div class="fl edu-menu-panel headIcon">
<i class="iconfont icon-tianjiafangda color-white"></i>
<div class="edu-menu-list" style="top:60px;width: 240px;">
<div class="overPart"></div>
<ul class="fl with50 edu-txt-center pr ul-leftline">
</div>
</div>
<div class="fr edu-menu-panel mr25" style="height:60px;">
<%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius mt13", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fl" %>
<ul class="edu-menu-list" 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>
</div>
<div class="fr head-right mr10">
<a href="javascript:void(0)" id="search-open" class="fl headIcon pointer">
<i class="iconfont icon-sousuo color-white"></i>
</a>
<div class="fl edu-menu-panel headIcon">
<i class="iconfont icon-tianjiafangda color-white"></i>
<div class="edu-menu-list" style="top:60px;width: 240px;">
<div class="overPart"></div>
<ul class="fl with50 edu-txt-center pr ul-leftline">
<% unless User.current.identity == "学生" %>
<li><%= link_to '新建课堂', new_course_path() %></li>
<li><%= link_to '新建实训', new_shixun_path() %></li>
<li><%= link_to '新建实践课程', new_subject_path() %></li>
<li><%= link_to '新建项目', new_project_path() %></li>
</ul>
<ul class="fl with50 edu-txt-center">
<li><%= link_to "加入课堂", join_private_courses_users_path, :remote => true %></li>
<% end %>
<li><%= link_to '新建实训', new_shixun_path() %></li>
<li><%= link_to '新建实践课程', new_subject_path() %></li>
<li><%= link_to '新建项目', new_project_path() %></li>
</ul>
<ul class="fl with50 edu-txt-center">
<% if User.current.profile_completed? %>
<li><%= link_to "加入课堂", join_private_courses_path, :remote => true %></li>
<li><%= link_to "加入项目", applied_join_project_path, :remote => true %></li>
</ul>
</div>
<% else %>
<li><%= link_to "加入课堂", 'javascript:void(0)', onclick: 'showUserProfileModal()' %></li>
<li><%= link_to "加入项目", 'javascript:void(0)', onclick: 'showUserProfileModal()' %></li>
<% end %>
</ul>
</div>
</div>
<div class="fl edu-menu-panel headIcon">
<a href="<%= user_tidings_user_path(User.current) %>">
<i class="iconfont icon-xiaoxilingdang color-white"></i>
</a>
<!--新消息提醒-->
<% new_tidings_count = User.current.tidings.where("created_at > '#{User.current.onclick_time.onclick_time}'").count %>
<% new_pri_message_count = User.current.private_messages.where("created_at > '#{User.current.onclick_time.onclick_time}'").count %>
<% count = new_tidings_count + new_pri_message_count %>
<% if count > 0 %>
<a href="<%= user_tidings_user_path(User.current) %>"><span class="newslight"><%= count > 99 ? "99+" : count %></span> </a>
<div class="edu-menu-list edu-txt-center" style="width:220px;top:60px">
<a class="font-14 padding10" style="line-height: 35px;" href="<%= user_tidings_user_path(User.current) %>">您有<span class="color-orange"><%= count %></span>条新消息,点击查看</a>
</div>
<% end %>
</div>
<div class="fl edu-menu-panel headIcon">
<a href="<%= user_tidings_user_path(User.current) %>">
<i class="iconfont icon-xiaoxilingdang color-white"></i>
</a>
<!--新消息提醒-->
<% new_tidings_count = User.current.tidings.where("created_at > '#{User.current.onclick_time.onclick_time}'").count %>
<% new_pri_message_count = User.current.private_messages.where("created_at > '#{User.current.onclick_time.onclick_time}'").count %>
<% count = new_tidings_count + new_pri_message_count %>
<% if count > 0 %>
<a href="<%= user_tidings_user_path(User.current) %>"><span class="newslight"><%= count > 99 ? "99+" : count %></span> </a>
<div class="edu-menu-list edu-txt-center" style="width:220px;top:60px">
<a class="font-14 padding10" style="line-height: 35px;" href="<%= user_tidings_user_path(User.current) %>">您有<span class="color-orange"><%= count %></span>条新消息,点击查看</a>
</div>
<% end %>
</div>
</div>
@ -154,4 +165,12 @@
<% end %>
});
function showUserProfileModal() {
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">您需要去完善您的个人资料,才能使用此功能</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="/my/account?need_profile_completed=true" class="task-btn task-btn-orange fr" onclick="hideModal();">立即完善</a></div></div>';
pop_box_new(htmlvalue, 480, 205);
}
</script>

@ -1,8 +1,11 @@
<div class="educontent clearfix">
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl ml25 mr60 "), home_path %>
<div class="educontents fl">
<div class="head-nav pr">
<ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li>
<li class="<%= params[:controller] == "welcome" ? 'active' : '' %>"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实践课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
@ -28,35 +31,37 @@
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" >
<div class="search-all clearfix">
<!--<a href="javascript:void(0)" class="search-clear fl" onclick="closeSearch();">×</a>-->
<div class="fl pr search-clear edu-menu-panel" style="display: none">
<input type="hidden" id="search_type" value="1">
<span class="searchkey">实训</span><i class="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" class="edu-menu-list edu-txt-center" style="min-width: 80px;right: -10px;top: 50px;">
<li><a href="javascript:void(0)">实训</a></li>
<li><a href="javascript:void(0)">课堂</a></li>
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" class="search-icon fl" id="header_keyword_search">
<!--<svg class="icon fl mt23" width="20px" height="20px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#333333" d="M463.9 804.4c-194.7 0-353.1-158.4-353.1-353.1S269.2 98.2 463.9 98.2 817 256.6 817 451.3 658.6 804.4 463.9 804.4z m0-651.9c-164.8 0-298.8 134-298.8 298.8s134 298.8 298.8 298.8 298.8-134 298.8-298.8-134-298.8-298.8-298.8zM884.9 926.6c-7.2 0-14.4-2.9-19.8-8.6l-198-210.6c-10.3-10.9-9.7-28.1 1.2-38.4 10.9-10.3 28.1-9.8 38.4 1.2l198 210.6c10.3 10.9 9.7 28.1-1.2 38.4-5.2 5-11.9 7.4-18.6 7.4z" /></svg>-->
<i class="iconfont icon-sousuo color-blue mt14 fl"></i>
</a>
</div>
</div>
</div>
<div class="posi-search" id="posi-search" style="display: none; right:113px" >
<div class="search-all clearfix">
<!--<a href="javascript:void(0)" class="search-clear fl" onclick="closeSearch();">×</a>-->
<div class="fl pr search-clear edu-menu-panel" style="display: none">
<input type="hidden" id="search_type" value="1">
<span class="searchkey">实训</span><i class="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" class="edu-menu-list edu-txt-center" style="min-width: 80px;right: -10px;top: 50px;">
<li><a href="javascript:void(0)">实训</a></li>
<li><a href="javascript:void(0)">课堂</a></li>
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" class="search-icon fl" id="header_keyword_search">
<!--<svg class="icon fl mt23" width="20px" height="20px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#333333" d="M463.9 804.4c-194.7 0-353.1-158.4-353.1-353.1S269.2 98.2 463.9 98.2 817 256.6 817 451.3 658.6 804.4 463.9 804.4z m0-651.9c-164.8 0-298.8 134-298.8 298.8s134 298.8 298.8 298.8 298.8-134 298.8-298.8-134-298.8-298.8-298.8zM884.9 926.6c-7.2 0-14.4-2.9-19.8-8.6l-198-210.6c-10.3-10.9-9.7-28.1 1.2-38.4 10.9-10.3 28.1-9.8 38.4 1.2l198 210.6c10.3 10.9 9.7 28.1-1.2 38.4-5.2 5-11.9 7.4-18.6 7.4z" /></svg>-->
<i class="iconfont icon-sousuo color-blue mt14 fl"></i>
</a>
</div>
<span class="font-15 fr mt15 ml15">
<a href="www.educoder.net/login" class="mr5 color-white">登录</a>
</div>
<div>
<span class="font-15 fr mt15 mr25">
<a href="/login" class="mr5 color-white">登录</a>
<em class="vertical-line"></em>
<a href="www.educoder.net/register" class="mr5 color-white">登录</a>
<a href="/register" class="mr5 color-white">注册</a>
<%#= link_to '注册', user_join_path, :class => "ml5 color-white" %>
</span>
<div class="fr head-right">
<div class="fr head-right mr10">
<a href="javascript:void(0)" id="search-open" class="fl headIcon">
<i class="iconfont icon-sousuo color-white"></i>
</a>
@ -66,13 +71,13 @@
<div class="edu-menu-list" style="top:60px;width: 240px;">
<div class="overPart"></div>
<ul class="fl with50 edu-txt-center pr ul-leftline">
<li><%= link_to '新建实训', new_shixun_path() %></li>
<li><%= link_to '新建实践课程', new_subject_path() %></li>
<li><%= link_to '新建项目', new_project_path() %></li>
<li><%= link_to "新建实训", signin_path %></li>
<li><%= link_to "新建实践课程", signin_path %></li>
<li><%= link_to "新建项目", signin_path %></li>
</ul>
<ul class="fl with50 edu-txt-center">
<li><%= link_to "加入课堂", signin_path, :remote => true %></li>
<li><%= link_to "加入项目", applied_join_project_path, :remote => true %></li>
<li><%= link_to "加入课堂", signin_path %></li>
<li><%= link_to "加入项目", signin_path %></li>
</ul>
</div>
</div>

@ -1,4 +1,4 @@
<img src="/images/educoder/teach_ex.jpg" width="100%"/>
<img src="/images/educoder/teach_ex.jpg" class="teach_ex" width="100%"/>
<div class="educontent">
<div class="edu-back-white mb30 mt30">
<p class="padding20-30 clearfix bor-bottom-greyE">
@ -18,7 +18,7 @@
</ul>
<div class="edu-position fr mt12 mb10">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name">
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、作者、单位进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
</div>
</div>

@ -33,7 +33,7 @@
<td><%= member_user.try(:authentication_status) %></td>
<td><%= member_user.try(:professional_status) %></td>
<td><%= member_user.try(:school_name) %></td>
<td><%= member_user.user_extensions.school.try(:province) %></td>
<td><%= member_user.user_extensions.try(:school).try(:province) %></td>
<td><%= format_time member.created_at %></td>
</tr>
<% end %>

@ -15,4 +15,7 @@ $("#user_export_list").attr("href", "<%= search_user_managements_path(:trial =>
:homepage_show => params[:homepage_show],
:te_technical_title => params[:te_technical_title],
:pro_technical_title => params[:pro_technical_title],
:province => params[:province],
:trial_whether => params[:trial_whether],
:realname => params[:realname],
:format => "xls") %>");

@ -190,6 +190,15 @@
<input type="checkbox" <%= @user.business? ? "checked" : "" %> name="business" value="<%= @user.business? ? "1" : "0" %>" id="person_business" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_business"></label>
</span>
<% if User.current.admin? %>
<label class="panel-form-label fl mr18">管理员:</label>
<span class="fl">
<input type="checkbox" <%= @user.admin? ? "checked" : "" %> id="person_admin" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_admin"></label>
</span>
<input type="hidden" id="user_admin" name="admin" value="<%= @user.admin? ? "1" : "0" %>">
<% end %>
</li>
<li class="clearfix mb10 hascontont">
<label class="panel-form-label fl mr18">职业:</label>
@ -625,7 +634,14 @@
}else{
document.getElementById('person_business').value = "0";
}
<% if User.current.admin? %>
var admin_check = document.getElementById('person_admin').checked;
if (admin_check) {
document.getElementById('user_admin').value = "1";
} else {
document.getElementById('user_admin').value = "0";
}
<% end %>
my_account_form_submit();
});
function my_account_form_submit(){

@ -3,11 +3,11 @@
<div class="clearfix font-16 mb30 title_detail">
<a href="<%= home_path %>" class="none"><img src="/images/educoder/logo.png" class="fl"/></a>
<span class="fr">
<% if @require_trail_auth %>
<a href="javascript:void(0)" onclick="apply_trial_box()" class="color-blue">试用申请</a>
<% else %>
<%# if @require_trail_auth %>
<!-- <a href="javascript:void(0)" onclick="apply_trial_box()" class="color-blue">试用申请</a>-->
<%# else %>
<a href="<%= home_path %>" class="color-blue">返回首页</a>
<% end %>
<%# end %>
<em class="vertical-line ml5 mr5"></em>
<a href="<%= signout_path %>" class="color-blue">退出</a>
</span>
@ -91,21 +91,21 @@
<script>
$(function () {
<% if @require_trail_auth %>
var html = "<%= escape_javascript(render :partial => 'welcome/two_btn_mask_pop') %>";
pop_box_new(html, 500, 338,true);
<% if @certification_expired.present? %>
$("#apply_trial_text").html("您的账号授权已过期,继续使用需要经过授权审核<br>通过审核后,您将可以继续使用");
<% end %>
<% end %>
<%# if @require_trail_auth %>
<!-- var html = "<%#= escape_javascript(render :partial => 'welcome/two_btn_mask_pop') %>";-->
<!-- pop_box_new(html, 500, 338,true);-->
<%# if @certification_expired.present? %>
<!-- $("#apply_trial_text").html("您的账号授权已过期,继续使用需要经过授权审核<br>通过审核后,您将可以继续使用");-->
<%# end %>
<%# end %>
<% if @noticed_result %>
<% if @trail_authentication.status == 1 %>
sure_box_redirect_without_newtab("<%= user_path(@user) %>", "试用申请已被接受");
<% elsif @trail_authentication.status == 2 %>
sure_box_redirect_without_newtab_btn("<%= my_account_path %>", "试用申请已被拒绝<br/>原因:<%= [@trail_authentication.reason, @trail_authentication.reject_description].join('') %>", "重新申请");
<% end %>
<% end %>
<%# if @noticed_result %>
<%# if @trail_authentication.status == 1 %>
<!-- sure_box_redirect_without_newtab("<%#= user_path(@user) %>", "试用申请已被接受");-->
<%# elsif @trail_authentication.status == 2 %>
<!-- sure_box_redirect_without_newtab_btn("<%#= my_account_path %>", "试用申请已被拒绝<br/>原因:<%#= [@trail_authentication.reason, @trail_authentication.reject_description].join('') %>", "重新申请");-->
<%# end %>
<%# end %>
<% notice = SystemUpdateNotice.last %>
<% if User.current.certification == 1 && 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 %>

@ -2,8 +2,12 @@
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>
<% if User.current.try(:logged?) %>
<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>
<% else %>
<p class="noteDetailPointsBCD1E3 minus-praise-btn unlogged"><i class="iconfont icon-dianzan"></i><br><span class="praise-num"><%= praise_num %></span></p>
<% end %>
<script>
$(function(){
@ -26,6 +30,11 @@
});
$minusPraiseBtn.on('click', function(){
if($(this).hasClass('unlogged')){
window.location.href = '<%= signin_path(back_url: request.original_url) %>';
return;
}
$.ajax({
method: "get",
url: "<%= praise_tread_praise_minus_path(obj_id: object.id, obj_type: object.class) %>",

@ -133,9 +133,9 @@
<% if @can_attendance %>
<a herf="javascript:void(0);" onclick="user_attendance('<%= @user.login %>');" id="attendance" class="user_default_btn user_orange_btn fl">签到</a>
<span id="attendance_span" style="display: none;" class="fl user_default_btn user_grey_btn mb5">已签到</span>
<% if @apply_trial %>
<a herf="javascript:void(0);" onclick="user_apply_trail();" id="authentication_apply" class="user_default_btn user_private_btn fl ml15">试用申请</a>
<% end %>
<%# if @apply_trial %>
<!-- <a herf="javascript:void(0);" onclick="user_apply_trail();" id="authentication_apply" class="user_default_btn user_private_btn fl ml15">试用申请</a>-->
<%# end %>
<div class="clearfix"></div>
<span id="attendance_notice" class="none font-12 color-grey-6">明日签到&nbsp;<font class="color-orange">+<%= @next_attachment_score < 100 ? (@next_attachment_score + 10) : 100 %></font>&nbsp;金币</span>
<% else %>

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'courses/join_private_course') %>";
pop_box_new(htmlvalue,460,220);

@ -1670,7 +1670,6 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'html_show'
get 'switch_user_module'
get 'reward_grade'
match 'join_private_courses', :via => [:get, :post]
end
member do
@ -2606,6 +2605,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
########################
##added by wen##########
#######confusing########
match 'welcome/join_private_courses', to: 'welcome#join_private_courses', :via => [:get, :post], :as => 'join_private_courses'
get 'welcome/search', to: 'welcome#search'
get 'school/index', to: 'school#index'
get 'school/:school_id', to:

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
class ModifyTestUserForSchool < ActiveRecord::Migration
def up
school_ids = School.where("id < 1500").pluck(:id)
users = User.where(is_test: true).includes(:user_extensions)
users.find_each do |u|
school_id = school_ids.sample
u.user_extensions.update_column(:school_id, school_id) if u.user_extensions.present?
end
end
def down
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

@ -263,7 +263,7 @@ function sure_box_redirect_btn(url, str,btnstr){
function sure_box_redirect_btn2(url, str, btnstr){
var htmlvalue = '<div class="task-popup" style="width:500px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3> <a href="javascript:void(0)" id="closeIcon" style="top: -48px;right: -20px;z-index: 100000;"><i class="iconfont icon-shanchudiao"></i></a></div>'+
var htmlvalue = '<div class="task-popup" style="width:500px;"><div class="task-popup-title clearfix">提示<a href="javascript:void(0)" id="closeIcon" style="top: -48px;right: -20px;z-index: 100000;"><i class="iconfont icon-shanchudiao"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-submit clearfix" style="width: 150px"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="'+ url +'" class="task-btn task-btn-orange fr" target="_blank" onclick="hideModal();">'+btnstr+'</a></div></div>';
pop_box_new(htmlvalue, 578, 205);
@ -273,14 +273,14 @@ function sure_box_redirect_btn2(url, str, btnstr){
//提示框:只有一个知道啦按钮,点击打开新窗口
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
function sure_box_redirect_without_newtab(url, str){
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();" >知道啦</a></div></div>';
pop_box_new(htmlvalue, 480, 160);
}
//按钮内容自定义
function sure_box_redirect_without_newtab_btn(url, str,btnstr){
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();" >'+btnstr+'</a></div></div>';
pop_box_new(htmlvalue, 480, 160);
@ -289,7 +289,7 @@ function sure_box_redirect_without_newtab_btn(url, str,btnstr){
//提示框:只有一个确定按钮,点击跳转
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
function notice_box_redirect(url, str){
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-sure clearfix">'+
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 480, 160);
@ -298,7 +298,7 @@ function notice_box_redirect(url, str){
//提示框:只有一个确定按钮,点击跳转(局部刷新)
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
function notice_box_redirect_remote(url, str){
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-sure clearfix">'+
'<a href="'+ url +'" class="task-btn task-btn-orange" data-remote="true">确定</a></div></div>';
pop_box_new(htmlvalue, 480, 160);

@ -41,7 +41,7 @@ var proxy = "http://localhost:3000"
// proxy = "http://testbdweb.trustie.net"
// proxy = "http://testbdweb.educoder.net"
// proxy ="http://192.168.2.63:3000"
// proxy='https://www.educoder.net'
proxy='http://localhost:3000'
const requestMap={};
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制

@ -257,6 +257,23 @@ class NewHeader extends Component {
localStorage.setItem('competition_uid', true);
}
NewCoursesAndShixuns=(sum)=>{
if(this.props.user&&this.props.user.login=== ""||this.props.user&&this.props.user===null||this.props.current_user&&this.props.current_user=== ""){
window.location.href = "/login";
}else if(this.state.current_user=== ""){
window.location.href = "/login";
}else if(sum===1){
window.location.href = "/courses/new";
}else if(sum===2){
window.location.href = "/shixuns/new";
}else if(sum===3){
window.location.href = "/paths/new";
}else if(sum===4){
window.location.href = "/projects/new";
}
}
render() {
let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state;
// const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
@ -288,11 +305,11 @@ class NewHeader extends Component {
}else{
activeIndex = true;
}
// console.log(match.path)
// console.log(this.props.user&&this.props.user.is_student=== true||this.props.current_user&&this.props.current_user.is_student==true)
// console.log(this.state.current_user)
// console.log(match.path.startsWith("/ec_courses"))
return (
<div className="newHeader" id="nHeader">
@ -334,15 +351,28 @@ class NewHeader extends Component {
</div>
</div>
</Modal>
<div className="educontent clearfix">
<a href="/" className={" fl ml25 mr60"}>
{ImageUrlType===true?<img alt="高校智能化教学与实训平台" className="fl" src={getImageUrl(ImageUrl)} style={{height:'60px'}} />:<img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl(ImageUrl)}/>}
</a>
<style>
{
`
.educontents{
margin: 0px auto;
box-sizing: border-box;
}
`
}
</style>
<div className="educontents fl">
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}
<a href="/">
{ImageUrlType===true?<img alt="高校智能化教学与实训平台" className="fl" src={getImageUrl(ImageUrl)} style={{height:'60px'}} />:<img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl(ImageUrl)}/>}
</a>
<div className="head-nav pr">
<ul id="header-nav">
{/*<li className={`${activeIndex === true ? 'active' : ''}`}><a href="/">首页</a></li>*/}
<li><a href="/">首页</a></li>
<li><a href="/paths">实践课程</a></li>
<li><a href="/courses">翻转课堂</a></li>
@ -381,43 +411,53 @@ class NewHeader extends Component {
<li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">交流问答</a></li>
<li className={`${activeCourses === true ? 'active' : ''}`} style={{display:ecUrl===null||ecUrl===undefined||ecUrl===""?'none':'block'}}><a href={ecUrl}>{ecUrl===null||ecUrl===undefined||ecUrl===""?'':'工程认证'}</a></li>
</ul>
<div className="posi-search" id="posi-search" style={{display: 'none'}}>
<div className="search-all clearfix">
{/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/}
<div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}>
<input type="hidden" id="search_type" value="1"></input>
<span className="searchkey">实训</span>
<i className="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" className="edu-menu-list edu-txt-center" style={{minWidth: '80px',right: '-10px',top: '50px'}}>
<li><a href="javascript:void(0)">实训</a></li>
<li><a href="javascript:void(0)">课堂</a></li>
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<input type="text" className="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" className="search-icon fl" id="header_keyword_search">
{/*<i className="fa fa-search font-16 mt23 color-grey-6"></i>*/}
<i className="iconfont icon-sousuo color-blue"></i>
</a>
{/* TODO
<div class="search-content none" style="width: 86%;left: 0px;">
<div class="search-title">最近搜索</div>
<div><a href="javascript:void(0)" class="search_history">绿盟</a></div>
<div><a href="javascript:void(0)" class="search_history">qwe</a></div>
</div>*/}
</div>
</div>
</div>
</div>
{/*<span className="font-15 fr mt17">
<%= link_to '登录', signin_path, :className => "mr5" %>
<em className="vertical-line"></em>
<%= link_to '注册', user_join_path, :className => "ml5" %>
</span>*/}
<style>
{
`
.marf28{
margin-right: -28px;
}
`
}
</style>
<div className="posi-search marf28" id="posi-search" style={{display: 'none'}}>
<div className="search-all clearfix">
{/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/}
<div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}>
<input type="hidden" id="search_type" value="1"></input>
<span className="searchkey">实训</span>
<i className="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" className="edu-menu-list edu-txt-center" style={{minWidth: '80px',right: '-10px',top: '50px'}}>
<li><a href="javascript:void(0)">实训</a></li>
<li><a href="javascript:void(0)">课堂</a></li>
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<input type="text" className="search-input fl" id="search-input" name="search_keyword" placeholder="实践课程/翻转课堂/开发社区/交流问答"/>
<a href="javascript:void(0)" className="search-icon fl" id="header_keyword_search">
{/*<i className="fa fa-search font-16 mt23 color-grey-6"></i>*/}
<i className="iconfont icon-sousuo color-blue"></i>
</a>
{/* TODO
<div class="search-content none" style="width: 86%;left: 0px;">
<div class="search-title">最近搜索</div>
<div><a href="javascript:void(0)" class="search_history">绿盟</a></div>
<div><a href="javascript:void(0)" class="search_history">qwe</a></div>
</div>*/}
</div>
</div>
<div style={{display:isLogin===true?'block':'none'}}>
<div className="fr edu-menu-panel" style={{height:'60px'}}>
<a href={`/users/${current_user.login}`} className="fl ml15">
<div className="fr edu-menu-panel mr10 mr25" style={{height:'60px'}}>
<a href={`/users/${current_user.login}`} className="fl">
<img alt="头像" className="radius mt13" height="34" id="nh_user_logo" nhname="avatar_image"
src={`/images/${current_user.image_url}`} width="34">
</img>
@ -436,9 +476,20 @@ class NewHeader extends Component {
</div>
</div>
<div style={{display:isLogin===false?'block':'none'}}>
<span className="font-15 fr mt15 ml15">
<style>
{
`
.mtf4{
margin-top: -4px;
}
.mtf20{
margin-top: -20px;
}
`
}
</style>
<div style={{display:isLogin===false?'block':'none'}} className={"fr mt15 mr25"} >
<span className="font-15 fr" >
<a href="/login" className="mr5 color-white">登录</a>
<em className="vertical-line"></em>
<a href="/user_join" className="mr5 color-white">注册</a>
@ -446,7 +497,7 @@ class NewHeader extends Component {
</div>
<div className="fr head-right">
<div className="fr head-right mr10" >
<a href="javascript:void(0)" id="search-open" className="fl mr30 headIcon">
{/*"/images/educoder/icon/search.svg"
<img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */}
@ -459,10 +510,13 @@ class NewHeader extends Component {
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline">
<li><a href="/courses/new">新建课堂</a></li>
<li><a href="/shixuns/new">新建实训</a></li>
<li><a href="/paths/new">新建实践课程</a></li>
<li><a href="/projects/new">新建项目</a></li>
{
this.props.user&&this.props.user.is_student=== false || this.props.current_user&&this.props.current_user.is_student==false?
<li><a onClick={()=>this.NewCoursesAndShixuns(1)}>新建课堂</a></li>:""
}
<li><a onClick={()=>this.NewCoursesAndShixuns(2)}>新建实训</a></li>
<li><a onClick={()=>this.NewCoursesAndShixuns(3)}>新建实践课程</a></li>
<li><a onClick={()=>this.NewCoursesAndShixuns(4)}>新建项目</a></li>
</ul>
<ul className="fl with50 edu-txt-center">
<li>
@ -522,7 +576,7 @@ class NewHeader extends Component {
</div>
*/}
</div>
</div>
</div>
);

@ -17,6 +17,9 @@ body>.-task-title {
/*Header START*/
.newHeader .logoimg {
margin-top: 16px;
float: left;
width: 97px;
max-height: 60px;
}
.head-right i {

@ -1,9 +1,13 @@
/*--------------------------首页*/
/*头部导航条样式---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: 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;}
.newHeader .logoimg{
margin-top: 16px;
float: left;
width: 97px;
}
.head-nav{float: left;width: 800px;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;}
.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:hover{color: #cccccc;}
@ -20,7 +24,7 @@
.nav-img{position: absolute;top:2px;right: -8px;display: none}
.head-right{box-sizing: border-box;height: 60px; background: #24292D; }
.head-right i{margin-top:12px;float: right;margin-right: 15px;margin-left: 15px;}
.head-right i{margin-top:12px;float: right;margin-right: 12px;margin-left: 15px;}
/* tpm*/
.educontent .icon { padding-left: 0px !important; padding-top: 0px !important; padding-bottom: 0px !important;}
em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
@ -44,7 +48,7 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.search-icon path{ fill: #4CACFF;}
/* 右侧内容宽度变化的话需要调整posi-search right的值*/
.posi-search{opacity: 1;position: absolute;top: -2px;background: #fff;z-index: 2; right: -200px;}
.posi-search{opacity: 1;position: absolute;top: -2px;background: #fff;z-index: 2; right:140px}
.posi-search.unlogin{right: -161px;}
.search-content{box-sizing: border-box;position: absolute;height: 300px;background: #fff;border-radius: 0px 0px 5px 5px;width: 100%;left: 0px;top:58px;box-shadow: 0 4px 8px 0 rgba(0,0,0,.2);overflow-y: auto}
.search-title{height: 40px;line-height: 40px;padding-left: 20px;font-size: 12px;color: #bbb;text-align: left}
@ -607,6 +611,11 @@ p .activity-item:first-child{border-top: 1px solid #eee;}
#hnpage1{background: url('/images/educoder/competition/logo_1.jpg') no-repeat top center;min-height: 820px;}
#competition-header{background:#24292D;height: 60px;width: 100%;padding-right: 40px;box-sizing: border-box;position: fixed;top: 0px;left: 0px;width: 100%;z-index: 1000;}
#competition-header .logoimg{
margin-top: 5px;
float: left;
width: 97px;}
.nav-game{position: relative;}
.nav-game li{position: relative;float: left;width: 110px;height: 60px;line-height: 60px;text-align: center;box-sizing: border-box}
.nav-game li a{color:#fff;font-size: 16px;}
@ -659,8 +668,8 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
.second_code_1{min-height: 791px;}
.second_code_2{min-height: 436px;}
.second_code_3{min-height: 1460px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_4{min-height: 724px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_5{min-height: 718px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_4{min-height: 1459px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_5{min-height: 1464px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_6{min-height: 1060px;}
.second_code_7{min-height: 1116px;}
.second_code_8{min-height: 711px;}
@ -709,16 +718,16 @@ li.challenge_box{
font-size: 30px;color: #0E8B87;line-height: 30px;margin-bottom: 30px;
}
.challenge_b_d{
color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 40px;padding-left: 3px;
color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 30px;padding-left: 3px;
}
.challenge_b_des{
line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 40px;min-height: 220px;
line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 30px;min-height: 240px;
}
li.challenge_box:last-child{
margin-right: 0px;
}
.algorithm{margin-bottom: 40px;}
.algorithm a{display: block;text-align: left;color: #23A8FD;position: relative;float: left;font-size: 18px;line-height: 22px;}
.algorithm a{display: block;text-align: left;color: #23A8FD;position: relative;float: left;font-size: 17px;line-height: 22px;}
.algorithm a:after{position: absolute;left: 0px;bottom: -2px;background:#23A8FD;width: 100%;height: 1px;content: ''; }
@ -3521,4 +3530,8 @@ line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
.vertical4{
vertical-align: -4px;
margin-right: 0px !important;
}
.mrf40{
margin-right: -40px;
}

@ -191,8 +191,9 @@ input::-ms-clear{display:none;}
.newContainer{ min-height:100%; height: auto !important; height: 100%; /*IE6不识别min-height*/position: relative;}
.educontent{width: 1200px;margin:0px auto;box-sizing: border-box}/*中间部分宽度固定为1200*/
.educontents{margin:0px auto;box-sizing: border-box}/*中间部分宽度固定为1200*/
.newMain{ margin: 0 auto; padding-bottom: 235px; min-width:1200px;padding-top: 60px}/*padding-bottom根据底部的高度而定*/
.newMain{ padding-bottom: 120px !important; }
.newMain{ padding-bottom: 110px !important; }
/*高度*/
.height-100{height: 100%;}
@ -1264,4 +1265,8 @@ html>body #ajax-indicator { position: fixed; }
/* md多空格 */
.markdown-body p {
white-space: pre-wrap;
}
.teach_ex{
object-fit: cover;
height: 300px;
}

@ -56,8 +56,8 @@ If you continue to experience problems please contact your Trustie administrator
温馨提示:为了给大家提供更优质的服务
</p>
<p class="font-18">
平台拟于<span style="color: red">2019年7月22日10:40--2019年7月22号11:00</span>进行全面升级,带来不便,敬请谅解!
平台拟于<span style="color: red">2019年7月26日22:00--2019年7月26号23:30</span>进行全面升级,带来不便,敬请谅解!
</p>
</div>user_tidings.html.erb
</div>
</body>
</html>

Loading…
Cancel
Save