103 lines
4.1 KiB
HTML
103 lines
4.1 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>模拟三卡扫描端</title>
|
||
<script type="text/javascript" src="/static/handle/js/jquery-2.1.0.min.js"></script>
|
||
<script type="text/javascript" src="/static/handle/js/layer-v3.1.1/layer.js"></script>
|
||
<script type="text/javascript" src="/static/handle/js/socket.io-1.4.4.js"></script>
|
||
<script type="text/javascript">
|
||
var table_id = "{$table.id}";
|
||
var websocketUrl="{$websocketUrl}";
|
||
var websocketProtocol="{$websocketProtocol}";
|
||
</script>
|
||
</head>
|
||
<body>
|
||
起始牌:<input name="start" id="start" value="101"><button id="start_1" onclick="submitResult('start_1')">提交</button><br>
|
||
<br/>
|
||
1:<input name="banker_1" id="card1" value="102" ><button id="sub_1" onclick="submitResult('sub_1')">提交</button><br>
|
||
2:<input name="banker_2" id="card2" value="103"><button id="sub_2" onclick="submitResult('sub_2')">提交</button><br>
|
||
3:<input name="banker_3" id="card3" value="104"><button id="sub_3" onclick="submitResult('sub_3')">提交</button><br>
|
||
<br/>
|
||
4:<input name="player_1" id="card4" value="107"><button id="sub_4" onclick="submitResult('sub_4')">提交</button><br>
|
||
5:<input name="player_2" id="card5" value="108"><button id="sub_5" onclick="submitResult('sub_5')">提交</button><br>
|
||
6:<input name="player_3" id="card6" value="109"><button id="sub_6" onclick="submitResult('sub_6')">提交</button><br>
|
||
<br/>
|
||
7:<input name="player_1" id="card7" value="112"><button id="sub_7" onclick="submitResult('sub_7')">提交</button><br>
|
||
8:<input name="player_2" id="card8" value="113"><button id="sub_8" onclick="submitResult('sub_8')">提交</button><br>
|
||
9:<input name="player_3" id="card9" value="201"><button id="sub_9" onclick="submitResult('sub_9')">提交</button><br>
|
||
<br/>
|
||
10:<input name="player_1" id="card10" value="204"><button id="sub_10" onclick="submitResult('sub_10')">提交</button><br>
|
||
11:<input name="player_2" id="card11" value="205"><button id="sub_11" onclick="submitResult('sub_11')">提交</button><br>
|
||
12:<input name="player_3" id="card12" value="206"><button id="sub_12" onclick="submitResult('sub_12')">提交</button><br>
|
||
<input type="hidden" id="number_tab_id" value="{$numberTab.id}">
|
||
</body>
|
||
<script>
|
||
var websocket = io(websocketProtocol+"://"+websocketUrl+"/?table_id="+table_id+"&appid=80003&connect=scan&appsecret=123456",{transports: ['websocket']});
|
||
websocket.on('onlineLogin',function(data){
|
||
if(data.status === true){
|
||
// setNumberInfo(data);
|
||
}else{
|
||
layer.msg(data.msg,{time:5000});
|
||
}
|
||
});
|
||
websocket.on('sendScanResult',function(data){
|
||
console.log(data);
|
||
});
|
||
var setNumberInfo = function(data){
|
||
$('#number_tab_id').val(data.round.number_tab_id);
|
||
};
|
||
// 点击提交结果
|
||
var submitResult = function(id){
|
||
var query = new Object();
|
||
query.number_tab_id = $('#number_tab_id').val();
|
||
if(id == 'start_1'){
|
||
query.card = $('#start').val();
|
||
query.position = '0';
|
||
}
|
||
if(id == "sub_1"){
|
||
query.card = $('#card1').val();
|
||
query.position = "1";
|
||
}else if(id == "sub_2"){
|
||
query.card = $('#card2').val();
|
||
query.position = "2";
|
||
}else if(id == "sub_3"){
|
||
query.card = $('#card3').val();
|
||
query.position = "3";
|
||
}else if(id == "sub_4"){
|
||
query.card = $('#card4').val();
|
||
query.position = "4";
|
||
}else if(id == "sub_5"){
|
||
query.card = $('#card5').val();
|
||
query.position = "5";
|
||
}else if(id == "sub_6"){
|
||
query.card = $('#card6').val();
|
||
query.position = "6";
|
||
}else if(id == "sub_7"){
|
||
query.card = $('#card7').val();
|
||
query.position = "7";
|
||
}else if(id == "sub_8"){
|
||
query.card = $('#card8').val();
|
||
query.position = "8";
|
||
}else if(id == "sub_9"){
|
||
query.card = $('#card9').val();
|
||
query.position = "9";
|
||
}else if(id == "sub_10"){
|
||
query.card = $('#card10').val();
|
||
query.position = "10";
|
||
}else if(id == "sub_11"){
|
||
query.card = $('#card11').val();
|
||
query.position = "11";
|
||
}else if(id == "sub_12"){
|
||
query.card = $('#card12').val();
|
||
query.position = "12";
|
||
}
|
||
if(query.card.length <= 0){
|
||
layer.alert("扫牌失败,请重新扫牌!");
|
||
return false;
|
||
}
|
||
websocket.emit('sendScanTc',{table_id : table_id, number_tab_id : query.number_tab_id, card : query.card, position : query.position});
|
||
}
|
||
</script>
|
||
</html>
|