dev_aliyun
caishi 5 years ago
commit aafc257096

@ -359,7 +359,7 @@ class AttachmentsController < ApplicationController
saved = @attachment.save
respond_to do |format|
format.js
format.json { render json: { attachment_id: @attachment.id, url: download_attachment_path(@attachment.id) } }
format.json { render json: { attachment_id: @attachment.id, url: "/api/attachments/#{@attachment.id}"} }
format.api {
if saved
render :action => 'upload', :status => :created
@ -380,7 +380,7 @@ class AttachmentsController < ApplicationController
render json: {
success: saved ? 1 : 0, # | 1, // 0 表示上传失败1 表示上传成功
message: "上传信息:#{ @attachment.errors.full_messages.join(',') }",
url: download_attachment_path(@attachment.id), # 上传成功时才返回
url: "/api/attachments/#{@attachment.id}", # 上传成功时才返回
attachment_id: @attachment.id
}
end
@ -413,7 +413,7 @@ class AttachmentsController < ApplicationController
render json: {
success: saved ? 1 : 0, # | 1, // 0 表示上传失败1 表示上传成功
message: "上传失败:#{ @attachment.errors.full_messages.join(',') }",
url: download_attachment_path(@attachment.id) # 上传成功时才返回
url: "/api/attachments/#{@attachment.id}" # 上传成功时才返回
}
end

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

@ -32,9 +32,8 @@ class CompetitionTeamsController < ApplicationController
# todo使用新版course_members
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.joins('join members on members.course_id = courses.id')
.joins('join member_roles on member_roles.member_id = members.id and member_roles.role_id in (3,7,9)')
.where(members: { user_id: @team_user_ids }).pluck(:id)
.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')

@ -87,7 +87,7 @@ class CoursesController < ApplicationController
course_ids = course_ids.present? ? course_ids.join(",") : -1
@courses = Course.where("courses.is_delete = 0 and courses.is_hidden = 0 #{course_ids == -1 ? "" : "and courses.id in (#{course_ids})"}").select("courses.id, courses.tea_id, courses.name, courses.is_public, courses.members_count, courses.homework_commons_count,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("courses.id = 1309 desc, a desc")
elsif @order == "mine"
my_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9,10) AND m.user_id=#{@user.id} AND c.is_delete = 0")
my_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3,4) AND m.user_id=#{@user.id} AND c.is_delete = 0")
course_ids = course_ids.present? ? my_course_ids.map(&:id) & course_ids : my_course_ids.map(&:id)
course_ids = course_ids.size > 0 ? course_ids.join(",") : "-1"
@courses = Course.find_by_sql("select c.id, c.tea_id, c.name, c.is_public, c.members_count, c.homework_commons_count, u.login, u.nickname, u.lastname, u.firstname, u.show_realname, ue.school_id from courses c, users u, user_extensions ue where c.tea_id = u.id and u.id = ue.user_id and c.is_delete = 0 and c.is_hidden = 0 and c.id in (#{course_ids}) order by c.id = 1309 desc, #{order_str} desc")
@ -894,7 +894,7 @@ class CoursesController < ApplicationController
# @teacher_count = TeacherAndAssistantCount @course
if @course.try(:id) != 1309 || User.current.admin? || User.current.try(:id) == 15582
@teacher_count = @course.members.includes(:roles, :user).where("roles.id" => [3,7,9]).count
@teacher_count = @course.course_members.includes(:roles, :user).where("roles.id" => [3,7,9]).count
else
@teacher_count = @course.members.includes(:roles, :user).where("roles.id" => [3,7]).count
end

@ -23,7 +23,7 @@ class LibrariesController < ApplicationController
per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i
@libraries = paginateHelper libraries.includes(:library_tags, :praise_tread_cache, user: :user_extensions), per_page
@download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).count
@download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).sum(:downloads)
end
def show

@ -1133,6 +1133,12 @@ end
render :json => {:status => 1}
end
def update_competition_text
text = CompetitionTextConfig.find(params[:id])
text.update_attributes(name: params[:name], description: params[:description])
render :json => {:status => 1}
end
def delete_competition_text
ctc = CompetitionTextConfig.find params[:id]
ctc.destroy
@ -2944,20 +2950,20 @@ 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.members.where(:user_id => user.id).first
member = course.course_members.where(:user_id => user.id, :role => 4).first
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
if member.present? && member.member_roles.pluck(:role_id).include?(10) && member.course_group_id != course_group.try(:id).to_i
if member.present? && 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 = Member.new(:role_ids => [member_role], :user_id => user.id)
if member_role == 10
StudentsForCourse.create(:student_id => user.id, :course_id => course.id)
end
member = CourseMember.new(:role => 4, :user_id => user.id)
# if member_role == 10
# StudentsForCourse.create(:student_id => user.id, :course_id => course.id)
# end
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)
member.course_group_id = course_group.try(:id).to_i
course.members << member
course.course_members << member
member_count += 1
end
@ -4262,7 +4268,7 @@ end
teacher_name = course.teacher ? course.teacher.show_real_name : ""
sheet1[count_row,0] = course.id
sheet1[count_row,1] = course.name
sheet1[count_row,2] = course.members.count
sheet1[count_row,2] = course.course_members_count
sheet1[count_row,3] = course.attachments.count
sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count
sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count

