From e904966b84cbdf0ca428e9fc11d09553ed3a9611 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 10:09:53 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=AF=8F=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E4=B8=80=E5=85=B3=EF=BC=8C=E5=AE=9E=E8=AE=AD=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=88=97=E8=A1=A8=E8=A6=81=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 12 +++++++++++- app/views/games/_pass_game_show.html.erb | 12 ++++++++++-- app/views/games/refresh_game_list.js.erb | 2 ++ app/views/games/show.js.erb | 1 + config/routes.rb | 1 + 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 app/views/games/refresh_game_list.js.erb diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index b898b0474..e4ff7a64d 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -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] @@ -303,6 +303,16 @@ class GamesController < ApplicationController 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 = [] diff --git a/app/views/games/_pass_game_show.html.erb b/app/views/games/_pass_game_show.html.erb index dc9155ecb..717ecb2cc 100644 --- a/app/views/games/_pass_game_show.html.erb +++ b/app/views/games/_pass_game_show.html.erb @@ -2,7 +2,7 @@
"> - +
<% if had_done == 0 %>

恭喜您通过本关

@@ -12,4 +12,12 @@ <% end %>
-
\ No newline at end of file + + \ No newline at end of file diff --git a/app/views/games/refresh_game_list.js.erb b/app/views/games/refresh_game_list.js.erb new file mode 100644 index 000000000..ffb5e4d22 --- /dev/null +++ b/app/views/games/refresh_game_list.js.erb @@ -0,0 +1,2 @@ +$("#all_task_show").html("<%= j (render :partial => "games_list") %>"); +hideModal(); \ No newline at end of file diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index e11eaba6b..99d4bf53e 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -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 %> diff --git a/config/routes.rb b/config/routes.rb index e4d97c22d..aea2ea1cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,6 +89,7 @@ RedmineApp::Application.routes.draw do get 'file_edit' get 'answer' get 'minus_score' + get 'refresh_game_list' end end end From b659d6180e48db20ebe9152f9af4abb969ca4fa3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 14:21:53 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=9C=A8=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/base_course_community.html.erb | 147 +++++++++--------- 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/app/views/layouts/base_course_community.html.erb b/app/views/layouts/base_course_community.html.erb index 273390463..48666f9da 100644 --- a/app/views/layouts/base_course_community.html.erb +++ b/app/views/layouts/base_course_community.html.erb @@ -30,89 +30,93 @@ -
- <% 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%> -
-
-
- -
-
-
-
- <% if hidden_unproject_infos %> +
+
+ <% 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%> +
+
+
+
+ +
+
+
+
+ <% if hidden_unproject_infos %> +
    +
  • + <%= link_to '班级',user_courselist_user_path(@user), :id => "user_course_list" %> + <%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %> + <% 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) %> +
    + <%= render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %> +
    +
  • + <% if is_current_user %> +
  • + <%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %> +
  • +
  • + <%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %> +
  • +
  • + <%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %> +
  • + <% end %> +
+ <% end %>
    -
  • - <%= link_to '班级',user_courselist_user_path(@user), :id => "user_course_list" %> - <%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %> - <% 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) %> -
    - <%= render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %> -
    -
  • - <% if is_current_user %> -
  • - <%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %> + <% if @user == User.current %> +
  • + <%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
  • -
  • - <%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %> +
  • + <%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
  • -
  • - <%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %> +
  • + <%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %> +
  • +
  • + <%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank",:style => "font-size:14px;" %>
  • <% end %>
- <% end %> -
    - <% if @user == User.current %> -
  • - <%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %> -
  • -
  • - <%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %> -
  • -
  • - <%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %> -
  • -
  • - <%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank",:style => "font-size:14px;" %> -
  • - <% end %> -
