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

This commit is contained in:
Linda 2017-05-25 15:52:36 +08:00
commit bd4cfa9e2d
10 changed files with 147 additions and 127 deletions

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, :game_status, :change_status, :answer, :minus_score]
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :game_status, :change_status, :answer, :minus_score, :refresh_game_list]
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update]
before_filter :allowd_manager
before_filter :allowd_view, :only => [:show]
@ -187,12 +187,13 @@ class GamesController < ApplicationController
logger.info("##### resubmit_identifier is #{resubmit_identifier}")
if params[:resubmit].blank? # 非重新评测
if had_done == 1 # 通过最后一关,即所有关卡
reward_grade(@game.user, @game.id, @game.class, 1000)
@myshixun.update_attribute(:status, 1)
else # 通过当前一关
if @game.status == 2
@game.next_game.update_attribute(:status, 0)
reward_grade(@game.user, @game.id, @game.class, game_challenge.score)
unless @game.answer_open == 1
reward_grade(@game.user, @game.id, @game.class, game_challenge.score)
end
end
end
game_status = @game.status
@ -263,22 +264,16 @@ class GamesController < ApplicationController
# viewed 1: 直接查看 2弹框提示将要扣除积分确定后显示内容 3弹框提示分数不够
def answer
challenge = @game.challenge
user = User.current
@challenge_score = challenge.score.to_i
user_score = user.grade.to_i
@score = user_score - @challenge_score
# 已经开启过
@answer = challenge.answer
if @game.answer_open
@viewed = 1
logger.info("1 is #{@viewed}")
else
if @score >= 0
@viewed = 2
logger.info("2 is #{@viewed}")
else
@viewed = 3
logger.info("3 is #{@viewed}")
end
end
respond_to do |format|
@ -291,18 +286,24 @@ class GamesController < ApplicationController
@game_challenge = @game.challenge
user = User.current
challenge_score = @game_challenge.score.to_i
reward_grade(User.current, @game.id, 'Answer', -challenge_score)
user_score = user.grade.to_i
@score = user_score - challenge_score
reward_grade(user, @game.id, 'Answer', -challenge_score)
@answer = @game_challenge.answer
user.update_column(:grade, @score)
@game.update_column(:answer_open, true)
respond_to do |format|
format.js
end
end
def refresh_game_list
myshixun_id = params[:myshixun_id]
@myshixun = Myshixun.find_by_identifier(myshixun_id)
@challenges = Challenge.where(:shixun_id => @myshixun.shixun_id)
respond_to do |format|
format.js
end
end
private
def test_set_static_data test_sets
test_result = []

View File

@ -2,7 +2,7 @@
<div class="task-popup-warp" style="background-color: rgba(0,0,0,0.7);">
<div class="task-popup-box <%= had_done == 0 ? "task-box1" : "task-box2" %>">
<a href="javascript:void(0)" class="task-popup-close" onclick="hideModal();"></a>
<a href="javascript:void(0)" class="task-popup-close" onclick="refresh_game_list();"></a>
<div class="task-su-con">
<% if had_done == 0 %>
<p class="task-su-p">恭喜您通过本关</p>
@ -12,4 +12,12 @@
<% end %>
</div>
</div>
</div>
</div>
<script>
function refresh_game_list(){
$.ajax({
url: "<%= refresh_game_list_myshixun_game_path(game, :myshixun_id => myshixun) %>",
dataType: "script"
});
};
</script>

View File

@ -0,0 +1,2 @@
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
hideModal();

View File

