学员统计板块的金币值模块以及其它问题的修改。tip样式的增加与修改

This commit is contained in:
miss 2017-09-29 21:10:56 +08:00
parent dfe5fe828e
commit 12cebcb252
9 changed files with 68 additions and 23 deletions

View File

@ -16,14 +16,20 @@ class ShixunsController < ApplicationController
def statistics_students
@statistics = @shixun.myshixuns.order("created_at desc")
@statistics_count = @statistics.count
@limit = 10
@is_remote = true
@statistic_pages = Paginator.new @statistics_count, @limit, params['page'] || 1
@offset ||= @statistic_pages.offset
@statistics = paginateHelper @statistics, @limit
pub_shixun = ApplyAction.where(:container_type => "ApplyShixun", :status => 1, :container_id => @shixun.id).last
if pub_shixun.present?
updated_at = pub_shixun.updated_at
@statistics = @shixun.myshixuns.select{|myshixun| myshixun.updated_at > updated_at}
@statistics = @statistics.map(&:id)
@statistics = Myshixun.where(:id => @statistics).order("created_at desc")
#@statistics = @shixun.myshixuns.where("created_at > #{updated_at}").order("created_at desc")
@statistics_count = @statistics.count
@limit = 10
@is_remote = true
@statistic_pages = Paginator.new @statistics_count, @limit, params['page'] || 1
@offset ||= @statistic_pages.offset
@statistics = paginateHelper @statistics, @limit
end
end

View File

@ -54,6 +54,18 @@ class Myshixun < ActiveRecord::Base
score
end
def total_gold
score = 0
self.games.each do |game|
if game.status == 2
total_gold =game.answer_open? ? -game.challenge.score.to_i : game.final_score.to_i
score += total_gold
end
end
score
end
# id 转换成 identifier
def to_param
identifier

View File

@ -71,7 +71,7 @@
<% when 2 %>
已完成&nbsp;&nbsp;<a href='<%= operation_shixun_path(@shixun, :myshixun_id => challenge.current_user_game.try(:myshixun)) %>' data-remote="true"><i data-tip-down='已解决' class='fa fa-check-circle fr font-24 color-light-green w20_center' ></i></a>
<% when 3,nil %>
未开始&nbsp;&nbsp;<a><i data-tip-down='请先完成前序关卡。无法点击' class='fa fa-play-circle fr font-24 color-grey w20_center' ></i></a>
未开始&nbsp;&nbsp;<a><i data-tip-down='请先完成前序关卡' class='fa fa-play-circle fr font-24 color-grey w20_center' ></i></a>
<% end %>
</span>
<% end %>

View File

@ -14,31 +14,57 @@
<table class="panel-new-table panel-table-pd15" cellpadding="0" cellspacing="0">
<tbody>
<% @statistics.each do |statistics| %>
<% if had_passed_changllenge_count(@shixun, statistics.owner) == -1 %>
<% coefficient = 1%>
<% elsif (had_passed_changllenge_count(@shixun, statistics.owner).class == Array) %>
<% coefficient = had_passed_changllenge_count(@shixun,statistics.owner)[0].to_i*2 - 1%>
<% else %>
<% coefficient = had_passed_changllenge_count(@shixun, statistics.owner)*2%>
<% end %>
<tr>
<td class="" style="display: flex;align-items: center;justify-content: center;">
<!--<img src = "/images/../images/bigdata/bigdata-logo.png" alt = "头像" style = "width:36px;height:36px;border-radius:18px;margin-left:10px;"/>-->
<%= link_to image_tag(url_to_avatar(statistics.owner), :width => "36", :height => "36", :alt => "头像", :style => "border-radius:18px;margin:15px 0 0 10px;"), user_path(statistics.owner), :target => '_blank', :class => ""%>
</td>
<td>
<td style = "width:100px;">
<%= link_to statistics.owner.try(:show_name), user_path(statistics.owner), :class => "panel-table-name hide fl color-black" %>
</td>
<td><%= format_time(statistics.created_at) %> 开启</td>
<td style = "width:500px;">
<div style="padding:10px 0;" class="fl mt5">
<div class="panel-slider-bg ">
<span class="panel-slider-inner03 " style = "width:<%= statistics.current_stage*100.to_f / statistics.games.count %>%"></span>
<span class="panel-slider-inner03 " style = "width:<%= coefficient*50.to_f / @shixun.challenges.count %>%"></span>
</div>
</div>
<span class="panel-slider-txt fl ml30">
挑战至第<%= statistics.current_stage %>关/共<%= statistics.games.count %>关
<% if had_passed_changllenge_count(@shixun, statistics.owner) == -1 %>
已挑战至&nbsp;第1关&nbsp;/&nbsp;共<%= @shixun.challenges.count %>关
<% elsif (had_passed_changllenge_count(@shixun, statistics.owner).class == Array) %>
已挑战至&nbsp;第<%= had_passed_changllenge_count(@shixun,statistics.owner)[0].to_i %>关&nbsp;/&nbsp;共<%= @shixun.challenges.count %>关
<% else %>
已完成至&nbsp;第<%= had_passed_changllenge_count(@shixun, statistics.owner) %>关&nbsp;/&nbsp;共<%= @shixun.challenges.count %>关
<% end %>
</span>
</td>
<td>
<span class=" mr20">
<span class=" mr20 font-14 color-grey">
<% if statistics.total_score == 0 || statistics.total_score.nil? %>
--
<% else %>
<span style="color:#29bd8b;font-weight:bold;" class="font-14">+ <%= statistics.total_score.to_i %></span> 经验值
<span style="color:#29bd8b;font-weight:bold;" class="font-14">+<%= statistics.total_score.to_i %></span> 经验值
<% end %>
</span>
</td>
<td>
<span class=" mr20 font-14 color-grey">
<% if statistics.total_gold == 0 || statistics.total_gold.nil? %>
--
<% else %>
<% if statistics.total_gold < 0 %>
<span style="color:#FF6666;font-weight:bold;" class="font-14"><%= statistics.total_gold %></span> 金币
<% else %>
<span style="color:#29bd8b;font-weight:bold;" class="font-14">+<%= statistics.total_gold %></span> 金币
<% end %>
<% end %>
</span>
</td>