@ -360,6 +360,13 @@ class UsersController < ApplicationController
@messages = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
end
def join_private_courses
@invitation_code = params[:invitation_code]
respond_to do |format|
format.js
end
end
# 我收到的issue
def user_receive_issues
@receive_issues = "我收到的Issue"
@ -2438,14 +2445,14 @@ class UsersController < ApplicationController
case @type
when "a_course"
student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, students_for_courses sfc WHERE sfc.course_id = c.id AND sfc.student_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
manage_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
manage_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
course_ids = student_course_ids.map(&:id) + manage_course_ids.map(&:id)
@objects = Course.where(:id => course_ids.uniq).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("updated_at #{order}")
when "l_course"
student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, students_for_courses sfc WHERE sfc.course_id = c.id AND sfc.student_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id and m.role = 4 AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
@objects = Course.where(:id => student_course_ids.map(&:id)).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("updated_at #{order}")
when "p_course"
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}")
@objects = Course.where(:id => course_ids.map(&:id)).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("id = 1309 desc, updated_at #{order}")
when "a_shixun"
shixun_ids = @user.shixun_members.map(&:shixun_id) + @user.myshixuns.map(&:shixun_id)

@ -42,7 +42,7 @@ class WelcomeController < ApplicationController
# 运营引流个人数据展示
def user_agents
@user_agents = UserAgent.where(key: params[:edu]).includes(:user_actionss)
@user_agents = UserAgent.where(key: params[:edu])
@agents_count = @user_agents.count
limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
@ -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(",")

@ -5690,7 +5690,8 @@ end
def download_named_attachment_url_without_domain(id, filename, option={})
attachment_id = (Attachment === id ? id.id : id)
Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename
# Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename
"/api/attachments/" + attachment_id.to_s
end
def named_attachment_url_without_domain(id, filename, option={})

@ -24,22 +24,41 @@ module WelcomeHelper
# 引流注册情况
def register_info user_agent
if user_agent.agent_type.to_i == UserAgent::USER_AD
user_id = user_agent.user_actionss.first.try(:user_id)
if user_id && User.where("id = #{user_id} and created_on < '2019-07-15 00:00:00'").present?
"代理前注册"
else
"未转换"
end
elsif user_agent.agent_type.to_i == UserAgent::USER_REGISTER || UserActions.find_by_ip(user_agent.ip)
"代理后注册"
else
user_id = user_agent.user_actionss.first.try(:user_id)
if user_id && User.where("id = #{user_id} and created_on < '2019-07-15 00:00:00'").present?
"代理前注册"
else
"代理后注册"
end
case user_agent.register_status
when 0
"IP未登录"
when 1
"代理之前注册"
when 2
"代理之后注册"
end
# if user_agent.agent_type.to_i == UserAgent::USER_AD
# user_id = user_agent.user_actionss.first.try(:user_id)
# if user_id && User.where("id = #{user_id} and created_on < '2019-07-15 00:00:00'").present?
# "代理前注册"
# else
# "未转换"
# end
# elsif user_agent.agent_type.to_i == UserAgent::USER_REGISTER || UserActions.find_by_ip(user_agent.ip)
# "代理后注册"
# else
# user_id = user_agent.user_actionss.first.try(:user_id)
# if user_id && User.where("id = #{user_id} and created_on < '2019-07-15 00:00:00'").present?
# "代理前注册"
# else
# "代理后注册"
# end
# end
end
def competion_info user_agent
case user_agent.action_status
when 0
"未报名"
when 1
"代理之前报名"
when 2
"代理之后报名"
end
end

@ -1,4 +1,4 @@
class CompetitionTextConfig < ActiveRecord::Base
# attr_accessible :title, :body
attr_accessible :name, :description, :competition_id
belongs_to :competition
end

@ -33,6 +33,8 @@ class Course < ActiveRecord::Base
belongs_to :syllabus
belongs_to :course_list
# has_many :bid
has_many :course_members, dependent: :destroy
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',
@ -290,12 +292,16 @@ class Course < ActiveRecord::Base
# 课堂的老师不包括助教
def course_teachers
self.members.select{|m| m.roles.to_s.include?("Manager") || m.roles.to_s.include?("Teacher")}
self.course_members.where(:role => [1, 2])
end
# 课堂的老师包括助教
def teachers
self.members.includes(:roles).where("roles.id" => [3,7,9])
self.course_members.where(:role => [1, 2, 3])
end
def students
self.course_members.where(:role => [4])
end
def self.visible_condition(user, options={})

@ -1,6 +1,7 @@
class CourseGroup < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :course
has_many :course_members
has_many :members
has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',

@ -0,0 +1,7 @@
class CourseMember < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :course, counter_cache: true
belongs_to :user
belongs_to :course_group, counter_cache: true
end

@ -54,6 +54,7 @@ class Message < ActiveRecord::Base
belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id'
#has_one :message_detail, :dependent => :destroy
has_one :message_detail, dependent: :destroy
#转发表
has_many :forwards, :as => :from, :dependent => :destroy
@ -102,7 +103,7 @@ class Message < ActiveRecord::Base
}
safe_attributes 'subject', 'content', 'reply_id', 'root_id', 'visits'
safe_attributes 'subject', 'reply_id', 'root_id', 'visits'
safe_attributes 'board_id','locked', 'sticky',
:if => lambda {|message, user|
if message.project
@ -115,7 +116,7 @@ class Message < ActiveRecord::Base
}
def description
self.content
message_detail.try(:content)
end
# def content

@ -0,0 +1,4 @@
class MessageDetail < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :message, :touch => true
end

@ -254,7 +254,7 @@ class Tiding < ActiveRecord::Base
elsif self.tiding_type == "Comment"
container.present? ? ("评论了你" + (container.parent.present? ? "的回复:" : "发布的项目issue") + message_content(container.notes)) : ""
else
"更新了Issue#{container.issue.subject}"
"更新了Issue#{container.try(:issue).try(:subject)}"
end
when 'Issue'
"指派了Issue给你" + container.subject