-
- - +
+ + - + - - - <%# 更新访问数,刷新的时候更新访问次数 %> - <% update_visiti_count @user %> -
访问计数 <%= @user.visits.to_i %> (自2016年5月)
-
-
- <%= yield %> + + + <%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @user %> +
访问计数 <%= @user.visits.to_i %> (自2016年5月)
+
+
+ <%= yield %> +
+
+
-
-
-<%= render :partial => 'layouts/footer' %> -
+ <%= render :partial => 'layouts/footer' %> +
- - - + + + +
+ \ No newline at end of file From 151ca5be9ac5abe5bc928a5c730e71ff9480975d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 14:44:54 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=A1=B6=E9=83=A8=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BD=8D=E7=BD=AE=E4=B8=8D=E5=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_edu_course.html.erb | 73 +++++++++++----------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/app/views/layouts/base_edu_course.html.erb b/app/views/layouts/base_edu_course.html.erb index f4eb30b62..5f468e456 100644 --- a/app/views/layouts/base_edu_course.html.erb +++ b/app/views/layouts/base_edu_course.html.erb @@ -15,42 +15,45 @@ <%= yield :header_tags -%> -
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>
+
+
+
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>
+
+
+ <%= render_flash_messages %> +
+ <% if @show_page %> +

+ + <%= 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 => '班级' %> +

+ <% else %> +

+ + <%= link_to '班级首页', course_path(@course) %> > <%= @curr_page %> +

+ <% end %> + <% if params[:action] != "settings" %> +
+ <%= render :partial => 'layouts/course_base_info' %> +
+ <% end %> + <%= yield %> +
+ <%= call_hook :view_layouts_base_content %> +
+
+
+ <%= render :partial => 'layouts/footer' %> +
-<%= render_flash_messages %> -
- <% if @show_page %> -

- - <%= 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 => '班级' %> -

- <% else %> -

- - <%= link_to '班级首页', course_path(@course) %> > <%= @curr_page %> -

- <% end %> - <% if params[:action] != "settings" %> -
- <%= render :partial => 'layouts/course_base_info' %> -
- <% end %> - <%= yield %> + +
- -<%= call_hook :view_layouts_base_content %> -
- -
-<%= render :partial => 'layouts/footer' %> -
- - - From e323e6c62a071072a26fb560efe053ad28263690 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 14:57:50 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E5=9B=BA=E5=AE=9A=E5=9C=A8=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_shixun.html.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/base_shixun.html.erb b/app/views/layouts/base_shixun.html.erb index a0d1ddcc6..c93947efd 100644 --- a/app/views/layouts/base_shixun.html.erb +++ b/app/views/layouts/base_shixun.html.erb @@ -19,6 +19,8 @@
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %> +
+
<%= render :partial => 'shixuns/shixun_top' %>
@@ -44,9 +46,6 @@
<%#= render_flash_messages %> -
- -
<%= render_flash_messages %> <%= yield %> From d8f4f4e716fe38b9b3a6291de057338aabaa1343 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 15:01:03 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/edu-public.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/css/edu-public.css b/public/stylesheets/css/edu-public.css index 0f0c30864..610959976 100644 --- a/public/stylesheets/css/edu-public.css +++ b/public/stylesheets/css/edu-public.css @@ -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;} From 8e7756d45ca96d0b9dbcd893954c189ba603331d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 May 2017 15:07:11 +0800 Subject: [PATCH 6/7] =?UTF-8?q?js=E5=BC=B9=E6=A1=86=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=E7=9A=84=E6=97=B6=E5=80=99=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/edu/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/edu/application.js b/public/javascripts/edu/application.js index 7917107db..358b244d1 100644 --- a/public/javascripts/edu/application.js +++ b/public/javascripts/edu/application.js @@ -141,7 +141,7 @@ function pop_box_new(value, Width, Height){ function op_confirm_box(url, str){ var htmlvalue = '

提示

'+ '

' + str + '

'; + '确定
'; pop_box_new(htmlvalue, 578, 205); } From 22421aa13071d849701115763a7a866096fd7eb1 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 May 2017 15:49:25 +0800 Subject: [PATCH 7/7] =?UTF-8?q?game=E6=9F=A5=E7=9C=8B=E6=89=A3=E5=88=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index e4ff7a64d..4ac5a96ed 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -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,12 +286,8 @@ 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