dev_aliyun
jingquan huang 5 years ago
commit ccbb8b9674

@ -80,7 +80,7 @@ class AccountController < ApplicationController
set_autologin_cookie(@user) set_autologin_cookie(@user)
end end
# 记录用户登录行为 # 记录用户登录行为
UserActions.create(:action_id => @user.id, :action_type => "Login", :user_id => @user.id) UserActions.create(:action_id => @user.id, :action_type => "Login", :user_id => @user.id, :ip => request.remote_ip)
end end
respond_to do |format| respond_to do |format|
format.js format.js
@ -381,6 +381,7 @@ class AccountController < ApplicationController
ip = request.remote_ip ip = request.remote_ip
ua = UserAgent.find_by_ip(ip) ua = UserAgent.find_by_ip(ip)
ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua
UserActions.create(:action_id => @user.id, :action_type => "Register", :user_id => @user.id, :ip => ip)
if !@user.new_record? if !@user.new_record?
self.logged_user = @user self.logged_user = @user
flash[:notice] = l(:notice_account_activated) flash[:notice] = l(:notice_account_activated)
@ -1403,7 +1404,7 @@ class AccountController < ApplicationController
code = /\d*/ code = /\d*/
# 记录用户登录行为 # 记录用户登录行为
UserActions.create(:action_id => User.current.id, :action_type => "Login", :user_id => User.current.id) UserActions.create(:action_id => User.current.id, :action_type => "Login", :user_id => User.current.id, :ip => request.remote_ip)
=begin =begin
if user.created_on.strftime('%Y-%m-%d %H:%M:%S') > "2018-01-01 00:00:00" && user.phone.blank? if user.created_on.strftime('%Y-%m-%d %H:%M:%S') > "2018-01-01 00:00:00" && user.phone.blank?
redirect_to change_or_bind_path(:type => 'phone') redirect_to change_or_bind_path(:type => 'phone')

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

@ -228,10 +228,10 @@ class CompetitionTeamsController < ApplicationController
end end
team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id) team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id)
end
# 记录引流 # 记录引流
record_agent_user_action record_agent_user_action
end end
end
# 退出战队 非创建者直接退出,创建者退出则解散团队 # 退出战队 非创建者直接退出,创建者退出则解散团队
def exit_team def exit_team

@ -40,6 +40,20 @@ class WelcomeController < ApplicationController
render :json => {status: 0, message: "success"} render :json => {status: 0, message: "success"}
end end
# 运营引流个人数据展示
def user_agents
@user_agents = UserAgent.where(key: params[:edu]).includes(:user_actionss)
@agents_count = @user_agents.count
limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
@offset ||= @agents_pages.offset
@user_agents = paginateHelper @user_agents, limit
respond_to do |format|
format.js
format.html{ render :layout=>'users_base'}
end
end
def shixun_to_local def shixun_to_local
identifiers = params[:identifiers].split(",") identifiers = params[:identifiers].split(",")

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

@ -22,6 +22,27 @@ module WelcomeHelper
include CoursesHelper include CoursesHelper
include ProjectsHelper include ProjectsHelper
# 引流注册情况
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
end
end
def color_change index def color_change index
case index case index
when 0 when 0

@ -1,4 +1,4 @@
class UserActions < ActiveRecord::Base class UserActions < ActiveRecord::Base
attr_accessible :action_id, :action_type, :user_id attr_accessible :action_id, :action_type, :user_id, :ip
has_many :users has_many :users
end end

@ -1,5 +1,5 @@
class UserAgent < ActiveRecord::Base class UserAgent < ActiveRecord::Base
has_many :user_actionss, :foreign_key => "ip", :primary_key => "ip"
USER_AD = 1 # 广告宣传的引流 USER_AD = 1 # 广告宣传的引流
USER_REGISTER = 2 # 引流注册 USER_REGISTER = 2 # 引流注册
USER_COMPETITION = 3 # 引流参加竞赛 USER_COMPETITION = 3 # 引流参加竞赛

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

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

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

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

@ -1,24 +0,0 @@
<style>
/*//登录弹窗*/
.newLogipopup{
height: 100%;
width: 100%;
background-size: 100% 100%;
position: fixed;
bottom: 0px;
right: 0px;
}
</style>
<div class="educontent newLogipopup" id="backImg" >
<div class="pr edu-txt-center height-100 pt110">
<div class="login_reg pr login_regs">
<div>
<a href="javascript:void(0)" onclick="hideModal();" id="closeIcon" style="position: absolute;right: 0px;"><i class="iconfont icon-shanchudiao"></i></a>
<img src="/images/educoder/competitionslog.png" height="600px" width="600px" />
<img height="600px" width="600px" src="/images/educoder/applys.png" />
</div>
</div>
</div>
</div>

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

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

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