@ -97,6 +97,8 @@ class User < Principal
has_many :homework_evaluations, :dependent => :destroy
has_many :syllabuses, :dependent => :destroy
has_many :syllabus_members, :dependent => :destroy
has_many :course_members, :dependent => :destroy
#问卷相关关关系
has_many :poll_users, :dependent => :destroy
has_many :poll_votes, :dependent => :destroy
@ -1125,7 +1127,7 @@ class User < Principal
end
def member_of_course?(course)
courses.to_a.include?(course) || User.current.business?
course.course_members.exists?(user_id: self.id) || User.current.business?
end
def member_of_contest?(contest)

@ -1,3 +1,5 @@
# register_status: 0未注册1: 代理之前注册2代理之后注册
# action_status: 0未注册1: 代理之前报名2代理之后报名
class UserAgent < ActiveRecord::Base
has_many :user_actionss, :foreign_key => "ip", :primary_key => "ip"
USER_AD = 1 # 广告宣传的引流

@ -171,7 +171,8 @@ class SourcesService
def get_user_info params
user = User.find params[:id]
{username: user.show_real_name, user_id: user.id, email: user.mail, phone: user.phone, sex: user.sex, school_name: user.school_name}
mail = user.mail.presence || "login@educoder.net"
{username: user.show_real_name, user_id: user.id, email: mail, phone: user.phone, sex: user.sex, school_name: user.school_name}
end
# courses start ############################################