View File

@ -98,7 +98,7 @@
<div class="fl" style="margin-top:7px">
<li class="edu-dropdown fl ml15 mr5" id="first_select" style="width: 70px">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_status">所有状态<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu" id="all_status_list" style="display: none;">
<ul class="edu-dropdown-menu color" id="all_status_list" style="display: none;">
<li>
<input type="radio" class="undis" name="shixun_status" id="status_0" value="0">
<label for="status_0">所有状态</label>
@ -119,7 +119,7 @@
</li>
<li class="edu-dropdown fl ml15 mr5" id="thirdly_select" style="width: 70px">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_languge">所有难度<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu" id="all_trainee_list" style="display: none;">
<ul class="edu-dropdown-menu color" id="all_trainee_list" style="display: none;">
<li>
<input type="radio" class="undis" name="trainee" id="trainee_0" value="">
<label for="trainee_0">所有难度</label>
@ -144,7 +144,7 @@
</li>
<li class="edu-dropdown fl ml15 mr5" id="second_select">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_progress">所有进展<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu" id="all_progress_list" style="display: none;">
<ul class="edu-dropdown-menu color" id="all_progress_list" style="display: none;">
<li>
<input type="radio" class="undis" name="status" id="progress_1" value="1">
<label for="progress_1">所有进展</label>

View File

@ -1,10 +1,10 @@
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js',
'/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js'%>
<div class="mt30 mb30 box_bg_shandow">
<div class="mt30 mb30 box_bg_shandow bor-grey-e" style = "width:1202px;">
<ul id="tab_nav" style="background:#fff;border-bottom:1px solid #eee;border-top: 1px solid #eee;" class="panel-header">
<li id="tab_nav_1" class="tab_hover_setting" onclick="HoverLi(1);" style = "padding-left:0">
<a href="javascript:void(0);" class="tab_type font-16 color-black">配置</a>
<a href="javascript:void(0);" class="tab_type font-16 color-black font-bd">配置</a>
</li>
<!--<li id="tab_nav_2" onclick="HoverLi(2);">-->
<!--<a href="javascript:void(0);" class="tab_type" >版本库</a>-->

View File

@ -75,9 +75,9 @@
</p>
<p class="fr panel-lightgrey mt10">
<!--<span class="mr10"><i class="fa fa-eye color-grey mr5 "></i>473</span>-->
<span class="mr10"><i class="fa fa-eye color-grey mr5"></i><%= activity.visits %></span>
<span class="mr10"><i class="fa fa-thumbs-up color-grey mr5"></i><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span>
<span class="mr10"><i class="fa fa-comments-o color-grey mr5"></i><%= count %></span>
<span class="mr10"><i class="fa fa-eye color-grey mr5" data-tip-down = "浏览数"></i><%= activity.visits %></span>
<span class="mr10"><i class="fa fa-thumbs-up color-grey mr5" data-tip-down = "点赞数"></i><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span>
<span class="mr10"><i class="fa fa-comments-o color-grey mr5" data-tip-down = "回复数"></i><%= count %></span>
</p>
<div class="homepagePostSetting" style="right: 4px;top: 5px;">

View File

@ -273,7 +273,7 @@
<!-------------------侧边提示区域-------------------------->
<div class="-task-sidebar">
<div class="feedback" tooltips="意见反馈">
<a target="_blank" class="color_white" href="<%= feedback_path(@user, :host=> Setting.host_user)%>"><i class="fa fa-envelope-o" aria-hidden="true"></i></a>
<a target="_blank" class="color_white" href="https://www.educoder.net/users/innov/user_newfeedback"><i class="fa fa-envelope-o" aria-hidden="true"></i></a>
</div>

View File

@ -58,6 +58,7 @@ $colors: #fff, #0072B5, #2C3E50;
.edu-dropdown-menu li{ height:30px; line-height:30px; display: block; padding:0 15px; text-align: left;}
.edu-dropdown-menu li label{ cursor: pointer;}
.edu-dropdown-menu li:hover{ color: #5faee3!important;}
.edu-dropdown-menu.color li:hover{ color: #ff7500!important;}
/*.edu-dropdown:hover .edu-dropdown-menu{ display: block;}*/
.animate{ -webkit-transition: all .3s; -moz-transition: all .3s; -ms-transition: all .3s; -ms-transition: all .3s;
transition: all .3s; backface-visibility:hidden; -webkit-backface-visibility:hidden; /* Chrome and Safari */ -moz-backface-visibility:hidden; /* Firefox */ -ms-backface-visibility:hidden; /* Internet Explorer */}