Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
cxt 2017-08-31 15:55:05 +08:00
commit c76dff2829
45 changed files with 512 additions and 306 deletions

View File

@ -49,17 +49,17 @@ class CoursesController < ApplicationController
@syllabuses_num = Course.where("is_end = #{@is_end} and is_delete = 0").count
#@syllabus_count = all_syllabuses.count
# 我创建的课堂
create_syllabuses = Course.where(:tea_id => @user.id).where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'")
create_syllabuses = Course.where(:tea_id => @user.id)
# 我参与的课堂
join_syllabuses = @user.courses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
@join_syllabuses_count = join_syllabuses.count
@create_syllabuses_count = create_syllabuses.count
# 页面筛选的课程
if @select == "create"
@syllabuses = create_syllabuses
@syllabuses = create_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'")
elsif @select == "join"
@syllabuses = join_syllabuses
@syllabuses = join_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
elsif @select == "end"
# 归档的课堂
end_syllabuses = Course.where("is_end = #{@is_end} and name like '%#{@search}%'")

View File

@ -3,7 +3,7 @@ class GamesController < ApplicationController
layout "base_myshixun"
skip_before_filter :verify_authenticity_token, :only => [:file_update]
before_filter :find_myshixun, :only => [:index]
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update,
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :get_waiting_time,
:game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice]
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show]
before_filter :allowd_manager
@ -147,6 +147,25 @@ class GamesController < ApplicationController
end
end
# 获取评测的等待的时间
# res['waitNum'] 评测等待人数
# res['waitingTime'] 评测等待时间
# res['onRun'] 0 表示在等待中 1 表示可执行
def get_waiting_time
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
uri = "#{shixun_tomcat}/bridge/game/getWaitingTime"
params = {:tpiID => "#{@myshixun.id}"}
res = uri_exec uri, params
if (res && res['code'] != 0)
@message = "实训云平台繁忙繁忙等级94"
raise("实训云平台繁忙繁忙等级94")
end
render :json => {:result => "success", :onRun => res['onRun'], :waitNum => res['waitNum'], :waitingTime => res['waitingTime'] }
#render :json => {:result => "success", :onRun => 1, :waitNum => 12, :waitingTime => 546 }
rescue Exception => e
render :json => {:result => "failed"}
end
# status 0: 未提交测评或者提交测评失败后报错1中间状态还没返回值2返回值并成功
# resubmit 唯一随机码,为了区分每一次重新评测结果
CODES = %W(1 2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)

View File

@ -185,7 +185,7 @@ class ManagementsController < ApplicationController
end
if params[:support_shixuns]
@major = @major.where(:support_shixuns => params[:support_shixuns].to_i, :major_level => 2)
@major = @major.where(:support_shixuns => params[:support_shixuns].to_i,:major_level=> 2)
end
@major = @major.order("created_at #{@sx_order}")
@ -652,6 +652,7 @@ end
def class_shixuns
@menu_type = 4
@sub_type = 1
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@edit_class_sx_num=Subject.where(:status => 0).count
@audit_class_sx_num=Subject.where(:status => 1).count
@publish_class_sx_num=Subject.where(:status => 2).count
@ -680,6 +681,8 @@ end
user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id))
@schools = School.where(:id => user_exs.map(&:school_id))
end
@c_shixuns = @c_shixuns.order("created_at #{@sx_order}")
@c_shixuns_count = @c_shixuns.count
limit = 20
@c_shixuns_pages = Paginator.new @c_shixuns_count, limit, params['page'] || 1
@ -700,6 +703,7 @@ end
def class_publish_shixuns
@menu_type = 4
@sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
search = params[:search] # 搜索字
keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
if params[:school_id] && params[:school_id] != '0'
@ -719,7 +723,7 @@ end
user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id))
@schools = School.where(:id => user_exs.map(&:school_id))
end
@c_shixuns = @c_shixuns.order("created_at desc")
@c_shixuns = @c_shixuns.order("created_at #{@sx_order}")
@c_shixuns_count = @c_shixuns.count
limit = 20
@c_shixuns_pages = Paginator.new @c_shixuns_count, limit, params['page'] || 1
@ -898,35 +902,56 @@ end
=end
if params[:member_ids] && params[:trial_whether] == "trial_agree"
params[:member_ids].each do |member|
aUser = ApplyAction.where(:user_id => member, :container_type => "TrialAuthorization")
if aUser.blank?
ApplyAction.create(:user_id => member, :container_type => "TrialAuthorization", :status => 1)
else
aUser.update_all(:status => 1)
end
end
aUser = User.where(:id => params[:member_ids])
aUser.update_all(:certification => 1)
apply_user = ApplyAction.where(:user_id => params[:member_ids])
apply_user.update_all(:status => 1) unless apply_user.blank?
elsif params[:member_ids] && params[:trial_whether] == "trial_cancel"
ApplyAction.where(:user_id => params[:member_ids], :container_type => "TrialAuthorization").update_all(:status => 2)
User.where(:id => params[:member_ids]).update_all(:certification => 0)
apply_user = ApplyAction.where(:user_id => params[:member_ids])
apply_user.update_all(:status => 2) unless apply_user.blank?
end
if params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_agree")
if params[:member_ids] && params[:occupation] == "occupation_agree"
User.where(:id => params[:member_ids]).update_all(:professional_certification => true)
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 2)
unless apply_user.blank?
apply_user.update_all(:status => 1)
end
elsif params[:member_ids] && params[:realname] == "realname_agree"
User.where(:id => params[:member_ids]).update_all(:authentication => true)
elsif params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_cancel")
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 1)
unless apply_user.blank?
apply_user.update_all(:status => 1)
end
elsif params[:member_ids] && params[:occupation] == "occupation_cancel"
User.where(:id => params[:member_ids]).update_all(:professional_certification => false)
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 2)
unless apply_user.blank?
apply_user.update_all(:status => 2)
end
elsif params[:member_ids] && params[:realname] == "realname_cancel"
User.where(:id => params[:member_ids]).update_all(:authentication => false)
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 1)
unless apply_user.blank?
apply_user.update_all(:status => 2)
end
end
if params[:trial] == "-1"
apply = ApplyAction.where(:container_type => "TrialAuthorization")
apply_id = apply.blank? ? -1 : "(" + apply.map{|a| a.user_id}.join(",") + ")"
apply_user_id = User.where("id not in #{apply_id} and status = 1").all
apply_user_id = User.where("id not in #{apply_id} and status = 1 and certification = 0").all
apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0]
elsif params[:trial] == "-2"
apply_user_id = User.where(:status => 1).all
apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0]
else
apply = ApplyAction.where(:status => params[:trial])
elsif params[:trial] == "0"
apply = ApplyAction.where(:status => 0)
apply_user_id = apply.blank? ? [-1] : apply.map{|a| a.user_id}.split(",")[0]
else
apply_user_id = User.where(:status => 1, :certification => params[:trial]).all
apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0]
end
if params[:school] == ""
@ -1031,6 +1056,7 @@ end
end
end
apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id)
User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1))
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
@autu_count = @authorizations.count
@ -1155,6 +1181,7 @@ end
format.html
end
end
# 课程实训发布审批
def deal_subject_authorization
apply_action = ApplyAction.find(params[:apply_id])
@ -1180,6 +1207,7 @@ end
format.js
end
end
# 项目实训发布审批
def deal_shixun_authorization
apply_action = ApplyAction.find(params[:apply_id])