@ -70,11 +70,11 @@
<%= hidden_field_tag 'cover_file_name', '', class: 'cover-file-name' %> <%= hidden_field_tag 'cover_file_name', '', class: 'cover-file-name' %>
<input type="file" name="cover_file" accept="image/*" id="library-cover-file" style="display: none"/> <input type="file" name="cover_file" accept="image/*" id="library-cover-file" style="display: none"/>
<div class="surfacePlot ml25 library-cover-select" data-tip-down="上传图片" onclick="$('#library-cover-file').click();"> <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' : '' %>"/> <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' %>"> <div class="library-cover-perview" style="<%= cover_exists ? '' : 'display:none' %>">
<% cover_url = cover_exists ? download_attachment_path(@library.cover_id) : '' %> <% cover_url = cover_exists ? download_attachment_path(@library.cover_id) : '' %>
<img src="<%= cover_url %>" width="120px" height="90px"/> <img src="<%= cover_url %>" width="122px" height="93px"/>
</div> </div>
</div> </div>
<!-- <p style="height:20px;line-height:20px;"><span class="color-red ml20 none" id="cover_file_notice">请上传封面</span></p>--> <!-- <p style="height:20px;line-height:20px;"><span class="color-red ml20 none" id="cover_file_notice">请上传封面</span></p>-->
@ -147,6 +147,7 @@
if (!title || title.length == 0) { if (!title || title.length == 0) {
$("#title_notice").removeClass("none"); $("#title_notice").removeClass("none");
$("#title_notice").html("请输入标题"); $("#title_notice").html("请输入标题");
$(document).scrollTop(parseInt($("#title_notice").offset().top)-150);
return return
}else{ }else{
$("#title_notice").addClass("none"); $("#title_notice").addClass("none");
@ -163,6 +164,7 @@
if (!content || content.length == 0) { if (!content || content.length == 0) {
$("#des_notice").removeClass("none"); $("#des_notice").removeClass("none");
$(document).scrollTop(parseInt($("#des_notice").offset().top)-150);
return return
}else{ }else{
$("#des_notice").addClass("none"); $("#des_notice").addClass("none");
@ -171,6 +173,7 @@
if (!author_name || author_name.length == 0) { if (!author_name || author_name.length == 0) {
$("#author_name_notice").removeClass("none"); $("#author_name_notice").removeClass("none");
$(document).scrollTop(parseInt($("#author_name_notice").offset().top)-150);
return return
}else{ }else{
$("#author_name_notice").addClass("none"); $("#author_name_notice").addClass("none");
@ -178,6 +181,7 @@
if (!author_name || author_name.length >10) { if (!author_name || author_name.length >10) {
$("#title_author_name").removeClass("none"); $("#title_author_name").removeClass("none");
$(document).scrollTop(parseInt($("#title_author_name").offset().top)-150);
return return
}else{ }else{
$("#title_author_name").addClass("none"); $("#title_author_name").addClass("none");
@ -186,6 +190,7 @@
if (!author_school_name || author_school_name.length == 0) { if (!author_school_name || author_school_name.length == 0) {
$("#author_school_name_notice").removeClass("none"); $("#author_school_name_notice").removeClass("none");
$(document).scrollTop(parseInt($("#author_school_name_notice").offset().top)-150);
return return
}else{ }else{
$("#author_school_name_notice").addClass("none"); $("#author_school_name_notice").addClass("none");
@ -201,6 +206,7 @@
if($('.attachments_fields .attachment').length == 0){ if($('.attachments_fields .attachment').length == 0){
$("#file_notice").removeClass("none"); $("#file_notice").removeClass("none");
$(document).scrollTop(parseInt($("#file_notice").offset().top)-150);
return return
}else{ }else{
$("#file_notice").addClass("none"); $("#file_notice").addClass("none");

@ -9,24 +9,24 @@
<%= link_to library.title, library_path(library),:class => "task-hide font-22 library_l_name" %> <%= link_to library.title, library_path(library),:class => "task-hide font-22 library_l_name" %>
<%= show_library_tags(library, class: 'mt10 ml10') %> <%= show_library_tags(library, class: 'mt10 ml10') %>
<% if params[:type] == 'mine' %> <%# if params[:type] == 'mine' %>
<span class="color-grey-c mr20 fr">上传时间:<%= library.created_at.strftime('%Y-%m-%d %H:%M') %></span> <!-- <span class="color-grey-c mr20 fr">上传时间:<%#= library.created_at.strftime('%Y-%m-%d %H:%M') %></span>-->
<% else %> <%# else %>
<span class="color-grey-c mr20 fr">发布时间:<%= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %></span> <!-- <span class="color-grey-c mr20 fr">发布时间:<%#= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %></span>-->
<% end %> <%# end %>
</p> </p>
<p class="clearfix lineh-20"> <p class="clearfix lineh-20">
<span class="color-grey-c">作者:</span> <!-- <span class="color-grey-c">作者:</span>-->
<span class="color-grey-3 mr10"><%= library.author_name %></span> <span class="color-grey-3 mr10"><%= library.author_name %></span>
<span class="color-grey-3 mr20"><%= library.author_school_name %></span> <span class="color-grey-3 mr20"><%= library.author_school_name %></span>
<span class="color-grey-c mr20"><span class=" item-group-icon mr5"><i class="fa fa-eye"></i></span><%= library.visited_count || 0 %> 浏览</span>
<% download_count = @download_count_map.try(:fetch, library.id, 0) || library.attachments.count %> <% download_count = @download_count_map.try(:fetch, library.id, 0) || library.attachments.count %>
<% if download_count.nonzero? %> <% if download_count.nonzero? %>
<span class="color-grey-c mr20"><span class=" item-group-icon mr5"><i class="fa fa-download"></i></span><%= download_count %> 下载</span> <span class="color-grey-c mr20 fr"><span class=" item-group-icon mr5"><i class="fa fa-download"></i></span><%= download_count %> 下载</span>
<% end %> <% end %>
<% if library.praise_tread_cache.try(:praise_num).to_i.nonzero? %> <% if library.praise_tread_cache.try(:praise_num).to_i.nonzero? %>
<span class="color-grey-c mr20"><span class=" item-group-icon mr5"><i class="fa fa-thumbs-o-up"></i></span><%= library.praise_tread_cache.try(:praise_num) %> 赞</span> <span class="color-grey-c mr20 fr"><span class=" item-group-icon mr5"><i class="fa fa-thumbs-o-up"></i></span><%= library.praise_tread_cache.try(:praise_num) %> 赞</span>
<% end %> <% end %>
<span class="color-grey-c mr20 fr"><span class=" item-group-icon mr5"><i class="fa fa-eye"></i></span><%= library.visited_count || 0 %> 浏览</span>
</p> </p>
</div> </div>
</li> </li>

@ -6,17 +6,17 @@
<%= link_to '发布案例', new_library_path, class: 'white-btn edu-filter-btn-blue fr mr10 mt8', style: 'color: #4CACFF' %> <%= link_to '发布案例', new_library_path, class: 'white-btn edu-filter-btn-blue fr mr10 mt8', style: 'color: #4CACFF' %>
</p> </p>
<div class="clearfix pl30 pr30"> <div class="clearfix pl30 pr30">
<% if User.current.try(:logged?) %>
<ul class="fl library_nav mt20"> <ul class="fl library_nav mt20">
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>"> <li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %> <%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li> </li>
<% if User.current.try(:logged?) %>
<li class="<%= params[:type] == 'mine' ? 'active' : '' %>"> <li class="<%= params[:type] == 'mine' ? 'active' : '' %>">
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %> <%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</li> </li>
</ul>
<% end %> <% end %>
<div class="edu-position fr mt12"> </ul>
<div class="edu-position fr mt12 mb10">
<%= hidden_field_tag(:type, params[:type]) %> <%= 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> <a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>

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

@ -30,9 +30,35 @@
</div> </div>
<div class="-task-sidebars" style="right: 240px !important;"> <div id="trophyreturn" class="-task-sidebars" style="right: 65px !important;width: 154px;">
<a onclick="trophyreturnfun();" id="closeIcon" style="position: absolute;right: 12px;top: 10px; color: #000;">
<i class="iconfont icon-shanchudiao"></i>
</a>
<a href="/competitions"> <a href="/competitions">
<img src="/images/educoder/competition/lvmeng.png" width="150px" height="150px"> <img src="/images/educoder/competition/lvmeng.png" width="150px" height="150px">
</a> </a>
</div> </div>
<script>
function trophyreturnfun(){
$("#trophyreturn").hide()
localStorage.setItem('trophy_uid', true);
}
$(function() {
var trophy_uid = false;
if (window.localStorage) {
trophy_uid = localStorage.getItem('trophy_uid');
} else {
trophy_uid = false
}
if(trophy_uid==="true"||trophy_uid===true){
$("#trophyreturn").hide()
}
})
</script>

@ -0,0 +1,32 @@
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<thead>
<th width="10%">ID</th>
<th width="15%">代理人登录名</th>
<th width="15%">代理人姓名</th>
<th width="20%">注册情况</th>
<th width="20%">竞赛报名</th>
<th width="20%">ip</th>
</thead>
<tbody>
<% @user_agents.each_with_index do |ua, index| %>
<% user = User.find_by_login(ua.key) %>
<tr>
<td><%= index+1 %></td>
<td class="edu-txt-left"><span><%= link_to ua.key, user_path(ua.key), :target => "_blank" %></span></td>
<td><%= link_to user.try(:show_real_name), user_path(user), target:'_blank' %></td>
<td><%= register_info(ua) %></td>
<td><%= ua.agent_type.to_i == UserAgent::USER_COMPETITION ? "已报名" : "未报名" %></td>
<td><%= ua.ip %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="cl"></div>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @agents_pages, @agents_count, :per_page_links => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>

@ -0,0 +1,9 @@
<div class="edu-con-bg01 clearfix mt10 bor-grey-e pt10 pb10">
<div class="pl15">
统计总计:
引流总人数<span class="color-red"><%= @agents_count %></span>人,
</div>
</div>
<div class="edu-con-bg01 mt15" id="managements_department_part_list">
<%= render :partial => "welcome/user_agent_list" %>
</div>

@ -297,6 +297,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'welcome/shixun_to_local' => 'welcome#shixun_to_local' get 'welcome/shixun_to_local' => 'welcome#shixun_to_local'
get 'welcome/local_to_shixun' => 'welcome#local_to_shixun' get 'welcome/local_to_shixun' => 'welcome#local_to_shixun'
get 'welcome/local_init' => 'welcome#local_init' get 'welcome/local_init' => 'welcome#local_init'
get 'welcome/user_agents' => 'welcome#user_agents'
# get 'competitions/home' => 'competitions#home' # get 'competitions/home' => 'competitions#home'
# get 'competitions/hn' => 'competitions#index' # get 'competitions/hn' => 'competitions#index'

@ -0,0 +1,10 @@
class AddIpForUserActions < ActiveRecord::Migration
def up
add_column :user_actions, :ip, :string
UserAgent.where("agent_type is null").update_all(:agent_type => 1)
end
def down
end
end

@ -0,0 +1,8 @@
class AddIndexForUserActions < ActiveRecord::Migration
def up
add_index :user_actions, :ip
end
def down
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 KiB

After

Width:  |  Height:  |  Size: 894 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

@ -35,3 +35,6 @@
.editormd .CodeMirror-linenumbers { .editormd .CodeMirror-linenumbers {
padding: 0; padding: 0;
} }
.editormd-html-preview hr, .editormd-preview-container hr {
border-top: 1px solid #ccc;
}

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

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

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

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

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

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

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

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

@ -7,14 +7,33 @@ const $ = window.$;
class SiderBar extends Component { class SiderBar extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = {
trophyreturn: false
}
} }
componentDidMount() { componentDidMount() {
window._initSider(); window._initSider();
var trophy_uid = false;
if (window.localStorage) {
trophy_uid = localStorage.getItem('trophy_uid');
} else {
trophy_uid = false
}
if(trophy_uid==="true"||trophy_uid===true){
this.setState({
trophyreturn:true
})
}
} }
trophyreturnfun=()=>{
this.setState({
trophyreturn:true
})
localStorage.setItem('trophy_uid', true);
}
render() { render() {
return ( return (
<div> <div>
@ -51,11 +70,15 @@ class SiderBar extends Component {
</div> </div>
</div> </div>
<div className="-task-sidebars" style={{right: "240px"}}> {this.state.trophyreturn===true?"":<div className="-task-sidebars" style={{right: "65x",width: "154px"}}>
<a onClick={this.trophyreturnfun} id="closeIcon"
style={{position: "absolute", right: "12px",top:"10px",color: "#000"}}>
<i className="iconfont icon-shanchudiao"></i>
</a>
<a href="/competitions"> <a href="/competitions">
<img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" /> <img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" />
</a> </a>
</div> </div>}
</div> </div>
); );

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

@ -1243,6 +1243,19 @@ html>body #ajax-indicator { position: fixed; }
} }
.login_regs{ .login_regs{
margin-right: 35%; width: 580px !important;
width: 558px; }
.login_regs a{
cursor: pointer;
}
#member_block{
height: 260px;
overflow-y: auto;
}
#trophyreturn i{
font-size: 16px!important;
color: #AAAAAA;
} }
Loading…
Cancel
Save