Skip to content

Commit

Permalink
第三版
Browse files Browse the repository at this point in the history
  • Loading branch information
heyunpeng committed Jul 19, 2015
1 parent e3096d5 commit 34858d6
Show file tree
Hide file tree
Showing 19 changed files with 48,221 additions and 416 deletions.
Binary file modified app/assets/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion app/controllers/combinationgame_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ def index
@user = User.find(session[:userid])
end

@gridconfigs = Gridconfig.where("gridtype <= 3")
@gridconfigs = Gridconfig.where("gridtype <= 4")
end
end
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create
useraccount = params[:session][:account]
userpassword = params[:session][:password]
@user = User.find_by_account(useraccount)
if @user && @user.password == userpassword
if @user and @user.password == userpassword and @user.action == 1
session[:account] = useraccount

loginlog.username = useraccount
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def isadmin (userid)
end

def edit
@admin = User.find(session[:userid])
@user = User.find(params[:id])
end

Expand All @@ -97,7 +98,7 @@ def update
end

if @user.update(params.require(:user).permit(:password,
:nickname, :coin, :upperlimit, :lowerlimit, :action))
:nickname, :coin, :upperlimit, :lowerlimit, :everylimit, :action))

curtime = Time.new
@operlog = Operlog.new()
Expand Down
140 changes: 55 additions & 85 deletions app/views/combinationgame/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,28 @@
<% end %>