View File

@ -668,7 +668,8 @@ class UsersController < ApplicationController
@offset ||= @course_result_pages.offset
@course_result = paginateHelper @course_result, @limit
else
@shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc")
# @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc")
@shixuns_result = Shixun.where("name like ?", "%#{@search}%").reorder("created_at desc")
@shixuns_result_count = @shixuns_result.count
@shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset

View File

@ -142,7 +142,7 @@ module ApplicationHelper
# if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
# return true
# end
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
authentication = User.where(:id => User.current.id, :certification => 1).first
user_identity = User.current.try(:user_extensions).try(:identity)
if user_identity.blank? || authentication.blank?
redirect_to my_account_path
@ -3026,12 +3026,15 @@ module ApplicationHelper
end
end
def identity_authentication_status status
case status
when nil
"未授权"
def identity_authentication_status user
authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last
case user.try(:certification)
when 0
"处理中"
if authorization.try(:status) == 0
"处理中"
else
"未授权"
end
when 1
"已授权"
when 2

View File

@ -5,6 +5,7 @@
# 85challenge创建的时候Jenkins处理异常;86实训评测失败jenkins返回错误结果; 87版本库删除异常88点击评测失败没返回数据89重置链接jenkins返回失败
# 90: 更新公共测试用例失败返回code非091实训有改动评测的时候初始化数据返回数据code非092webssh开启失败接口getConnectInfo返回code值非0
# 93: 实训断开连接失败接口deleteSSH返回code值非0
# 94: 获取评测等待时间失败接口getWaitingTime返回code值为非0
# 116challenge创建关卡的时候返回结果错误
#
class Shixun < ActiveRecord::Base

View File

@ -1,28 +1,28 @@
<div class="panel-form">
<div id="edit_skill_show" class="<%= @challenge_tags.blank? ? "undis" : "" %>">
<div class="clearfix mb20">
<p class="fr">
<% if User.current.manager_of_shixun?(@shixun) %>
<a href="javascript:void(0);" class="shixun-task-btn task-btn-green fr" id="edit_skill">编辑</a>
<% end %>
</p>
</div>
<ul>
<li class="clearfix">
<% unless @challenge_tags.blank? %>
<label class="panel-form-label fl"> 技能标签:</label>
<div class="fl task-bd-grey panel-box-sizing panel-form-width-690">
<% @challenge_tags.each do |tag| %>
<div class="task-tag tag-grey mb10 mr10 fl">
<%= tag.name %>
</div>
<% end %>
</div>
<% end %>
</li>
</ul>
</div>
<ul class="<%= @challenge_tags.blank? ? "" : "undis" %>" id="skill_edit">
<!--<div id="edit_skill_show" class="<%#= @challenge_tags.blank? ? "undis" : "" %>">-->
<!--<div class="clearfix mb20">-->
<!--<p class="fr">-->
<!--<%# if User.current.manager_of_shixun?(@shixun) %>-->
<!--<a href="javascript:void(0);" class="shixun-task-btn task-btn-green fr" id="edit_skill">编辑</a>-->
<!--<%# end %>-->
<!--</p>-->
<!--</div>-->
<!--<ul>-->
<!--<li class="clearfix">-->
<!--<%# unless @challenge_tags.blank? %>-->
<!--<label class="panel-form-label fl"> 技能标签:</label>-->
<!--<div class="fl task-bd-grey panel-box-sizing panel-form-width-690">-->
<!--<%# @challenge_tags.each do |tag| %>-->
<!--<div class="task-tag tag-grey mb10 mr10 fl">-->
<!--<%#= tag.name %>-->
<!--</div>-->
<!--<%# end %>-->
<!--</div>-->
<!--<%# end %>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<ul class="<%#= @challenge_tags.blank? ? "" : "undis" %>" id="skill_edit">
<%= form_for @challenge, :url => update_evaluation_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5),
:html => {:id => "challenge_skill_update", :onkeydown => "if(event.keyCode==13)return false;"} do |f| %>
<%= render :partial => "skill_form", :locals => {:f => f} %>
@ -30,8 +30,8 @@
</ul>
</div>
<script>
$("#edit_skill").click(function(){
$("#edit_skill_show").hide();
$("#skill_edit").show();
});
// $("#edit_skill").click(function(){
// $("#edit_skill_show").hide();
// $("#skill_edit").show();
// });
</script>

View File