@ -313,8 +313,8 @@ class UsersService
limit = params[:limit]||5
page = params[:page].to_i
offset = (page-1) * limit
courses = Course.find_by_sql("SELECT c.* FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND
mr.role_id in (3,7,9,10) AND
courses = Course.find_by_sql("SELECT c.* FROM courses c, course_members m WHERE m.course_id = c.id AND
m.role in (1,2,3,4) AND
m.user_id=#{current_user.id} AND c.is_delete = 0 order by id desc limit #{limit} offset #{offset} ")
# 如果还没有课程则显示示例课堂
courses = Course.where(:id => 1309) if courses.count == 0

@ -1,7 +1,7 @@
<div class="task-popup" style="width: 500px;">
<p class="font-bd font-18 mt30 mb10 edu-txt-center"><%= notice.try(:subject) %></p>
<div class="padding20-30 color-grey-6 font-16">
<pre class="break-word break-word-firefox"><%= notice.try(:notes) %></pre>
<pre class="break-word break-word-firefox"><%= notice.try(:notes).try(:rstrip) %></pre>
</div>
<div class="clearfix edu-txt-center mb30 mt10">
<p class="inline">

@ -1,5 +1,9 @@
<div id="competition-header" class="edu-txt-right">
<div class="inline">
<div id="competition-header" class="clearfix">
<a href="/" style="margin: 10px 20px; display: inline-block;">
<img alt="高校智能化教学与实训平台" class="logoimg"
src="/images/educoder/headNavLogo.png?1526520218" style="width:40px">
</a>
<div class="inline fr">
<ul class="nav-game fl">
<% @competition.competition_modules.where(:hidden => 0).each do |com_module| %>
<% case com_module.name %>

@ -4,71 +4,60 @@
<div class="openSource_2" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_3" style="background: url('') no-repeat top center;">
<div class="enter_panel" style="height: 300px">
<p class="desc_game">
为推动我国基于开源的开放创新生态环境建设,加快面向自主创新的高校信息技术新工科人才培养模式变革,大力培养实践能力强、创新能力强、具备国际竞争力的信息技术领域高素质人才,教育部高等学校计算机类专业教学指导委员会、教育部高等学校软件工程专业教学指导委员会、全国高等学校计算机教育研究会。
创新能力强、具备国际竞争力的信息技术领域高素质人才,教育部高等学校计算机类专业教学指导委员会、教育部高等学校软件工程专业教学指导委员会、全国高等学校计算机教育研究会、信息技术新工科产学研联盟、中国计算机学会软件工程专委会、中国计算机学会系统软件专委会、绿色计算产业联盟等共同研究,决定举办第二届全国高校绿色计算创新大赛。
</p>
</div>
</div>
<div class="openSource_4" style="background: url('') no-repeat top center;">
<div class="educontent">
<a href="javascript:void(0)" style="float:right;height:282px;width:50%"></a>
<div class="openSource_3" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="enter_panel" style="height: 300px">
<p class="desc_game">
<%= @competition.competition_text_configs.first.try(:description) %>
</p>
</div>
</div>
<% index += 1 %>
<% @competition.competition_stages.each_with_index do |stage, i| %>
<div class="openSource_<%= 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="height: 285px">
<ul>
<p class="font-22 enter_title padding30 clearfix">
<span class="fl ml30">
<span class="mr20 font-bd"><%= first_section.try(:name) %></span>
<span><%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %>~<%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %></span>
</span>
<span class="fr mr30">
<span class="mr20 font-bd"><%= second_section.try(:name) %></span>
<span><%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %>~<%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %></span>
</span>
</p>
<li class="inline enter_btn mt20">
<% is_start = Time.now > first_section.start_time %>
<% first_section.competition_entries.each_with_index do |entry, j| %>
<%
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="li-1 <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
<% end %>
</li>
</ul>
<%
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);"
%>
<div class="openSource_4" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="educontent">
<a href="javascript:void(0)" data-url="<%= btn_url %>" class="enroll-btn <%= is_start ? 'active' : '' %>" style="float:right;height:282px;width:50%"></a>
</div>
</div>
<% index += 1 %>
<% end %>
<div class="openSource_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_7" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_7" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
<%
course_id = nil
user_enrolled = false
invite_code = nil
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?
user_enrolled = @user.member_of_course?(course)
invite_code = course.invite_code
end
end
%>
var userEnrolled = <%= user_enrolled %>;
$(".enter_btn .li-1.active").on("click", function(){
$(".enroll-btn.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
@ -77,7 +66,20 @@
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
$.ajax({
url: "/api/courses/apply_to_join_course.json",
type: "post",
dataType: 'json',
data: {
student: 1,
invite_code: "<%= invite_code %>"
},
success: function(){
var newTab = window.open("_blank");
newTab.location = url;
window.location.reload()
}
})
return;
}

@ -4,35 +4,35 @@
</div>
<div class="task_popup_con mt15 ml30">
<div class="mr15">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
<input type="text" class="input-60-40 fl" name="invite_code" placeholder="请输入5位课堂邀请码或6位分班邀请码" style="width: 70%;" value="<%= @invitation_code %>">
</li>
<p id="none_invite_code_notice" class="color-orange none f12" style="margin-left: 90px;">请输入5位课堂邀请码或6位分班邀请码</p>
<li class="clearfix ">
<label class="panel-form-label fl">身份:</label>
<span class="fl mr20 mt2">
<form id="new-watcher-form">
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
<input type="text" class="input-60-40 fl" name="invite_code" placeholder="请输入5位课堂邀请码或6位分班邀请码" style="width: 70%;" value="<%= @invitation_code %>">
</li>
<p id="none_invite_code_notice" class="color-orange none f12" style="margin-left: 90px;">请输入5位课堂邀请码或6位分班邀请码</p>
<li class="clearfix ">
<label class="panel-form-label fl">身份:</label>
<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 for="join_course_role_9">教师</label>
</span>
<span class="fl mr20 mt2">
<span class="fl mr20 mt2">
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_7">助教</label>
</span>
<span class="fl mr20 mt2">
<span class="fl mr20 mt2">
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="join_course_role_10">学生/参赛者</label>
</span>
</li>
<p id="none_checked_notice" class="color-orange none f12" style="margin-left: 90px;">请至少选择一个身份</p>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
<% end %>
</li>
<p id="none_checked_notice" class="color-orange none f12" style="margin-left: 90px;">请至少选择一个身份</p>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
</form>
</div>
</div>
</div>
@ -45,10 +45,30 @@
$("#none_invite_code_notice").hide();
if ($("input[name='role[]']:checked").length >= 1){
$("#none_checked_notice").hide();
$('#new-watcher-form').submit();
hideModal();
$.ajax({
url: "/api/courses/apply_to_join_course.json",
type: "post",
dataType: 'json',
data: {
student: $("#join_course_role_10").is(":checked") ? 1 : "",
professor: $("#join_course_role_9").is(":checked") ? 1 : "",
assistant_professor: $("#join_course_role_7").is(":checked") ? 1 : "",
invite_code: $("input[name='invite_code']").val(),
},
success: function(data){
if(data.status == -1){
$("#none_checked_notice").html(data.message).show();
} else if(data.status == 0 && data.message == "成功"){
window.location = "/courses/"+data.course_id+"/students";
} else{
hideModal();
notice_box(data.message);
}
}
});
return;
}else{
$("#none_checked_notice").show();
$("#none_checked_notice").html("请至少选择一个身份").show();
}
}
}

@ -1,10 +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>
<!-- <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>

@ -43,7 +43,7 @@
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="搜索实训项目"/>
<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>
@ -85,8 +85,8 @@
<li><%= link_to '新建项目', new_project_path() %></li>
</ul>
<ul class="fl with50 edu-txt-center">
<li><%= link_to "加入课堂", join_private_courses_courses_path, :remote => true %></li>
<li><%= link_to "加入项目", applied_join_project_path, :remote => true %></li>
<li><%= link_to "加入课堂", join_private_courses_path, :remote => true %></li>
<!-- <li><%#= link_to "加入项目", applied_join_project_path, :remote => true %></li>-->
</ul>
</div>
</div>

@ -41,7 +41,7 @@
</ul>
</div>
<div class="seperateLine"></div>
<input type="text" class="search-input fl" id="search-input" name="search_keyword" placeholder="搜索实训项目"/>
<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>
@ -51,9 +51,10 @@
</div>
<span class="font-15 fr mt15 ml15">
<%= link_to '登录', signin_path, :class => "mr5 color-white" %>
<a href="/login" class="mr5 color-white">登录</a>
<em class="vertical-line"></em>
<%= link_to '注册', user_join_path, :class => "ml5 color-white" %>
<a href="/register" class="mr5 color-white">注册</a>
<%#= link_to '注册', user_join_path, :class => "ml5 color-white" %>
</span>
<div class="fr head-right">
<a href="javascript:void(0)" id="search-open" class="fl headIcon">
@ -65,14 +66,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_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 "加入课堂", signin_path, :remote => true %></li>
<li><%= link_to "加入项目", applied_join_project_path, :remote => true %></li>
<!-- <li><%#= link_to "加入项目", applied_join_project_path, :remote => true %></li>-->
</ul>
</div>
</div>

@ -73,7 +73,7 @@
<div class="surfacePlot ml60 library-cover-select" data-tip-down="上传图片" onclick="$('#library-cover-file').click();">
<img src="/images/educoder/unite.png" class="marginuploading <%= cover_exists ? 'hidden' : '' %>" style="<%= cover_exists ? 'display:none' : '' %>"/>
<div class="library-cover-perview" style="<%= cover_exists ? '' : 'display:none' %>">
<% cover_url = cover_exists ? download_attachment_path(@library.cover_id) : '' %>
<% cover_url = cover_exists ? "/api/attachments/#{@library.cover.id}" : '' %>
<img src="<%= cover_url %>" width="122px" height="93px"/>
</div>
</div>

@ -2,7 +2,7 @@
<% if @libraries.present? %>
<% @libraries.each do |library| %>
<li class="library_list_item">
<% image_url = library.cover.present? ? download_attachment_path(library.cover.id) : 'educoder/library-default-cover.png' %>
<% image_url = library.cover.present? ? "/api/attachments/#{library.cover.id}" : 'educoder/library-default-cover.png' %>
<%= image_tag(image_url, width: 120, height: 90, class: 'mr15 mt3 radius4') %>
<div class="flex1">
<p class="clearfix mb15 lineh-40 mt10">

@ -24,7 +24,7 @@
<td><%= (@page-1)*@limit + index + 1 %></td>
<td><%= course.id %></td>
<td class="edu-txt-left"><%= link_to course.name, course_path(course.id) ,:target => '_blank'%></td>
<td><%= course.members.count %></td>
<td><%= course.course_members_count %></td>
<td><%= course.attachments.count %></td>
<td><%= course.homework_commons.where(:homework_type => 1).count %></td>
<td><%= course.homework_commons.where(:homework_type => 4).count %></td>

@ -3,7 +3,7 @@
<div class="bor-grey-e mb20" id="homePagePara">
<p class="clearfix bor-bottom-greyE pr20 pt5 pb5">
<input type="text" value="首页文字说明" name="config_name" class="panel-box-sizing childcenter_title_input"/>
<a href="javascript:void(0)" class="fr color-blue" onclick="create_submit_data(this);">保存</a>
<a href="javascript:void(0)" class="fr color-blue" onclick="save_submit_data(null, this);">保存</a>
<a href="javascript:void(0)" class="fr mr20" onclick="removePanel();">删除</a>
</p>
<div class="padding15">
@ -130,7 +130,7 @@
<div class="bor-grey-e mb20" id="homePagePara_<%= text.id %>">
<p class="clearfix bor-bottom-greyE pr20 pt5 pb5">
<input type="text" value="<%= text.name %>" name="config_name" class="panel-box-sizing childcenter_title_input">
<a href="javascript:void(0)" class="fr color-blue" onclick="create_submit_data(this);">保存</a>
<a href="javascript:void(0)" class="fr color-blue" onclick="save_submit_data(<%= text.id %>, this);">保存</a>
<a href="javascript:void(0)" class="fr mr20" onclick="removePanel(<%= text.id %>);">删除</a>
</p>
<div class="padding15">
@ -563,6 +563,27 @@
})
}
function save_submit_data(id, nThis){
if (!id) {
create_submit_data(nThis);
return;
}
var textContainer = $('#homePagePara_' + id);
var name = textContainer.find('input[name="config_name"]').val();
var description = textContainer.find('textarea[name="config_description"]').val();
$.ajax({
url: "<%= update_competition_text_managements_path %>",
data: {id: id, name: name, description: description},
type: "post",
success: function (data) {
if(data.status == 1) {
notice_box("保存成功!");
}
}
});
}
$(function(){
$('.add-competition-staff-btn').on('click', function(){
$('.competition-staff-settings').append($('.competition-staff-row-example').html());

@ -16,7 +16,7 @@
<td class="edu-txt-left"><%= link_to message.board.course.name, course_path(message.board.course_id), target: '_blank'%></td>
<td><%= message.board.course.teacher.show_real_name %></td>
<td><%= format_time(message.created_on) %></td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;"><%= link_to message_content(message.content), board_message_path(message.board_id, message), target: '_blank'%></td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;"><%= link_to message_content(message.description), board_message_path(message.board_id, message), target: '_blank'%></td>
<td>
<%= Message.where(:parent_id => message.id).count %>
</td>

@ -25,7 +25,7 @@
<td width="15%" class="edu-txt-left"><%= link_to shixun_task.name,course_path(shixun_task),:target => '_blank' %></td>
<td width="8%"><%= shixun_task.teacher ? link_to(shixun_task.teacher.show_real_name, user_path(shixun_task.teacher)) : "" %></td>
<td width="10%" class="edu-txt-left"><%= shixun_task.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : shixun_task.teacher.try(:user_extensions).try(:school) %></td>
<td width="5%"><%= shixun_task.student.count %></td>
<td width="5%"><%= shixun_task.students.count %></td>
<% homework_commons = shixun_task.homework_commons.where(:homework_type => 4).order("IF(ISNULL(publish_time),1,0),publish_time asc,created_at asc") %>
<td width="7%"><%= homework_commons.size %></td>
<td># 1</td>

@ -8,7 +8,7 @@
<td><%= training.training_payinfo.try(:info) %></td>
<td>
<% if training.training_payinfo.try(:attachment_id).present? %>
<img src="<%= download_attachment_path(training.training_payinfo.try(:attachment_id)) %>" width="50px" class="training_image"/>
<img src="/api/attachments/<%= training.training_payinfo.try(:attachment_id) %>" width="50px" class="training_image"/>
<% end %>
</td>
<td><%= format_time training.created_at %></td>

@ -2,7 +2,8 @@
<% @tids.each do |tids| %>
<% Rails.logger.info("------------------------tid_id---#{tids.id}") %>
<div class="pl25 ridinglist edu-back-white">
<div class="ridinglist-sub clearfix df tiding_item" data-url="<%= tiding_url tids %>">
<!-- <div class="ridinglist-sub clearfix df tiding_item" data-url="<%#= tiding_url tids %>">-->
<div class="ridinglist-sub clearfix df tiding_item">
<% system = tids.tiding_type == "System" %>
<% trigger_user = tids.user %>
<% eval_user = (tids.container_type == "StudentWorksScore" && tids.extra == "3") || (tids.container_type == "StudentWorksScoresAppeal" && tids.parent_container_type == "StudentWork" && tids.tiding_type == "HomeworkCommon") || (tids.container_type == "JournalsForMessage" && tids.tiding_type != "Mentioned" && tids.parent_container_type == "StudentWorksScore" && tids.container.jour.try(:reviewer_role) == 3 && !trigger_user.allowed_to?(:as_teacher, tids.container.jour.student_work.homework_common.course)) %>

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

@ -49,37 +49,37 @@
<div class="educontent mt10 clearfix edu-txt-center">
<div class="inline">
<span class="mypost fl mr10"><%= current_user ? @user.identity : (@user.identity == "学生" ? "" : @user.identity) %></span>
<% if current_user %>
<a href="<%= authentication_account_path %>" target="_blank" class="ringauto fl">
<% if @user.authentication %>
<img src="/images/educoder/icon/auto-identityed.svg" class="mt2" data-tip-down="已实名认证"><!--实名认证-->
<% else %>
<% apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 1).last %>
<img src="/images/educoder/icon/auto-identity.svg" class="mt2" data-tip-down="<%= apply_auth && apply_auth.status == 0 ? '实名认证中' : '未实名认证' %>">
<% end %>
</a>
<a href="<%= professional_certification_account_path %>" target="_blank" class="ringauto fl">
<% if @user.professional_certification %>
<img src="/images/educoder/icon/auto-posted.svg" class="mt2" data-tip-down="已职业认证">
<% else %>
<% apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 2).last %>
<img src="/images/educoder/icon/auto-post.svg" class="mt2" data-tip-down="<%= apply_auth && apply_auth.status == 0 ? '职业认证中' : '未职业认证' %>">
<% end %>
</a>
<% if @user.try(:phone).blank? %>
<a href="<%= change_or_bind_path(:type => 'phone') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phone.svg" class="mt2" data-tip-down="未绑定手机"></a><!--手机认证-->
<% else %>
<a href="<%= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phoneed.svg" class="mt2" data-tip-down="已绑定手机"></a><!--手机认证-->
<% end %>
<% if @user.try(:mail).blank? %>
<a href="<%= change_or_bind_path(:type => 'mail') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-email.svg" class="mt2" data-tip-down="未绑定邮箱"></a><!--邮箱认证-->
<% else %>
<a href="<%= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-emailed.svg" class="mt2" data-tip-down="已绑定邮箱"></a><!--邮箱认证-->
<% end %>
<% if @user.department_members.count > 0 %>
<a href="<%= statistics_college_path(@user.department_members.first.try(:department)) %>" target="_blank" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a><!--学院管理员身份-->
<% end %>
<% else %>
<%# if current_user %>
<!-- <a href="<%#= authentication_account_path %>" target="_blank" class="ringauto fl">-->
<%# if @user.authentication %>
<!-- <img src="/images/educoder/icon/auto-identityed.svg" class="mt2" data-tip-down="已实名认证">-->
<%# else %>
<%# apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 1).last %>
<!-- <img src="/images/educoder/icon/auto-identity.svg" class="mt2" data-tip-down="<%#= apply_auth && apply_auth.status == 0 ? '实名认证中' : '未实名认证' %>">-->
<%# end %>
<!-- </a>-->
<!-- <a href="<%#= professional_certification_account_path %>" target="_blank" class="ringauto fl">-->
<%# if @user.professional_certification %>
<!-- <img src="/images/educoder/icon/auto-posted.svg" class="mt2" data-tip-down="已职业认证">-->
<%# else %>
<%# apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 2).last %>
<!-- <img src="/images/educoder/icon/auto-post.svg" class="mt2" data-tip-down="<%#= apply_auth && apply_auth.status == 0 ? '职业认证中' : '未职业认证' %>">-->
<%# end %>
<!-- </a>-->
<%# if @user.try(:phone).blank? %>
<!-- <a href="<%#= change_or_bind_path(:type => 'phone') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phone.svg" class="mt2" data-tip-down="未绑定手机"></a>-->
<%# else %>
<!-- <a href="<%#= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-phoneed.svg" class="mt2" data-tip-down="已绑定手机"></a>-->
<%# end %>
<%# if @user.try(:mail).blank? %>
<!-- <a href="<%#= change_or_bind_path(:type => 'mail') %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-email.svg" class="mt2" data-tip-down="未绑定邮箱"></a>-->
<%# else %>
<!-- <a href="<%#= my_account_path %>" target="_blank" class="ringauto fl"><img src="/images/educoder/icon/auto-emailed.svg" class="mt2" data-tip-down="已绑定邮箱"></a><-->
<%# end %>
<%# if @user.department_members.count > 0 %>
<!-- <a href="<%#= statistics_college_path(@user.department_members.first.try(:department)) %>" target="_blank" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a>-->
<%# end %>
<%# else %>
<span class="ringauto fl">
<% if @user.authentication %>
<img src="/images/educoder/icon/auto-identityed.svg" class="mt2" data-tip-down="已实名认证"><!--实名认证-->
@ -106,10 +106,12 @@
<% else %>
<span class="ringauto fl"><img src="/images/educoder/icon/auto-emailed.svg" class="mt2" data-tip-down="已绑定邮箱"></span><!--邮箱认证-->
<% end %>
<% if @user.department_members.count > 0 %> <!--访问他人主页无连接 -->
<% if @user.department_members.count > 0 && current_user %> <!--访问他人主页无连接 -->
<a href="<%= statistics_college_path(@user.department_members.first.try(:department)) %>" target="_blank" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a>
<% elsif @user.department_members.count > 0 %>
<a href="javascript:void(0)" class="ringauto fl"><i class="iconfont icon-chengyuanguanli font-12 color-blue" data-tip-down="学院管理员"></i></a><!--学院管理员身份-->
<% end %>
<% end %>
<%# end %>
</div>
</div>
<div class="mt15 educontent clearfix edu-txt-center">

@ -15,7 +15,7 @@
<td class="edu-txt-left"><span><%= link_to ua.key, user_path(ua.key), :target => "_blank" %></span></td>
<td><%= link_to user.try(:show_real_name), user_path(user), target:'_blank' %></td>
<td><%= register_info(ua) %></td>
<td><%= ua.agent_type.to_i == UserAgent::USER_COMPETITION ? "已报名" : "未报名" %></td>
<td><%= competion_info(ua) %></td>
<td><%= ua.ip %></td>
</tr>
<% end %>

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

@ -265,6 +265,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'export_chart_score'
post 'competition_images'
post 'publish'
post 'join_course'
end
collection do
post 'new_competition'
@ -730,6 +731,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'graduation_standard'
post 'create_standard'
post 'create_competition_text'
post 'update_competition_text'
delete 'delete_competition_text'
post 'add_contents_for_school'
post 'add_course_info_for_school'
@ -2603,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:

@ -0,0 +1,8 @@
class ChangeCompetitionTextConfigs < ActiveRecord::Migration
def up
change_column :competition_text_configs, :description, :text
end
def down
end
end

@ -0,0 +1,6 @@
class AddRegisterStatusToUserAgents < ActiveRecord::Migration
def change
add_column :user_agents, :register_status, :integer, :default => 0
add_column :user_agents, :action_status, :integer, :default => 0
end
end

@ -0,0 +1,31 @@
namespace :gitlab do
task :myshixun_newgit => :environment do
g = Gitlab.client
myshixuns = Myshixun.where("repo_name is null")
myshixuns.find_each do |myshixun|
begin
puts myshixun.id
repo_name = g.project(myshixun.gpid).path_with_namespace
puts repo_name
myshixun.update_column(:repo_name, repo_name)
rescue Exception => e
Rails.logger.error("e.message")
end
end
end
task :shixun_newgit => :environment do
g = Gitlab.client
shixuns = Shixun.where("repo_name is null")
shixuns.find_each do |shixun|
begin
puts shixun.id
repo_name = g.project(shixun.gpid).path_with_namespace
puts shixun.id
shixun.update_column(:repo_name, repo_name)
rescue Exception => e
Rails.logger.error("e.message")
end
end
end
end

@ -0,0 +1,39 @@
# register_status: 0未注册1: 代理之前注册2代理之后注册
# register_action: 0未报名1: 代理之前报名2代理之后报名
desc "sync user_agents"
namespace :sync do
task :user_agent => :environment do
UserAgent.find_each do |ua|
puts ua.id
user_action = UserActions.find_by_ip(ua.ip)
params = {}
# 用户注册情况
if user_action
user = User.find(user_action.try(:user_id))
# 即代理之前注册
if user.created_on < ua.created_at
params = params.merge(:register_status => 1)
else
# 代理之后注册的
params = params.merge(:register_status => 2)
end
end
# 用户报名情况
team_member = TeamMember.find_by_user_id(user_action.try(:user_id))
if team_member
# 即代理之前报名的
if team_member.created_at < ua.created_at
params = params.merge(:action_status => 1)
else
# 代理之后报名的
params = params.merge(:action_status => 2)
end
end
if ua.action_status != 2 # 代理成功报名的成绩不受影响
ua.update_attributes(params)
end
end
end
end

@ -405,7 +405,7 @@ function header_search(){
// $.get('/users/search_shixuns_or_course',
// { search: keyword,
// index: index});
window.location.href = "/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
window.location.href = "/search" + "?value=" + keyword;
//e.stopPropagation();//阻止冒泡
}

@ -5,10 +5,10 @@ $(function(){
$(".headphoto").find(".headphoto-black").hide();
});
$("#user_tiddings").on("click", ".tiding_item", function(e){
window.open($(this).attr("data-url"), "_blank");
e.stopPropagation();
});
// $("#user_tiddings").on("click", ".tiding_item", function(e){
// window.open($(this).attr("data-url"), "_blank");
// e.stopPropagation();
// });
$("#user_tiddings").on("click", ".tiding_user_a", function(e){
window.open($(this).attr("data-url"), "_blank");

@ -1,14 +1,23 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Spin } from 'antd';
class Loading extends Component {
render() {
// Loading
return (
<div className="App" style={{minHeight: '800px'}}>
</div>
<div className="App" style={{minHeight: '800px',width:"100%"}}>
<style>
{
`
.margintop{
margin-top:20%;
}
`
}
</style>
<Spin size="large" className={"margintop"}/>
</div>
);
}
}

@ -27,7 +27,7 @@ class CommunityHome extends Component {
}
}
componentWillMount(){
window.document.title = 'Educoder';
window.document.title = 'EduCoder';
}
componentWillReceiveProps(nextProps){

@ -36,14 +36,14 @@ class NewFooter extends Component {
<div className="newFooter edu-txt-center">
<div className="inner-footer_con">
<div className="footercon">
<div class="inline mt40 mb5">
{/* <div class="inline mt40 mb5">
<a href="/" class="fl" style={{height:'70px'}}>
{ImageUrlType===false?<img alt="高校智能化教学与实训平台" src={getImageUrl(ImageUrl)} style={{width: '70px'}}/>:<img alt="高校智能化教学与实训平台" src={getImageUrl(ImageUrl)} style={{width: '100px'}}/>}
</a>
<span class="fl color-grey-c cdefault font-28 ml22" style={{lineHeight:'74px'}}>EduCoder.net</span>
</div>
</div> */}
<ul className="clearfix inner-footernav">
<li><a href="/" className="fl" target="_blank">网站首页</a></li>
<li><a href="/help?index=1" className="fl" target="_blank">关于我们</a></li>

@ -100,7 +100,7 @@ function header_search(){
// $.get('/users/search_shixuns_or_course',
// { search: keyword,
// index: index});
window.location.href = "/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
window.location.href = "/search" + "?value=" + keyword;
//e.stopPropagation();//阻止冒泡
}
//头部导航条的隐藏
@ -257,6 +257,23 @@ class NewHeader extends Component {
localStorage.setItem('competition_uid', true);
}
NewCoursesAndShixuns=(sum)=>{
if(this.props.current_user&&this.props.current_user.login=== ""){
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; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
@ -291,7 +308,8 @@ class NewHeader extends Component {
// console.log(match.path)
console.log(this.props.current_user&&this.props.current_user.login=== "")
console.log(this.state.current_user)
// console.log(match.path.startsWith("/ec_courses"))
return (
<div className="newHeader" id="nHeader">
@ -394,7 +412,7 @@ class NewHeader extends Component {
<li><a href="javascript:void(0)">用户</a></li>
</ul>
</div>
<input type="text" className="search-input fl" id="search-input" name="search_keyword" placeholder="搜索实训项目"/>
<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>
@ -459,22 +477,22 @@ 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>
<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>
{isLogin?
<a href="/courses/join_private_courses" data-remote="true">加入课堂</a>:
<a href="/welcome/join_private_courses" data-remote="true">加入课堂</a>:
<a href="/login" data-remote="true">加入课堂</a>
}
</li>
<li>
{/* <li>
<a href="/applied_project/applied_join" data-remote="true">加入项目</a>
</li>
</li> */}
</ul>
</div>
</div>

@ -12,7 +12,7 @@ body>.-task-title {
}
/*<2A><><EFBFBD><EFBFBD><EFBFBD>Ŵ󾵵<C5B4><F3BEB5B5><EFBFBD><EFBFBD><EFBFBD>·Ŵ󾵵<C5B4>λ<EFBFBD><CEBB>*/
#root .search-all {
width: 219px;
/*width: 219px;*/
}
/*Header START*/
@ -37,7 +37,4 @@ body>.-task-title {
}
/*Main START*/
.newMain {
/* 330̫<30><CCAB><EFBFBD>ˣ<EFBFBD>*/
padding-bottom: 240px !important;
}

@ -13,11 +13,11 @@ const $ = window.$;
let _url_origin = getUrl()
$('head').append( $('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1525440977`) );
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1525440978`) );
$('head').append( $('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/magic-check.css?1525440977`) );
$('head').append( $('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1525440977`) );
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1525440978`) );
$('head').append( $('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-admin.css?1525440977`) );

@ -36,21 +36,23 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.yellowBar{position: absolute;top: 0px;height: 8px;border-radius: 4px;left: 0px;background-color: #FFA800;display: block}
.ratePanelContent-left span{display: block;text-align: center}
/*----------------------------------首页查询输入框*/
.search-all{width: 216px;margin: 0px auto;position: relative;background-color: #24292D;}
.search-all{width: 296px;margin: 0px auto;position: relative;background-color: #24292D;}
.seperateLine { border-left: 1px solid #EAEAEA;float: left;height: 16px;margin-top: 22px; visibility: hidden;}
.search-all .search-input{ width: 181px; outline: none;border: none;height: 30px;margin-top: 15px;border-bottom: 1px solid #eee;background: none;padding-left: 10px;box-sizing: border-box;color: #fff}
.search-all .search-input{ width: 260px; outline: none;border: none;height: 30px;margin-top: 15px;border-bottom: 1px solid #eee;background: none;padding-left: 10px;box-sizing: border-box;color: #fff}
.search-all .search-clear{font-size: 14px;display: inline-block;width: 50px;text-align: center;color: #656565;line-height: 60px;cursor: pointer}
.search-icon{color: #656565;display: block;display: inline-block;height: 60px;width: 30px;cursor: pointer;}
.search-icon path{ fill: #4CACFF;}
/* 右侧内容宽度变化的话需要调整posi-search right的值*/
.posi-search{opacity: 1;position: absolute;top: -2px;background: #fff;z-index: 2; right: -241px;}
.posi-search.unlogin{right: -191px;}
.posi-search{opacity: 1;position: absolute;top: -2px;background: #fff;z-index: 2; right: -200px;}
.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}
.search-content a{display: inline-block;width:100%;height: 30px;line-height: 30px;padding:0px 20px;box-sizing: border-box;text-align: left;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;}
/*底部*/
.newFooter{ position: absolute; bottom: 0; width: 100%; height: 235px;background: #323232; clear:both; min-width: 1200px;z-index:8;left: 0px;}
/* 去掉了logo */
.newFooter{ height: 110px; }
.footercon{border-bottom:1px solid #47494d;}
.inner-footernav{width: 560px;margin: 0px auto}
.inner-footernav li{float: left;height: 50px;width: 80px;text-align: center}

@ -192,6 +192,7 @@ 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*/
.newMain{ margin: 0 auto; padding-bottom: 235px; min-width:1200px;padding-top: 60px}/*padding-bottom根据底部的高度而定*/
.newMain{ padding-bottom: 120px !important; }
/*高度*/
.height-100{height: 100%;}

@ -51,13 +51,13 @@ If you continue to experience problems please contact your Trustie administrator
<p>If you are the Trustie administrator, check your log files for details about the error.</p> -->
<div class="verticalCenter">
<div class="edu-txt-center">
<img src="/images/warn/update.jpeg" >
<img src="http://testbdweb.educoder.net/images/warn/update.jpeg" >
<p class="font-18 mt20">
温馨提示:为了给大家提供更优质的服务
</p>
<p class="font-18">
平台拟于<span style="color: red">2019年4月27日17:00--18:30</span>进行全面升级,带来不便,敬请谅解!
平台拟于<span style="color: red">2019年7月22日10:40--2019年7月22号11:00</span>进行全面升级,带来不便,敬请谅解!
</p>
</div>
</div>user_tidings.html.erb
</body>
</html>

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :course_member do
end
end

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :message_detail do
end
end

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

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