<% content_for :script do %>
$(".coin").blur(function(){
$(".reccheck").blur(function(){
var coinitems = document.getElementsByClassName("reccheck");
var total = 0;
var price = parseInt($(this).val());
if (isNaN(price))
return;
var par = $(this).parent().parent();
par.find('.reccheck').each(function(index, element){
if($(this).prop("checked"))
total += price;
})
par.find('.coincount').val(total);
updateTotal();
for (i = 0; i < coinitems.length; i++)
{
coin = parseInt(coinitems[i].value)
if (!isNaN(coin))
total += coin
}
updateTotal(total);
}
);

$(".reccheck").change(function(){
$('.coin').blur();
}
);
function updateTotal(){
var total = 0;
$('body').find('.coincount').each(function(index, element){
total += parseInt($(this).val());
});
$("#coinTotal").text(total.toString());
document.getElementById("cointotal").value = total;
$(".reccheck").focus(function(){
var defaultcoin = document.getElementById("defaultcoin");
var coin = defaultcoin.value
this.value = coin
}
);
function updateTotal(totalcoin){
$("#coinTotal").text(totalcoin.toString());
document.getElementById("cointotal").value = totalcoin;
}
<% end %>

<div class="lot-table" id="history">
Expand All @@ -59,19 +54,16 @@ $(".reccheck").change(function(){
项目
</td>
<td>
四筒
三筒
</td>
<td style="width: 60px; text-align: center;">
同色
同花
</td>
<td style="width: 60px; text-align: center;">
顺子
</td>
<td style="width: 60px; text-align: center;">
每项金币
</td>
<td style="width: 60px; text-align: center;">
金币额
对子
</td>
</tr>
<%= form_for :tracelogs, url: tracelogs_combination_path do |f| %>
Expand All @@ -82,20 +74,16 @@ $(".reccheck").change(function(){
<% @gridconfigs.each do |config| %>
<td class="nums">
<% if config.gridtype == 1 %>
<%= f.check_box :flag1_1, class:"reccheck" %>四筒 赔率:<%= config.mulbability %>
<% elsif config.gridtype ==2 %>
<%= f.check_box :flag1_2, class:"reccheck" %>同色 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_1, class:"reccheck", size:6 %>
<% elsif config.gridtype == 2 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_2, class:"reccheck", size:6 %>
<% elsif config.gridtype == 3 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_3, class:"reccheck", size:6 %>
<% else %>
<%= f.check_box :flag1_3, class:"reccheck" %>顺子 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_4, class:"reccheck", size:6 %>
<% end %>
</td>
<% end %>
<td style="padding-left:10px; padding-right:10px;">
<%= f.text_field :coin1, class: "form-control coin", placeholder: "金币"%>
</td>
<td style="padding-left:2px; padding-right:2px;">
<input type="text" class="form-control coincount" value="0" id="coinCount1" disabled="true">
</td>
</tr>
<tr class="even">
<td>
Expand All @@ -104,20 +92,16 @@ $(".reccheck").change(function(){
<% @gridconfigs.each do |config| %>
<td class="nums">
<% if config.gridtype == 1 %>
<%= f.check_box :flag2_1, class:"reccheck" %>四筒 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag2_1, class:"reccheck", size:6 %>
<% elsif config.gridtype ==2 %>
<%= f.check_box :flag2_2, class:"reccheck" %>同色 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag2_2, class:"reccheck", size:6 %>
<% elsif config.gridtype == 3 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_3, class:"reccheck", size:6 %>
<% else %>
<%= f.check_box :flag2_3, class:"reccheck" %>顺子 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_4, class:"reccheck", size:6 %>
<% end %>
</td>
<% end %>
<td style="padding-left:10px; padding-right:10px;">
<%= f.text_field :coin2, class: "form-control coin", placeholder: "金币"%>
</td>
<td style="padding-left:2px; padding-right:2px;">
<input type="text" class="form-control coincount" value="0" id="coinCount1" disabled="true">
</td>
</tr>
<tr class="even">
<td>
Expand All @@ -126,20 +110,16 @@ $(".reccheck").change(function(){
<% @gridconfigs.each do |config| %>
<td class="nums">
<% if config.gridtype == 1 %>
<%= f.check_box :flag3_1, class:"reccheck" %>四筒 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag3_1, class:"reccheck", size:6 %>
<% elsif config.gridtype ==2 %>
<%= f.check_box :flag3_2, class:"reccheck" %>同色 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag3_2, class:"reccheck", size:6 %>
<% elsif config.gridtype == 3 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_3, class:"reccheck", size:6 %>
<% else %>
<%= f.check_box :flag3_3, class:"reccheck" %>顺子 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_4, class:"reccheck", size:6 %>
<% end %>
</td>
<% end %>
<td style="padding-left:10px; padding-right:10px;">
<%= f.text_field :coin3, class: "form-control coin", placeholder: "金币"%>
</td>
<td style="padding-left:2px; padding-right:2px;">
<input type="text" class="form-control coincount" value="0" id="coinCount1" disabled="true">
</td>
</tr>
<tr class="even">
<td>
Expand All @@ -148,20 +128,16 @@ $(".reccheck").change(function(){
<% @gridconfigs.each do |config| %>
<td class="nums">
<% if config.gridtype == 1 %>
<%= f.check_box :flag4_1, class:"reccheck" %>四筒 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag4_1, class:"reccheck", size:6 %>
<% elsif config.gridtype ==2 %>
<%= f.check_box :flag4_2, class:"reccheck" %>同色 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag4_2, class:"reccheck", size:6 %>
<% elsif config.gridtype == 3 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_3, class:"reccheck", size:6 %>
<% else %>
<%= f.check_box :flag4_3, class:"reccheck" %>顺子 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_4, class:"reccheck", size:6 %>
<% end %>
</td>
<% end %>
<td style="padding-left:10px; padding-right:10px;">
<%= f.text_field :coin4, class: "form-control coin", placeholder: "金币"%>
</td>
<td style="padding-left:2px; padding-right:2px;">
<input type="text" class="form-control coincount" value="0" id="coinCount1" disabled="true">
</td>
</tr>
<tr class="even">
<td>
Expand All @@ -170,20 +146,16 @@ $(".reccheck").change(function(){
<% @gridconfigs.each do |config| %>
<td class="nums">
<% if config.gridtype == 1 %>
<%= f.check_box :flag5_1, class:"reccheck" %>四筒 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag5_1, class:"reccheck", size:6 %>
<% elsif config.gridtype ==2 %>
<%= f.check_box :flag5_2, class:"reccheck" %>同色 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag5_2, class:"reccheck", size:6 %>
<% elsif config.gridtype == 3 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_3, class:"reccheck", size:6 %>
<% else %>
<%= f.check_box :flag5_3, class:"reccheck" %>顺子 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_4, class:"reccheck", size:6 %>
<% end %>
</td>
<% end %>
<td style="padding-left:10px; padding-right:10px;">
<%= f.text_field :coin5, class: "form-control coin", placeholder: "金币"%>
</td>
<td style="padding-left:2px; padding-right:2px;">
<input type="text" class="form-control coincount" value="0" id="coinCount1" disabled="true">
</td>
</tr>
<tr class="even">
<td>
Expand All @@ -192,24 +164,22 @@ $(".reccheck").change(function(){
<% @gridconfigs.each do |config| %>
<td class="nums">
<% if config.gridtype == 1 %>
<%= f.check_box :flag6_1, class:"reccheck" %>四筒 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag6_1, class:"reccheck", size:6 %>
<% elsif config.gridtype ==2 %>
<%= f.check_box :flag6_2, class:"reccheck" %>同色 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag6_2, class:"reccheck", size:6 %>
<% elsif config.gridtype == 3 %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_3, class:"reccheck", size:6 %>
<% else %>
<%= f.check_box :flag6_3, class:"reccheck" %>顺子 赔率:<%= config.mulbability %>
赔率:<font color="red"><%= config.mulbability %><%= f.text_field :flag1_4, class:"reccheck", size:6 %>
<% end %>
</td>
<% end %>
<td style="padding-left:10px; padding-right:10px;">
<%= f.text_field :coin6, class: "form-control coin", placeholder: "金币"%>
</td>
<td style="padding-left:2px; padding-right:2px;">
<input type="text" class="form-control coincount" value="0" id="coinCount1" disabled="true">
</td>
</tr>
</tbody>
<tfoot>
<tr><td colspan="7" align="center"><div>总投注额:<span style="color:red" id="coinTotal">0</span>
<tr><td colspan="7" align="center">
<div>快捷投注:<input size="6" type="text" id="defaultcoin" />总投注额:
<span style="color:red" id="coinTotal">0</span>
<%= f.hidden_field :totalcoin, id:"cointotal", value:0 %>
<%= f.submit "确认"%>
</div></td> </tr>
Expand Down
Loading

0 comments on commit 34858d6

Please sign in to comment.