@ -31,7 +31,7 @@
<!--<li class="clearfix">-->
<!--<a href="javascript:void(0);" class="task-btn task-btn-green fr" onclick="challenge_skill_update();">保存</a>-->
<!--<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5) %>" class="task-btn fr mr10" id="skill_cancel">取消</a>-->
<!--<a href="<%#= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5) %>" class="task-btn fr mr10" id="skill_cancel">取消</a>-->
<!--</li>-->
</div>
@ -63,6 +63,7 @@
// 获取父节点的id
var obj = $(thisObj).parent();
$(obj).remove();
$("#challenge_skill_update").submit();
}
/* $(document).click(function(e){
if(e.target.id==$("#edit_skill").attr("id")||e.target.id==$("#add_knowledge").attr("id")||e.target.className==$(".knowledge_frame").attr("class")||e.target.className==$(".close").attr("class")||e.target.id==$("#shixun_skill_input").attr("id")){

View File

@ -1,5 +1,5 @@
<div class="active-class">
<div class="task-index-head mt20 mb20">
<div class="task-index-head mt30 mb30">
<div class="task-index-head-top-course">
<h2 class="fl task-inde-head-title">在线课堂</h2>
<div class="cl"></div>
@ -27,15 +27,15 @@
</ul>
</li>-->
<form action="<%= courses_path() %>" data-remote="true" onsubmit="submitFn(this, event);" class="fl ml15" id="search_syllabuses_name" >
<div class="search-wrapper">
<div class="input-holder">
<form action="<%= courses_path() %>" data-remote="true" class="fl ml15" id="search_syllabuses_name" >
<div class="searchFor fr" style="margin-top: -3px">
<div class="searchCon">
<input type="hidden" name="select" id="input_select_val" value="<%= @select %>">
<input type="hidden" name="is_end" id="input_select_text" value="<%= @is_end %>">
<input type="text" class="search-input" name="search" placeholder="输入课堂名称的关键字进行搜索" />
<button class="search-icon" onclick="searchToggle(this, event);"><i class="fa fa-search font-16 mt5"></i></button>
<input type="text" class="searchinput" name="search" placeholder="请输入实训名称的关键字进行搜索" style="background: none;"/>
<i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i>
</div>
<span class="close" onclick="searchToggle(this, event);"><i class="fa fa-times font-16 mt5"></i></span>
<i class="fa fa-search mr5 color-dark-grey search_icon" onclick="search_shixun()" style="margin:10px" title="搜索"></i>
</div>
</form>
</div>
@ -49,6 +49,22 @@
<%= render :partial => 'layouts/public_left_info' %>
<script>
//搜索实训
function search_shixun(){
if($(".searchCon").is(":visible")){
$("#search_syllabuses_name").submit();
} else{
$(".searchCon").show();
}
}
//关闭搜索框
function colse_searchbox(){
$('.searchCon').hide();
if($('.searchinput').val().trim() != ""){
$('.searchinput').val('');
$("#search_syllabuses_name").submit();
}
}
/* ------------------- 添加或取消收藏 ---------------------- */
function add_cancel_to_favorites(nThis){
@ -116,6 +132,7 @@
$("#search_syllabuses_name").submit();
}
}
function submitFn(obj, evt){
value = $(obj).find('.search-input').val().trim();

View File

@ -11,5 +11,5 @@ $("#courses_index_syllabuses_3").attr('href', '<%= courses_path(:select => "join
<% end %>
$("#all_syllabuses").html("<%= @syllabuses_num %>");
$("#my_syllabuses").html("<%= @join_syllabuses_count + @create_syllabuses_count %>");
$("#input_select_val").val('<%= @select %>');
//$("#input_select_val").val('<%#= @select %>');
$("#input_select_text").val('<%= @is_end %>');

View File

@ -1,7 +1,8 @@
<div class="stud-class-container">
<p style="line-height: 2.0;">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %>
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %> > <%= link_to '新建课堂' %>
</p>
<div class="user_bg_shadow bor-grey-e">
<div class="edu-con-top ">

View File

@ -1,4 +1,5 @@
<span class="mt10 -flex c_grey ml15" id="time-consuming"></span>
<span class="mt10 mr15" style="color: #2dad96;" id="game_wating_time"></span>
<% if @st == 0 %>
<div id="reset_code_to_bengin" class="<%= @game.status == 2 ? "" : "undis" %>">
<a href="javascript:void(0)" class="shixun-task-btn task-btn-green mr15 mt8" onclick="delete_confirm_box('<%= reset_new_code_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>', '你在本关中修改的内容将丢失<br />是否确定重新加载上次通过的代码');">加载上次通过的代码</a>
@ -172,118 +173,141 @@
data:{ content: $('#challenge-answer-edit-small').val()},
success: function(data){
if(data.success == "success"){
var i = 0; // i变量用来统计setInterval执行了多少次便于统计访问时间
// 建立job
$.ajax({
url: '<%= game_build_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
success: function (data){
// 每2s匹配一次状态成功2 评测中1 评测 0
var intId = setInterval(function(){
var ajaxTimeoutTest = $.ajax({
url: '<%= game_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
timeout : 50000,
async: false,
data:{"resubmit":data.resubmit},
success:function(data){
// 如果查到了,就退出
i = i + 1;
console.log(i);
if(data.status == 2 || data.status == 0){
if(data.language == "Html"){
tpi_html_show();
}
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();
nAjaxLoading.val("");
nInfoAjaxLoading.val("");
nAjaxLoading.hide();
nInfoAjaxLoading.hide();
// test_sets 公开测hide_test_sets 隐藏测试集
code_evaluation(
eval('[' + data.test_sets + ']'),
data.had_test_count,
data.test_sets_count,
data.had_passed_testsests_error_count,
data.test_sets_hidden_count,
data.test_sets_public_count,
data.had_passed_testsests_hidden_count,
data.had_passed_testsests_public_count,
data.final_score,
data.latest_output,
data.language
);
$("#blacktab_nav_1").trigger("click");
if(data.status == 2){
clearInterval(cm);
clearInterval(intId);
var icon = $("#game_status_<%= @game_challenge.id %>"); // 实训列表的icon
$("#user_grade").html(parseInt($("#user_grade").html()) + parseInt(data.final_score));
console.log("############################################");
console.log(data.score);
console.log(data.tag_count);
console.log($("#shixun_exp_<%=@game_challenge.id %>")[0]);
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.score + "</span>");
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='color-light-green mr5'>+"+ data.score + "</span>");
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+"+ data.tag_count + "</span>");
icon.find("i").attr("class", "fa fa-unlock fr font-18 mt5 color-light-green w20_center");
icon.find("a:last").attr("title", "已完成");
if( data.had_done == 0 ) {
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
}else{
$("#code_estimate").html("<a href='<%= shixun_path(@shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 1}) %>";
}
// 传递具体屏幕的宽高,实现不同浏览器与不同分辨率都能撑满屏幕
pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight);
$("#reset_code_to_bengin").show(); // 显示加载上次通过的代码
}
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
$("#code_test").html(html); // 恢复评测
var codeEstimate = $("#code_estimate").children("a").html();
if(codeEstimate == undefined){
return;
}else if(codeEstimate.trim() == "下一关"){
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
} else if(codeEstimate.trim() == "退出实训"){
$("#code_estimate").html("<a href='<%= shixun_path(@shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
}
}
// 访问60次即120s后后台还未改变状态即执行
if(i == 60){
if(data.language == "Html"){
tpi_html_show();
}
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();
nAjaxLoading.val("");
nInfoAjaxLoading.val("");
nAjaxLoading.hide();
nInfoAjaxLoading.hide();
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
var html_1 = "实训云平台繁忙繁忙等级88";
$("#code_test").html(html);
notice_box(html_1);
}
},
complete: function(XMLHttpRequest,status){if(status=='timeout'){
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();
nAjaxLoading.val("");
nInfoAjaxLoading.val("");
nAjaxLoading.hide();
nInfoAjaxLoading.hide();
ajaxTimeoutTest.abort();
clearInterval(intId);
}}
});
}, 2000);
}
timeID = setInterval(function(){
$.ajax({
url: '<%= get_waiting_time_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
async: false,
success: function(data){
if(data.onRun == 1){
clearInterval(timeID);
$("#game_wating_time").html("");
var i = 0; // i变量用来统计setInterval执行了多少次便于统计访问时间
// 建立job
$.ajax({
url: '<%= game_build_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
success: function (data){
// 每2s匹配一次状态成功2 评测中1 评测 0
var intId = setInterval(function(){
var ajaxTimeoutTest = $.ajax({
url: '<%= game_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
timeout : 50000,
async: false,
data:{"resubmit":data.resubmit},
success:function(data){
// 如果查到了,就退出
i = i + 1;
console.log(i);
if(data.status == 2 || data.status == 0){
if(data.language == "Html"){
tpi_html_show();
}
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();
nAjaxLoading.val("");
nInfoAjaxLoading.val("");
nAjaxLoading.hide();
nInfoAjaxLoading.hide();
// test_sets 公开测hide_test_sets 隐藏测试集
code_evaluation(
eval('[' + data.test_sets + ']'),
data.had_test_count,
data.test_sets_count,
data.had_passed_testsests_error_count,
data.test_sets_hidden_count,
data.test_sets_public_count,
data.had_passed_testsests_hidden_count,
data.had_passed_testsests_public_count,
data.final_score,
data.latest_output,
data.language
);
$("#blacktab_nav_1").trigger("click");
if(data.status == 2){
clearInterval(cm);
clearInterval(intId);
var icon = $("#game_status_<%= @game_challenge.id %>"); // 实训列表的icon
$("#user_grade").html(parseInt($("#user_grade").html()) + parseInt(data.final_score));
console.log("############################################");
console.log(data.score);
console.log(data.tag_count);
console.log($("#shixun_exp_<%=@game_challenge.id %>")[0]);
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.score + "</span>");
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='color-light-green mr5'>+"+ data.score + "</span>");
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+"+ data.tag_count + "</span>");
icon.find("i").attr("class", "fa fa-unlock fr font-18 mt5 color-light-green w20_center");
icon.find("a:last").attr("title", "已完成");
if( data.had_done == 0 ) {
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
}else{
$("#code_estimate").html("<a href='<%= shixun_path(@shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 1}) %>";
}
// 传递具体屏幕的宽高,实现不同浏览器与不同分辨率都能撑满屏幕
pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight);
$("#reset_code_to_bengin").show(); // 显示加载上次通过的代码
}
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
$("#code_test").html(html); // 恢复评测
var codeEstimate = $("#code_estimate").children("a").html();
if(codeEstimate == undefined){
return;
}else if(codeEstimate.trim() == "下一关"){
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
} else if(codeEstimate.trim() == "退出实训"){
$("#code_estimate").html("<a href='<%= shixun_path(@shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
}
}
// 访问60次即120s后后台还未改变状态即执行
if(i == 60){
if(data.language == "Html"){
tpi_html_show();
}
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();
nAjaxLoading.val("");
nInfoAjaxLoading.val("");
nAjaxLoading.hide();
nInfoAjaxLoading.hide();
if( data.had_done == 0 ) {
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
}
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
var html_1 = "实训云平台繁忙繁忙等级88";
$("#code_test").html(html);
notice_box(html_1);
}
},
complete: function(XMLHttpRequest,status){if(status=='timeout'){
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();
nAjaxLoading.val("");
nInfoAjaxLoading.val("");
nAjaxLoading.hide();
nInfoAjaxLoading.hide();
ajaxTimeoutTest.abort();
}}
});
}, 2000);
}
});
}else if(data.onRun == 0){
mintes = parseInt(data.waitingTime / 60);
if(mintes > 1){
$("#game_wating_time").html("目前正有" + data.waitNum + "个任务正在等待,大约需要等待" + mintes + "分钟")
}else{
$("#game_wating_time").html("目前正有" + data.waitNum + "个任务正在等待,大约需要等待" + data.waitingTime + "秒")
}
}
}
})
}, 2000);
});
}
}
});

