Skip to content

Commit

Permalink
提交ajax打印
Browse files Browse the repository at this point in the history
  • Loading branch information
heyunpeng committed Jul 23, 2015
1 parent 90aeb26 commit 241b957
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 58 deletions.
13 changes: 11 additions & 2 deletions app/controllers/tracelogs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,18 @@ def single

user.update(coin: user.coin-totalcoin)
end
redirect_to url_for(:controller => :traceresult, :action => :index)
@test = 1
respond_to do |format|
format.html {}
format.js {}
format.json {}
end
else
redirect_to url_for(:controller => :welcome, :action => :index)
respond_to do |format|
format.html {}
format.js {}
format.json {}
end
end
end

Expand Down
Binary file modified app/views/.DS_Store
Binary file not shown.
Binary file added app/views/singlegame/.DS_Store
Binary file not shown.
28 changes: 28 additions & 0 deletions app/views/singlegame/_singlegame.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<table class="lot-table" style="width:100%" id="tblprint">
<tbody>
<tr>
<td colspan="2">20150719058期</td>
</tr>
<% for i in 0..3 %>
<tr>
<td rowspan="2">注单号</td>
<td>项目:1</td>
</tr>
<tr>
<td>牌面:A</td>
</tr>
<tr>
<td>下注额:</td>
<td>9</td>
</tr>
<tr>
<td>可赢额:</td>
<td>72.9</td>
</tr>
<% end %>
<tr>
<td>总计注额</td>
<td><%if @test %><%=@test%><% end %></td>
</tr>
</tbody>
</table>
58 changes: 2 additions & 56 deletions app/views/singlegame/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -130,68 +130,14 @@ function xprint() {
</tr>
<tr>
<td colspan="2">
<div>
<table class="lot-table" style="width:100%" id="tblprint">
<tbody>
<tr>
<td colspan="2">
20150719058期
</td>
</tr>
<tr>
<td rowspan="2">
注单号
</td>
<td>
117356125#
</td>
</tr>
<tr>
<td>
和@ 9.1
</td>
</tr>
<tr>
<td>
下注额:
</td>
<td>
9
</td>
</tr>
<tr>
<td>
可赢额:
</td>
<td>
72.9
</td>
</tr>
<tr>
<td>
下注笔数
</td>
<td>
1笔
</td>
</tr>
<tr>
<td>
总计注额
</td>
<td>
9
</td>
</tr>
</tbody>
</table>
<div id = "singleresult" >
</div>
</td>
</tr>
</tbody>
</table>
</td>
<%= form_for :tracelogs, url: tracelogs_single_path do |f| %>
<%= form_for :tracelogs, url: tracelogs_single_path, remote: true do |f| %>
<td style="border:0px; vertical-align:top;">
<table class="lot-table" id="history">
<tbody>
Expand Down
1 change: 1 addition & 0 deletions app/views/tracelogs/single.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$('#singleresult').html("<%= escape_javascript(render(:partial=>'singlegame/singlegame', :object=>@test)) %>");

0 comments on commit 241b957

Please sign in to comment.