From 7904f693f0e06b3bc1a41d97b68d3feaf20bd7dd Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 15:29:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 2 +- app/views/games/_game_show.html.erb | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 91467cad4..438c6f8ee 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -67,7 +67,7 @@ class GamesController < ApplicationController shixun_new_commit = g.commits(@myshixun.shixun.try(:gpid)).first.try(:id) @myshixun.update_column(:commit_id, shixun_new_commit) sleep(2) # g - render :json => {status:200} + render :json => {:status => 200} end def index diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 508fcb197..ff1cc5a9d 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -121,7 +121,8 @@

关卡任务的代码文件有更新,点击立即更新获取最新代码!

- <%= link_to "立即更新", sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun), :remote => true, :class => "fl color-orange03", :onclick => "hide_tip_content();" %> + <%#= link_to "立即更新", sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun), :remote => true, :class => "fl color-orange03", :onclick => "sync_hide_tip_content();" %> + 立即更新 稍后再说
@@ -199,14 +200,26 @@ var praiseStatus = <%= @praise.nil? ? false : true %>; // 是否点赞 var treadStatus = <%= @tread.nil? ? false : true %>; // 是否踩 - //显示更新提示方法 + // 显示更新提示方法 function show_tip_content(){ $(".tip-panel-animate").addClass("animate-tip"); $(".tip-panel-animate").show(); } - //隐藏更新提示方法 - function hide_tip_content(){ + + // 隐藏更新提示方法 + function sync_hide_tip_content(){ $(".tip-panel-animate").addClass("animate-tip-hide"); setTimeout('$(".tip-panel-animate").hide();', 700); + alert("test"); + $.ajax({ + url: "<%= sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun) %>", + dataType: "script", + success: function(data){ + alert(data.status); + if(data.status == 200){ + $('#'+target).html(data); + } + } + }) } \ No newline at end of file