View File

@ -112,8 +112,8 @@
var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
var index = $("#all_status_show_value").text(); // 搜索课程/项目
index = index == "课堂" ? 1 : 2;
console.log("课堂" === index);
console.log("实训" === index);
// console.log("课堂" === index);
// console.log("实训" === index);
window.location.href = "<%= search_shixuns_or_courses_users_path %>" + "?search=" + keyword + "&index=" + index;
/* $.ajax({
url: "<%#= search_shixuns_or_courses_users_path %>",

View File

@ -5,7 +5,7 @@
<th width="40%" class="edu-txt-left">实训套件名称</th>
<th width="20%" class="edu-txt-left">单位</th>
<th width="15%">创建者</th>
<th class="eud-pointer">发布时间<i class="fa fa-long-arrow-down color-light-green ml5"></i></th>
<th class="eud-pointer">发布时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
</tr>
</thead>
<tbody>
@ -29,3 +29,15 @@
<div class="cl"></div>
</div>
</div>
<script>
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= class_publish_shixuns_managements_path %>",
data: $("#class_publish_shixuns_search").serialize(),
dateType: "script"
});
});
</script>

View File

@ -51,17 +51,6 @@
<script>
// alert(window.location.href);
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= class_shixuns_managements_path %>",
data: $("#class_shixuns_search").serialize(),
dateType: "script"
});
});
$(function(){
$(".subject_hidden").on("click", 'input', function(ev){
var id = $(ev.target).parent().find("div").html();
@ -71,5 +60,16 @@
data:{subject_id: id}
});
});
});
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= class_shixuns_managements_path %>",
data: $("#class_shixuns_search").serialize(),
dateType: "script"
});
});
});
</script>

View File

@ -22,7 +22,7 @@
<td class="edu-txt-left">
<%= link_to syllabus.title,syllabus_path(syllabus.id) %>
</td>
<td><%= link_to syllabus.user.show_name, user_path(syllabus.user) %></td>
<td><%= link_to syllabus.user.show_real_name, user_path(syllabus.user) %></td>
<td><%= format_time syllabus.created_at %></td>
</tr>
<% end %>

View File

@ -1,7 +1,7 @@
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<thead>
<th width="10%">ID</th>
<th class="table_Name_text" width="30%">实训名称</th>
<th width="30%" class="edu-txt-left">实训名称</th>
<th width="8%">顶</th>
<th width="8%">踩</th>
<th width="8%">未通关</th>
@ -14,7 +14,7 @@
<% @shixuns.each do |shixun| %>
<tr>
<td><%= shixun.identifier %></td>
<td><span class="table_Name_text"><%= link_to shixun.name, shixun_path(shixun), :target => "_blank", :title => shixun.name %></span></td>
<td class="edu-txt-left"><span><%= link_to shixun.name, shixun_path(shixun), :target => "_blank", :title => shixun.name %></span></td>
<td>
<%= PraiseTread.where(:praise_tread_object_id => shixun.challenges, :praise_tread_object_type => "Challenge").count %>
</td>

View File

@ -1,3 +1,4 @@
<% unless @apply_status.blank? %>
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
<thead>
<tr>
@ -24,6 +25,9 @@
<% end %>
</tbody>
</table>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
<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">

View File

@ -21,7 +21,7 @@
</td>
<td class="edu-txt-left">
<span>
<%= link_to schools.name,"http://#{Setting.host_name}/?schools_id=#{schools.id}" %>
<%= schools.name %>
</span>
</td>
<td><%= schools.province %></td>

View File

@ -1,7 +1,7 @@
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<thead>
<th width="9%">ID</th>
<th class="table_Name_text" >实训名称</th>
<th width="18%" class="edu-txt-left">实训名称</th>
<th width="8%">顶</th>
<th width="8%">踩</th>
<th width="8%">已通关</th>
@ -15,7 +15,7 @@
<% @shixuns.each do |shixun| %>
<tr>
<td><%= shixun.identifier %></td>
<td><span class="table_Name_text"><%= link_to shixun.name, shixun_path(shixun), :target => "_blank", :title => shixun.name %></span></td>
<td class="edu-txt-left"><span><%= link_to shixun.name, shixun_path(shixun), :target => "_blank", :title => shixun.name %></span></td>
<td>
<%= PraiseTread.where(:praise_tread_object_id => shixun.challenges, :praise_tread_object_type => "Challenge").count %>
</td>

View File

@ -1,7 +1,7 @@
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<thead>
<th width="10%">ID</th>
<th class="table_Name_text" width="25%">实训名称</th>
<th width="25%" class="edu-txt-left">实训名称</th>
<th width="15%">技术平台</th>
<th width="5%">任务</th>
<th width="10%">状态</th>
@ -13,7 +13,7 @@
<% @shixuns.each do |shixun| %>
<tr>
<td><%= shixun.identifier %></td>
<td><span class="table_Name_text"><%= link_to shixun.name, shixun_path(shixun), :target => "_blank", :title => shixun.name %></span></td>
<td class="edu-txt-left"><span><%= link_to shixun.name, shixun_path(shixun), :target => "_blank", :title => shixun.name %></span></td>
<td><%= shixun.language %></td>
<td><%= shixun.challenges.count %></td>
<td><%= shixun_authentication_status shixun %></td>
@ -22,7 +22,7 @@
<td class="operate">
<!-- <a class="fl" href="<%#= shixun_path(shixun) %>" data-method="delete" >删除</a>-->
<% if shixun.status == 0 %>
<%= link_to(l(:button_delete), shixun_path(shixun), :method => :delete, :data => { confirm: "确认删除" } ) %>
<%= link_to(l(:button_delete), shixun_path(shixun), :method => :delete, :data => { confirm: "您确定要删除吗?" } ) %>
<% end %>
<span class="fr ml5 shixun_hidden">
<input type="checkbox" <%= shixun.hidden ? 'checked' : "" %> value="0" id="shixun_hidden_<%= shixun.id %>" name="hidden" class="ml-3 mr5 magic-checkbox">

View File

@ -1,3 +1,4 @@
<% unless @authorizations.blank? %>
<% @authorizations.each do |authorization| %>
<div class="admin-con-box clearfix">
<% user = authorization.user %>
@ -34,6 +35,9 @@
</div>
</div>
<% end %>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
<script type="text/javascript">
function subject_agree_authorization(id){

View File

@ -1,3 +1,4 @@
<% unless @apply_status.blank? %>
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
<thead>
<tr>
@ -81,6 +82,10 @@
<% end %>
</tbody>
</table>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
<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">

View File

@ -15,7 +15,6 @@
</thead>
<tbody>
<% @users.each_with_index do |user,index| %>
<% authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last %>
<tr>
<td style="padding-left:15px;">
<input id="authorization_<%= user.id %>" type="checkbox" class="magic-checkbox" name="member_ids[]" value="<%= user.id %>">
@ -33,7 +32,7 @@
<td><%= user.professional_certification ? "已认证" : "未认证" %></td>
<td ><span class="edu-txt-w140 task-hide2" title="<%= user.try(:user_extensions).try(:school).try(:name) %>"><%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %></span></td>
<td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td>
<td><%= identity_authentication_status(authorization.try(:status)) %></td>
<td><%= identity_authentication_status(user) %></td>
</tr>
<% end %>
</tbody>

View File

@ -13,6 +13,7 @@
<input class="fl task-form-20 task-height-30" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="cla_sx_Look_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_publish_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2 ">清除</a>
<input name="sx_order" type="hidden">
</div>
<div class="edu-con-bg01 mt15" id="class_shixun_list">
<%= render :partial => "managements/class_publish_shixuns_list" %>

View File

@ -1,17 +1,6 @@
<!--<form action="<%#= search_user_managements_path %>" id="management_search_user" method="post" data-remote="true">-->
<%= form_tag(url_for(search_user_managements_path), :id => "management_search_user", :method => "post", :remote => true) do %>
<div class="edu-class-top mt15 clearfix ">
<!-- <div class="edu-position edu-admin-select fl mr10" style="width:100px;" >
<p>认证情况<i class="fa fa-caret-down ml10" ></i></p>
<input type="hidden" name="authentication" value="">
<ul class="edu-admin-option">
<li data-val="">认证情况</li>
<li data-val="1">已认证</li>
<li data-val="-1">未认证</li>
<li data-val="0">处理中</li>
<li data-val="2">被拒绝</li>
</ul>
</div>-->
<div class="edu-position edu-admin-select fl mr10" style="width:110px;">
<p>试用授权情况<i class="fa fa-caret-down ml10" ></i></p>
<input type="hidden" name="trial" value='-2'>

View File

@ -20,7 +20,7 @@ function showPreview(source) {
<%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
<div style="clear: both;"></div>
<div class="mt15">学校名称:<input type="text" name="name" placeholder="现在对应的学校名称" value="<%= @school.name%>" class="schoolName ml10"/></div>
<div class="mt10">学校省
<div class="mt10">学校省
<select class="provinceSelect ml10" name="province">
<option value="" class="">--请选择省份--</option>
<option value="北京市" <%= @school.province == '北京市' ? 'selected':'' %>>北京</option>

View File

@ -1,5 +1,5 @@
<div class="task-index">
<div class="task-index-head mt20 mb20 user_bg_shadow">
<div class="task-index-head mt30 mb30 user_bg_shadow">
<div class="task-index-head-top">
<h2 class="fl task-inde-head-title">全部实训</h2>
<div class="cl"></div>

View File

@ -48,9 +48,9 @@
<a href="javascript:void(0);" class="tab_type">参考答案</a>
</li>
<% end %>
<% if @is_teacher%>
<% if @is_teacher %>
<div class="fr edu-position edu-position-hidebox mr15 mt8">
<a href="javascript:void(0);" class="font-16"><i class="fa fa-bars"></i></a>
<a href="javascript:void(0);" class="font-16"><i class="fa fa-bars mr15 mt20"></i></a>
<ul class="edu-position-hide undis" style="left:-85px;">
<% if @homework.homework_type != 4 %>
<li>

View File

@ -33,14 +33,14 @@
<p class="font-14 three_lines_show task-text-center mb20 color-dark-grey justify break_word" style="text-align: left;">
<%= subject.description.blank? ? "轻松学习#{subject.name}~" : subject.description %>
</p>
<p class="color-grey bor-bottom-greyE mb5 clearfix" style="text-align:center;">
<span class="pl5 pr5"><i class="fa fa-pause-circle color-light-green transform90 pr5" aria-hidden="true" data-tip-down="章节"></i><em><%= subject.stages.count %></em></span>
<span class="pl5 pr5"><i class="fa fa-gamepad color-light-green pr5" aria-hidden="true" data-tip-down="实训"></i><em><%= subject.stage_shixuns.count %></em></span>
<p class="color-grey bor-bottom-greyE mb15 pb15 clearfix" style="text-align:center;">
<span class="pl5 pr5"><i class="fa fa-pause-circle color-light-green transform90" aria-hidden="true" data-tip-down="章节" style="position: relative;right:5px"></i><em><%= subject.stages.count %></em></span>
<span class="pl5 pr5"><i class="fa fa-gamepad color-light-green pr5" aria-hidden="true" data-tip-down="实训" style="position: relative;top:-1px"></i><em><%= subject.stage_shixuns.count %></em></span>
<span class="pl5 pr5"><i class="fa fa-viacoin color-light-green pr5" aria-hidden="true" data-tip-down="总经验值"></i><em><%= subject.subject_score %></em></span>
<span class="pl5 pr5"><i class="fa fa-users color-light-green pr5" aria-hidden="true" data-tip-down="学习人数"></i><em><%= subject.subject_challenges %></em></span>
</p>
<div class="clearfix mb10 df">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(subject.user), :width =>"40", :height => "40", :class => "bor-radius-all mr10 fl mt8", :alt=>"头像") %></a>
<div class="clearfix mb15 df">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(subject.user), :width =>"40", :height => "40", :class => "bor-radius-all mr10 fl mt5", :alt=>"头像") %></a>
<div class="fl" style="flex: 1;text-align: left">
<p class="color-dark-grey"><%= subject.user.try(:show_name) %></p>
<p class="font-12 unit-name color-dark-grey"><%= subject.user.school_name %></p>

View File

@ -1,6 +1,6 @@
<div class="active-class">
<div class="course_shixun_list">
<div class="task-index-head mt20 mb20">
<div class="task-index-head mt30 mb30">
<div class="header-color">
<h2 class="fl task-inde-head-title">实训路径</h2>
<div class="cl"></div>

View File

@ -133,8 +133,8 @@
<!--<i class="fa fa-pencil mt10 mr5 color-grey-c edit-produce font-12"data-tip-down="编辑" onclick="edit_produce();"></i>-->
<%# end %>
</p>
<div class="mb30">
<div style="text-align: center" class="mt30 mb20">
<div class="mt40 mb40">
<div style="text-align: center">
<p style="line-height: 15px"><%= link_to image_tag(url_to_avatar(@subject.user), :width =>"80", :height => "80", :class => "bor-radius-all", :alt=>"头像"),user_path(@subject.user), :target => '_blank' %></p>
<p><a href="<%= user_path(@subject.user) %>" target="_blank"><%= @subject.user.try(:show_name) %></a></p>
<p style="line-height: 19px" class="color-dark-grey font-12"><%= @subject.user.school_name %></p><!--+ @subject.user.identity-->
@ -144,9 +144,9 @@
<input id="current_user_id" value="<%= User.current.id %>" type="hidden">
</div>
<% subject_co_users(@subject).each do |user| %>
<div>
<div style="text-align: center" class="mb20 mt20">
<p style="line-height: 15px;width:80px;margin:0px auto" class="bor-top-greyE pt20"><a href="<%= user_path(user) %>" target="_blank"><%= image_tag(url_to_avatar(user), :width =>"80", :height => "80", :class => "bor-radius-all", :alt=>"头像") %></a></p>
<div class="mb40">
<div style="text-align: center">
<p style="line-height: 15px;width:50%;margin:0px auto" class="bor-top-greyE pt40"><a href="<%= user_path(user) %>" target="_blank"><%= image_tag(url_to_avatar(user), :width =>"80", :height => "80", :class => "bor-radius-all", :alt=>"头像") %></a></p>
<p><a href="<%= user_path(user) %>" target="_blank"><%= user.try(:show_name) %></a></p>
<p style="line-height: 19px" class="color-dark-grey font-12"><%= user.school_name + user.identity %></p>
</div>

View File

@ -1,7 +1,7 @@
<div class="edu-class-container" style="flex: 1 0 auto;">
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %>
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %> > <%= link_to '新建课程' %>
</p>
<div class="user_bg_shadow bor-grey-e">
<div class="edu-con-top ">

View File

@ -21,21 +21,24 @@
<div class="color-grey school-name"><%= user.school_name.empty? ? "--" : user.school_name %></div>
<div class="clearfix" style="line-height: 35px">
<span class="font-12 color-grey">粉丝&nbsp;<%= get_fans_users(user)[0] %></span>
<!-- <a href="javascript:void(0);" class="btn-focus fr color-grey">已关注</a>-->
<% if user.watched_by?(@user) %>
<%= link_to "已关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => user.id, :user_watcher => action),
:class => "btn-focus fr color-grey",
:method => "delete",
:remote => "true",
:title => "取消关注" %>
<% else %>
<%= link_to "关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => user.id, :user_watcher => action),
:class => "btn-focus fr color-grey",
:method => "post",
:remote => "true",
:title => "关注" %>
<% if @user == current_user %>
<% if user.watched_by?(@user)%>
<%= link_to "已关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => user.id, :user_watcher => action),
:class => "btn-focus fr color-grey",
:method => "delete",
:remote => "true",
:title => "取消关注" %>
<% else %>
<%= link_to "关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => user.id, :user_watcher => action),
:class => "btn-focus fr color-grey",
:method => "post",
:remote => "true",
:title => "关注" %>
<% end %>
<% end %>
</div>
</div>

View File

@ -9,41 +9,48 @@
<div class="content clearfix" id="intelligence_course_list">
<% if !@course_result.blank? %>
<div class="mh650">
<% @course_result.each do | sy | %>
<% sy_author = User.find(sy.tea_id) %>
<div class="sub-con fl" style="cursor: default;">
<div class="task-index-list-box-top">
<a href="<%= course_path(sy) %>" title="<%= sy.name %>" target="_blank">
<p class="font-14 task-index-list-title two_lines_show">
<%= sy.name %>
<% @course_result.each do |sy| %>
<% sy_author = User.find(sy.tea_id) %>
<div class="sub-con fl" style="cursor: default; position:relative">
<% unless (sy.is_public == 1 || User.current.admin? || User.current.member_of_course?(sy)) %>
<div class="black-half">
<div class="black-half-lock"><i class="fa fa-lock" style="font-size: 50px"></i></div>
<div class="black-half-info font-16">私有课堂,非成员不能访问</div>
</div>
<% end %>
<div class="task-index-list-box-top">
<a href="<%= course_path(sy) %>" title="<%= sy.name %>" target="_blank">
<p class="font-14 task-index-list-title two_lines_show">
<%= sy.name %>
</p>
</a>
<div class="clearfix task-index-list-user">
<%= link_to image_tag(url_to_avatar(sy_author), :width => "60", :height => "60", :class => "panel-warp-img mr10 fl", :alt => "用户"), user_path(sy_author), :target => '_blank' %>
<%= link_to sy_author.show_name, user_path(sy_author), :class => 'task-index-name task-hide fl', :target => '_blank' %>
</div>
<p class="color-grey">
<% if !sy_author.user_extensions.school_id.blank? && sy_author.user_extensions.school %>
<%= sy_author.user_extensions.school.name %>
<% end %>
</p>
</div>
<div class="bot" style="text-align: center;">
<p class="color-grey pl15 pr15 clearfix">
<% syMembers = sy.members.count %>
<% syResource = visable_attachemnts_incourse(sy) %>
<% syHome = visable_course_homework(sy) %>
<span class="" style="margin: 0 10px"><i class="fa fa-users color-light-green pr10" aria-hidden="true" title="成员"></i><em><%= syMembers %></em></span>
<% if syResource.count > 0 %>
<span class="" style="margin: 0 10px"><i class="fa fa-cubes color-light-green pr10" aria-hidden="true" title="资源"></i><em><%= syResource.count %></em></span>
<% end %>
<% if syHome > 0 %>
<span class="" style="margin: 0 10px"><i class="fa fa-map color-light-green pr10" aria-hidden="true" title="题库"></i><em><%= syHome %></em></span>
<% end %>
</p>
</a>
<div class="clearfix task-index-list-user">
<%= link_to image_tag(url_to_avatar(sy_author), :width => "60", :height => "60", :class => "panel-warp-img mr10 fl", :alt => "用户"), user_path(sy_author), :target => '_blank' %>
<%= link_to sy_author.show_name, user_path(sy_author), :class => 'task-index-name task-hide fl', :target => '_blank' %>
</div>
<p class="color-grey">
<% if !sy_author.user_extensions.school_id.blank? && sy_author.user_extensions.school %>
<%= sy_author.user_extensions.school.name %>
<% end %>
</p>
</div>
<div class="bot" style="text-align: center;">
<p class="color-grey pl15 pr15 clearfix">
<% syMembers = sy.members.count %>
<% syResource = visable_attachemnts_incourse(sy) %>
<% syHome = visable_course_homework(sy) %>
<span class="" style="margin: 0 10px"><i class="fa fa-users color-light-green pr10" aria-hidden="true" data-tip-down="成员"></i><em><%= syMembers %></em></span>
<% if syResource.count > 0 %>
<span class="" style="margin: 0 10px"><i class="fa fa-cubes color-light-green pr10" aria-hidden="true" data-tip-down="资源"></i><em><%= syResource.count %></em></span>
<% end %>
<% if syHome > 0 %>
<span class="" style="margin: 0 10px"><i class="fa fa-map color-light-green pr10" aria-hidden="true" data-tip-down="题库"></i><em><%= syHome %></em></span>
<% end %>
</p>
</div>
</div>
<% end %>
<% end %>
<div class="cl"></div>
</div>
<div style="text-align:center;">
@ -55,37 +62,54 @@
</div>
</div>
<% elsif !@shixuns_result.blank? %>
<div class="mh650">
<% @shixuns_result.each do |shixun| %>
<div class="task-index-list-box fl">
<div class="task-index-list-box fl" style="position: relative">
<% if shixun.status == 2 %>
<p class="triangle-topright font-12"></p>
<span class="triangle-font">已发布</span>
<% end %>
<% if shixun.status < 2 && !User.current.manager_of_shixun?(shixun) %>
<div class="black-half">
<div class="black-half-lock"><i class="fa fa-lock" style="font-size: 50px"></i></div>
<div class="black-half-info font-16">非试用内容,需要授权</div>
</div>
<% end %>
<div class="task-index-list-box-top xy_box" onclick="shixun_link('<%= shixun.identifier %>')" style="cursor: pointer;">
<p class="task-index-list-title two_lines_show">
<a href="javascript:void(0);"><%= shixun.name %></a>
</p>
<div class="clearfix task-index-list-user task_yx_bo">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(shixun.owner), :width =>"60", :height => "60", :class => "panel-warp-img mr10 fl", :alt=>"头像") %></a>
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(shixun.owner), :width => "60", :height => "60", :class => "panel-warp-img mr10 fl", :alt => "头像") %></a>
<span class="task-index-name task-hide fl"><%= shixun.owner.try(:show_name) %></span>
</div>
<div class="cl"></div>
<span class="mt10 mb10"><%= shixun.language %></span>
<p class="xy_level"><%= shixun.shixun_trainee %></p>
</div>
<ul class="task-index-list-box-bottom clearfix">
<li><i class="fa fa-gamepad mr5 color-light-green" data-tip-down="实训任务"></i><span><%= shixun.challenges.count %></span></li>
<li><i class="fa fa-users mr5 color-light-green" data-tip-down="已开启实训"></i><span><%= shixun.myshixuns.count %></span></li>
<li><i class="fa fa-viacoin mr5 color-light-green" data-tip-down="实训经验值"></i><span><%= shixun.shixun_score %></span></li>
<li>
<i class="fa fa-gamepad mr5 color-light-green" title="实训任务"></i><span><%= shixun.challenges.count %></span>
</li>
<li>
<i class="fa fa-users mr5 color-light-green" title="已开启实训"></i><span><%= shixun.myshixuns.count %></span>
</li>
<li>
<i class="fa fa-viacoin mr5 color-light-green" title="实训经验值"></i><span><%= shixun.shixun_score %></span>
</li>
</ul>
</div>
<% end %>
<div class="cl"></div>
</div>
<div style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @shixun_pages, @shixuns_result_count, :per_page_links => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
<% else %>
<div class="edu-tab-con-box">
@ -93,11 +117,37 @@
<p class="edu-nodata-p mb30">没有数据可以显示!</p>
</div>
<% end %>
</div>
</div>
<script>
function shixun_link(shixun){
console.log(shixun);
window.open('/shixuns/' + shixun);
}
</script>
</div>
</div>
<script>
function shixun_link(shixun){
console.log(shixun);
window.open('/shixuns/' + shixun);
};
var timer="";
$(".task-index-list-box").hover(function(ev){
this.fn = function(){
$(this).find(".black-half").show();
}
clearTimeout(timer);
var item=$(this);
timer=setTimeout(this.fn(),500);
},function(){
clearTimeout(timer);
$(this).find(".black-half").hide();
});
var timer="";
$(".sub-con").hover(function(ev){
this.fn = function(){
$(this).find(".black-half").show();
};
clearTimeout(timer);
var item=$(this);
timer=setTimeout(this.fn(),500);
},function(){
clearTimeout(timer);
$(this).find(".black-half").hide();
})
</script>

View File

@ -103,7 +103,7 @@
<!--<%#= link_to '编辑我的资料', my_account_path %>-->
<!--</p>-->
<p class="p2 font-12">
<p class="p2 font-12 mt12">
<i class="fa fa-eye font-12" aria-hidden="true"></i>
<% update_visiti_count @user %>
<span><%= @user.visits.to_i %></span> 次访问

View File

@ -1,10 +1,10 @@
<div class="-task-con">
<div class="-task-con-int">
<div class="favour">
<% str = current_user ? '我' : 'TA' %>
<% str = (current_user == @user) ? '我' : 'TA' %>
<ul id="edu-user-tab-nav">
<li class=" new-tab-nav">
<a href="<%= user_watchlist_user_path(@user) %>" class="font-16 tab_type" id="user_watcher_cout" ><%= str %>的关注 <%= @user_watchlist_count %></a>
<a href="<%= user_watchlist_user_path(@user) %>" class="font-16 tab_type" id="user_watcher_cout" ><%= str %>的关注 <%= @user_watchlist_count %></a>
</li>
<li class="edu-user-tab-hover new-tab-nav">
<a href="<%= user_fanslist_user_path(@user) %>" class="font-16 tab_type" id="user_fans_count"><%= str %>的粉丝 <%= @user_fanlist_count %></a>
@ -29,4 +29,5 @@
$(this).html() == "关注" ? $(this).html("关注") : $(this).html("已关注");
}
});
</script>

View File

@ -138,6 +138,7 @@ RedmineApp::Application.routes.draw do
resources :games, :path => "stages" do
member do
match 'game_build', :via => [:get, :post]
match 'get_waiting_time', :via => [:get, :post]
match 'next_step', :via => [:get, :post]
match 'reset_original_code', :via => [:get, :post]
match 'reset_new_code', :via => [:get, :post]

View File

@ -0,0 +1,5 @@
class AddCertificationToUser < ActiveRecord::Migration
def change
add_column :users, :certification, :boolean, :default => 0
end
end

View File

@ -0,0 +1,11 @@
class UpdateApplyActionToUser < ActiveRecord::Migration
def up
apply_users = ApplyAction.where(:status => 1, :container_type => "TrialAuthorization")
apply_users.each do |apply|
User.where(:id => apply.user_id).first.update_column(:certification, 1)
end
end
def down
end
end

View File

@ -0,0 +1,8 @@
class ModifyCertificationForUser < ActiveRecord::Migration
def up
change_column :users, :certification, :integer, :default => 0
end
def down
end
end

View File

@ -0,0 +1,13 @@
class UpdateRejectCerticationForUser < ActiveRecord::Migration
def up
apply_users = ApplyAction.where(:status => 2, :container_type => "TrialAuthorization")
unless apply_users.blank?
apply_users.each do |apply|
User.where(:id => apply.user_id).first.update_column(:certification, 2)
end
end
end
def down
end
end

View File

@ -97,7 +97,7 @@ a:hover.link-color-grey03{color:#3498db!important;}
.mb5{ margin-bottom: 5px;}.mb10{ margin-bottom: 10px;}.mb15{ margin-bottom: 15px;}.mb20{ margin-bottom: 20px;}.mb25{ margin-bottom: 25px;}.mb30{ margin-bottom: 30px;}.mb40{ margin-bottom: 40px;}.mb50{ margin-bottom: 50px;}
.ml-3{ margin-left: -3px;}.ml5{ margin-left: 5px;}.ml6{ margin-left: 6px;}.ml10{ margin-left: 10px;}.ml15{ margin-left: 15px;}.ml20{ margin-left: 20px;}.ml25{ margin-left: 25px;}.ml30{ margin-left: 30px;}.ml33{ margin-left: 33px;}.ml35{ margin-left:35px;}.ml40{margin-left:40px;}.ml42{margin-left:42px;}.ml50{ margin-left: 50px;}.ml75{ margin-left: 75px;}.ml95{ margin-left: 95px;}.ml115{margin-left: 115px}.ml230{ margin-left: 230px;}
.mr3{margin-right: 3px}.mr5{ margin-right: 5px;}.mr10{ margin-right: 10px;}.mr15{ margin-right: 15px;}.mr18{ margin-right: 18px;}.mr20{ margin-right: 20px;}.mr25{ margin-right: 25px;}.mr30{ margin-right:30px;}.mr40{margin-right:40px;}.mr50{ margin-right: 50px;}.mr60{ margin-right:60px;}
.pt5{ padding-top:5px;}.pt10{ padding-top:10px;}.pt15{ padding-top:15px;}.pt20{ padding-top:20px;}.pt30{ padding-top:30px;}
.pt5{ padding-top:5px;}.pt10{ padding-top:10px;}.pt15{ padding-top:15px;}.pt20{ padding-top:20px;}.pt30{ padding-top:30px;}.pt40{ padding-top:40px;}
.pb5{ padding-bottom:5px;}.pb10{ padding-bottom:10px;}.pb15{ padding-bottom:15px;}.pb20{ padding-bottom:20px;}.pb30{ padding-bottom:30px;}
.pl5{ padding-left:5px;}.pl8{ padding-left:8px;}.pl10{ padding-left:10px;}.pl15{ padding-left:15px;}.pl20{ padding-left:20px;}.pl30{ padding-left:30px;}.pl50{ padding-left:50px;}.pl35{ padding-left:35px;}
.pr5{ padding-right:5px;}.pr10{ padding-right:10px;}.pr15{ padding-right:15px;}.pr20{ padding-right:20px!important;}.pr30{ padding-right:30px!important;}
@ -445,7 +445,12 @@ input::-ms-clear{display:none;}
.transform90{transform: rotate(90deg);}
/*---------------------编辑器边框------------------------*/
.kindeditor{background: #F0F0EE;height:22px;border:1px solid #CCCCCC;border-bottom: none}
<<<<<<< HEAD
/*两端对齐*/
.justify{text-align: justify;}
.justify{text-align: justify;}
=======
/**/
#edu-tab-nav .edu-position-hidebox li a{font-size: 12px}
>>>>>>> dev_xucheng

View File

@ -3,15 +3,15 @@
/*linear-gradient(to right, rgb(68, 190, 164) 0%, rgb(62, 158, 207) 100%)*/
.box_bg_shandow{box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);}
.active-class .content .pre_sub-con{width:23.87%;margin: 0 1.5% 2.55% 0px;height: 269px;}
.active-class .content .pre_sub-con:nth-child(4n+0){margin:0 0 2.55% 0;}
.active-class .content .pre_sub-con{width:23.87%;margin: 0 1.5% 40px 0px;height: 285px;}
.active-class .content .pre_sub-con:nth-child(4n+0){margin:0 0 40px 0;}
.active-class .content .pre_sub-con:hover{cursor: pointer;-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1;}
.pre-book{height: 100%;position:absolute;}
.subject-box{padding: 20px;background: #fff;text-align: center;position: relative;}
.unit-name{line-height: 17px;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;height: 32px; word-wrap: break-word;}
.unit-name{line-height: 17px;height: 17px;width:196px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.active-class .content .sub-con{width:23.69%;border:1px solid #eee;background:#fff;margin: 0 1.5% 1.5% 0px;box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);}
.active-class .content .sub-con:nth-child(4n+0){margin:0 0 1.5% 0;}
.active-class .content .sub-con{width:23.69%;border:1px solid #eee;background:#fff;margin: 0 1.5% 30px 0px;box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);}
.active-class .content .sub-con:nth-child(4n+0){margin:0 0 30px 0;}
.active-class .content .sub-con:hover{box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.15);cursor: pointer;-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1;}
@-webkit-keyframes bounce-down {
25% {margin-top:-10px;}

View File

@ -237,9 +237,9 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f
.task-index-list{ width: 1200px;}
.task-index-list-box{ width:23.69%;margin: 0 1.5% 1.5% 0px; border-radius:2px; border:1px solid #eee; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color:#666; position:relative; }
.task-index-list-box{ width:23.69%;margin: 0 1.5% 30px 0px; border-radius:2px; border:1px solid #eee; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color:#666; position:relative; }
.task-index-list-box:hover{-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1; }
.task-index-list-box:nth-child(4n+0) {margin: 0 0 1.5% 0;}
.task-index-list-box:nth-child(4n+0) {margin: 0 0 30px 0;}
.task-mg8{ margin:0 15px 15px 0px; border-radius:2px; border:1px solid #eee; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color:#666; position:relative; }
.task-index-list-box-top{padding:16px; padding-top:30px; background:#fff; text-align: center; position:relative; height: 160px;}
.task-index-list-title{ max-width:80%; display: block; margin:10px auto 0px; font-size:14px; font-weight: bold;}
@ -318,7 +318,7 @@ a.shixun-task-ban-btn{background-color: #c2c4c6;display: inline-block;font-weigh
/* 实训首页的搜索 */
.xy_box{padding:16px;height:180px}
.task_yx_bo{margin: 0px auto 13px;}
.course-nav-box{padding:0px 10px;margin:20px 0px}
.course-nav-box{padding:0px 10px;margin:30px 0px}
.xy_level{width: 80%;margin: 0px auto;border-top: 1px solid #eee;margin-top: 5px;line-height: 35px;}
.course-nav-row{padding:7px 0px}
.course-nav-row_item li{width:auto;height: 30px;line-height: 30px;margin: 5px;padding:0px 15px;}