@ -3,6 +3,7 @@
$("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>');
$("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>');
$("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>');
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
$("#all_task_show").hide();
fadein = 0;
<% else %>

View File

@ -30,89 +30,93 @@
</head>
<body onload="prettyPrint();">
<div class="header">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftnav ">
<% if hidden_unproject_infos %>
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 -->
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
<div class="cl"></div>
</div>
<div class="newMain clearfix"> <!-- 主题部分 -->
<div class="homepageContentContainer">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftnav ">
<% if hidden_unproject_infos %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '班级',user_courselist_user_path(@user), :id => "user_course_list" %>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
<%= render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
</div>
</li>
<% if is_current_user %>
<li id="user_02" class="user_icons_new">
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_03" class="user_icons_new">
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_04" class="user_icons_addclass">
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %>
</li>
<% end %>
</ul>
<% end %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '班级',user_courselist_user_path(@user), :id => "user_course_list" %>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
<%= render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
</div>
</li>
<% if is_current_user %>
<li id="user_02" class="user_icons_new">
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
<% if @user == User.current %>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_03" class="user_icons_new">
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_04" class="user_icons_addclass">
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %>
<li id="user_06" class="icons-doc clear">
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_07" class="icons-download clear">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank",:style => "font-size:14px;" %>
</li>
<% end %>
</ul>
<% end %>
<ul class="users_accordion mb10">
<% if @user == User.current %>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_06" class="icons-doc clear">
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_07" class="icons-download clear">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank",:style => "font-size:14px;" %>
</li>
<% end %>
</ul>
</div>
<!--<div class="user_leftnav ">-->
<!--<ul class="users_accordion mb10">-->
</div>
<!--<div class="user_leftnav ">-->
<!--<ul class="users_accordion mb10">-->
<!--<li id="user_10" class="user_icons_mes">-->
<!--<%#= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>-->
<!--<%#= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
</div>
<div class="homepageRight">
<%= yield %>
<!--</ul>-->
<!--</div>-->
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
</div>
<div class="homepageRight">
<%= yield %>
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
</div>
<script>
function leftCourseslistChange(){
var target = $('#user_courses_li>li');
@ -123,5 +127,6 @@
$('#hide_show_courseicon').toggleClass("user_icons_moreclass");
}
</script>
</body>
</html>

View File

@ -15,42 +15,45 @@
<%= yield :header_tags -%>
</head>
<body onload="prettyPrint();">
<div class="header"><%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 -->
<div class="header"><%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
</div>
<div class="newMain clearfix"> <!-- 主题部分 -->
<%= render_flash_messages %>
<div class="edu-class-container edu-position" style="flex: 1 0 auto;">
<% if @show_page %>
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey" ></i>
<%= link_to User.current.show_name, user_path(User.current) %> >
<%= link_to '智能课堂', user_course_community_path(User.current) %> >
<%= link_to @course.syllabus.title, syllabus_path(@course.syllabus), :title => '课程' %> >
<%= link_to @course.name, course_path(@course), :title => '班级' %>
</p>
<% else %>
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey" ></i>
<%= link_to '班级首页', course_path(@course) %> > <span class="color-dark-grey"><%= @curr_page %></span>
</p>
<% end %>
<% if params[:action] != "settings" %>
<div id="course_info_<%= @course.id %>">
<%= render :partial => 'layouts/course_base_info' %>
</div>
<% end %>
<%= yield %>
</div>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<div class="cl"></div>
</div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= render_flash_messages %>
<div class="edu-class-container edu-position" style="flex: 1 0 auto;">
<% if @show_page %>
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey" ></i>
<%= link_to User.current.show_name, user_path(User.current) %> >
<%= link_to '智能课堂', user_course_community_path(User.current) %> >
<%= link_to @course.syllabus.title, syllabus_path(@course.syllabus), :title => '课程' %> >
<%= link_to @course.name, course_path(@course), :title => '班级' %>
</p>
<% else %>
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey" ></i>
<%= link_to '班级首页', course_path(@course) %> > <span class="color-dark-grey"><%= @curr_page %></span>
</p>
<% end %>
<% if params[:action] != "settings" %>
<div id="course_info_<%=@course.id %>">
<%= render :partial => 'layouts/course_base_info' %>
</div>
<% end %>
<%= yield %>
<div id="ajax-indicator" style="display:none;">
<span>载入中...</span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-indicator" style="display:none;">
<span>载入中...</span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</body>
</html>

View File

@ -19,6 +19,8 @@
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 -->
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>
</div>
<div class="newMain clearfix"> <!-- 主提部分 -->
<div id="shixun_top">
<%= render :partial => 'shixuns/shixun_top' %>
</div>
@ -44,9 +46,6 @@
</ul>
</div>
<%#= render_flash_messages %>
</div>
<div class="newMain clearfix"> <!-- 主提部分 -->
<div class="task-pm-content">
<%= render_flash_messages %>
<%= yield %>

View File

@ -89,6 +89,7 @@ RedmineApp::Application.routes.draw do
get 'file_edit'
get 'answer'
get 'minus_score'
get 'refresh_game_list'
end
end
end

View File

@ -141,7 +141,7 @@ function pop_box_new(value, Width, Height){
function op_confirm_box(url, str){
var htmlvalue = '<div class="task-popup" style="width:578px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="'+ url +'" class="task-btn task-btn-blue fr">确定</a></div></div>';
'<a href="'+ url +'" class="task-btn task-btn-blue fr" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 578, 205);
}

View File

@ -15,7 +15,7 @@ input.header-search-input{ width:150px; height:30px; padding:0 5px; border-style
.new-container-inner02{width:1200px; margin:0px auto; padding:50px 0;}
.inner-nav-mes{ font-size:16px; color:#fff; margin-right:35px; margin-top:18px; }
.inner-nav-cir{ background:#ff6530; color:#fff; border-radius:15px;padding:0 5px; display: inline-block; font-size:10px; height:16px; line-height:16px;}
.inner-nav-user{ width: 75px; height: 50px; margin-top:5px; position: relative;}
.inner-nav-user{ width: 75px; height: 45px; margin-top:5px; position: relative;}
.inner-nav-user-img{ width: 40px; height: 40px; border-radius:50px;}
select.header-search-select{ border:none; font-size:14px; padding:5px; background: none;}
.edu-unlogin-nav a{ color:#fff!important; font-size:14px; line-height:50px;}