init: 从宝塔同步到 Gitea

This commit is contained in:
root
2026-02-25 01:50:31 +08:00
commit e633c8e27d
2444 changed files with 399341 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
.section .head {
/*background: linear-gradient(#694F1B,#EAB446,#EAB446,#694F1B);*/
border-top: 2px solid #E8C3B0;
border-right: 2px solid #E8C3B0;
box-shadow: 1px 1px 50px #000;
border-radius: 5px;
width: calc(100% + 4px);
top: -2px;
left: -2px;
}
.section .head .logo {
height: 100%;
background: url(../../c_logo.png?v=1) center center no-repeat;
width: 8vw;
-webkit-background-size: 8vw;
background-size: 8vw;
display: table-cell;
}
.section .head .box .date {
color: #fff;
}
.section .head .box .date span{
color: #fff;
background: #916C23;
padding: 0 15px;
}
.table-data {
border: 2px solid #87756c;
/*background: linear-gradient(#694F1B,#694F1B,#EAB446,#AA8649,#C49B86,#463107,#C49B86);*/
}
.table-data .top {
margin-top: 0.7vh;
}
.table-data .lan-box .item small {
font-weight: 600;
font-size: 18px;
}
.table-data .lan-box {
padding-bottom: 0;
padding-top: 0.5vh;
}
.limit-box .list .item span {
font-weight: 600;
font-size: 18px;
}
.canvas-box .active-box {
border: 1px solid #fff;
bottom: -1px;
right: -1px;
}
.canvas-box .active-box p {
right: 0;
left: auto;
color: #DCD6D4;
}
File diff suppressed because it is too large Load Diff
+121
View File
@@ -0,0 +1,121 @@
*{padding: 0; margin: 0;}
li{list-style: none;}
.box-sizing{box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box;}
input,button,textarea,select,optgroup,option{font-family:inherit; font-size:inherit; font-style:inherit; font-weight:inherit;}
input,img,select,button{vertical-align:middle; border:none; text-decoration: none; outline:none;}
input::-moz-focus-inner{border: 0; padding: 0;}
img{max-width: 100%; height: auto; width:auto\9; /* ie8 */ -ms-interpolation-mode:bicubic;/*为了照顾ie图片缩放失真*/ line-height: 1.5;}
body{background-color:#169C95; line-height: 1.5; min-width:1250px;}
.clearfix{zoom:1;}
.clearfix:after{content:""; display:block; visibility:hidden; height:0; clear:both;}
.fl{float:left;}
.fr{float:right;}
/*定时器弹窗提示*/
.a_lert{position: fixed; top: 50%; margin-top: -5%; z-index: 9999; left: 0; width: 100%;}
.a_lert .a_box{text-align: center; overflow: hidden; background: rgba(0, 0, 0, 0.65); border-radius: 5px; display: table; margin: 0 auto;}
.a_lert .a_box span{line-height: 2.5; color: #A8A8A8; font-size: 13px; min-width:400px; display: block;}
.a_lert .a_box p{line-height: 2.5; font-size: 15px; color: #EFEDED; padding: 8px 15px; letter-spacing: 1px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
/*结果弹窗*/
@-webkit-keyframes bounceIn{0%{opacity: .8; -webkit-transform: scale(0.5);} 100%{opacity: 1; -webkit-transform: scale(1);}}
@-moz-keyframes bounceIn{0%{opacity: .8; -moz-transform: scale(0.5);} 100%{opacity: 1; -moz-transform: scale(1);}}
@-o-keyframes bounceIn{0%{opacity: .8; -o-transform: scale(0.5);} 100%{opacity: 1; -o-transform: scale(1);}}
@keyframes bounceIn{0%{opacity: .8; transform: scale(0.5);} 100%{opacity: 1; transform: scale(1);}}
.pop-box{width: 400px; height: 342px; position:fixed; left: 50%; top: 50%; margin-top: -171px; margin-left: -200px; -webkit-animation: bounceIn .3s 0s ease both; -moz-animation: bounceIn .3s 0s ease both; -o-animation: bounceIn .3s 0s ease both; animation: bounceIn .3s 0s ease both;}
.bodyhd{width: 100%; background-color: #169C95; height: 30px; color: #fff; font-size: 16px; line-height: 30px; position: fixed; top: 0; left: 0; z-index: 999;}
.bodyhd .titlename{padding-left: 20px; float: left;}
.bodyhd .btn{float: right;}
.bodyhd .btn span{width: 30px; height: 30px; display: inline-block; position: relative; /*background: pink*/}
.bodyhd .btn span:active{opacity: 0.6}
.bodyhd .btn .minimize::before{content: ''; display: inline-block; width: 16px; border-bottom: 2px solid #fff; position: absolute; right: 6px; top: 15px; z-index: 200;}
.bodyhd .btn .maximize::before{content: '□'; display: inline-block; font-size: 32px; position: absolute; font-weight: bold; right: 5px; top: -3px; z-index: 200;}
.bodyhd .btn .close::before{content: '✕'; display: inline-block; font-size: 22px; position: absolute; font-weight: normal; right: 6px; top: 1px; z-index: 200;}
.leftnav{top:100px}
.baccarat_head{background-color: #56D7CF; margin:15px; border-radius: 10px; overflow: hidden; min-width: 1000px;}
.baccarat_head .logo{width:22%; line-height:0; margin: 5px 0; display: table-cell; vertical-align: middle;}
.baccarat_head .logo img{width: 100%; padding: 8px; padding-right: 0;}
.baccarat_head .message{vertical-align: middle; width: 70%; display: table-cell;}
.baccarat_head .hd{display: table; padding:4px 8px; width: 100%; padding-bottom: 0;}
.baccarat_head .hd .item{display: table-cell;}
.baccarat_head .hd .item .box{margin: 4px; border: 2px solid #1b4100; border-radius: 8px; padding: 0 6px; margin-bottom:0;}
.baccarat_head .hd .item label{font-size: 20px; font-weight: 500; color: #103100; float: left; width: 45%; text-align: center; line-height: 42px;}
.baccarat_head .hd .item input{float: left; font-size: 24px; font-weight: 500; width: 75%; margin: 4px 0; border-radius: 5px; padding: 0 10px; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; color: #bc2f35;}
.notice{background: #fff; text-align: center; font-size: 14px; margin:0 14px; margin-top: 20px; color: #8d9b90; padding: 0.6% 0;}
.notice:last-child{margin-bottom: 8px;}
.baccarat_mian{margin:0 15px; margin-bottom: 15px;}
.baccarat_mian .item{background: #56D7CF; padding: 9px 0; border-radius: 10px; margin-bottom: 10px; position:relative;}
.baccarat_mian .item canvas{background: #fff; margin: 0 auto; display: block; border: 2px solid #000;}
.baccarat_mian .item .ft{display: table; width: 100%}
.baccarat_mian .canvas-box{display: table-cell; background: #56D7CF; padding: 9px 0; border-radius: 10px; vertical-align: middle;}
.baccarat_mian .canvas-box canvas{background: #fff; margin: 0 9px; display: block; border: 2px solid #000;}
.baccarat_mian .hints{width: 515px; /*display: table-cell;*/ background: #c3e67d; border-radius: 10px; vertical-align: middle; min-width: 100px; position:absolute; right: 1.1%; bottom:4.2%;}
.baccarat_mian .hints .box{background: #fff; display: block; border: 2px solid #000; margin: 0 auto; /*position: absolute;*/ padding: 4px; /*width: 90%;*/ /*text-align: center;*/}
.baccarat_mian .hints .box i.iocn_1{width: 18px; height: 18px; border-radius: 100px; border:2px solid red; float: left; margin-left:10px; margin-top: 8px;}
.baccarat_mian .hints .box i.iocn_2{width: 22px; height: 22px; border-radius: 100px; background: red; float: left; margin-left:10px; margin-top: 8px;}
.baccarat_mian .hints .box i.iocn_3{position: relative; width: 22px; height: 22px; float: left; margin-left:10px;}
.baccarat_mian .hints .box i.iocn_3:after{content: ""; height: 22px; border-left:3px solid red; position: absolute; left: 5px; margin-top: 8px; border-radius: 5px; transform:rotate(30deg); -ms-transform:rotate(30deg); /* IE 9 */ -moz-transform:rotate(30deg); /* Firefox */ -webkit-transform:rotate(30deg); /* Safari 和 Chrome */ -o-transform:rotate(30deg);}
.baccarat_mian .hints .box i.iocn_4{width: 18px; height: 18px; border-radius: 100px; border:2px solid #1C7ED0; float: left; margin-left:10px; margin-top: 8px;}
.baccarat_mian .hints .box i.iocn_5{width: 22px; height: 22px; border-radius: 100px; background: #1C7ED0; float: left; margin-left:10px; margin-top: 8px;}
.baccarat_mian .hints .box i.iocn_6{position: relative; width: 22px; height: 22px; float: left; margin-left:10px;}
.baccarat_mian .hints .box i.iocn_6:after{content: ""; height: 22px; border-left:3px solid #1C7ED0; position: absolute; left: 5px; margin-top: 8px; border-radius: 5px; transform:rotate(30deg); -ms-transform:rotate(30deg); /* IE 9 */ -moz-transform:rotate(30deg); /* Firefox */ -webkit-transform:rotate(30deg); /* Safari 和 Chrome */ -o-transform:rotate(30deg);}
.clear{clear:both}
.margin-tab{display: table-cell; width: 9px; vertical-align: middle; min-width: 9px;}
.baccarat_mian .denote{display: table-cell; background: #56D7CF; border-radius: 10px; vertical-align: top;}
.baccarat_mian .denote .top{display: table; width: 95%; padding: 6px 6px 0 6px; margin: 0 auto;}
.baccarat_mian .denote .top span{display: table-cell; border-left: 1px solid #2f5c00; text-align: center; vertical-align: middle; color: #255d00; font-size: 20px; font-weight: 500; min-width: 90px;}
.baccarat_mian .denote .top span:first-child{border-left: none;}
.baccarat_mian .denote .top span small{display: block; font-size: 12px; line-height: 1;}
.baccarat_mian .denote .num{width: 95%; background: #fff; height: 30px; margin: 0 auto; font-size: 16px; line-height: 30px; display: table; margin-top: 4px;}
.baccarat_mian .denote .num span{display: table-cell; text-align: center; font-weight: 500; width: 67px;}
.baccarat_mian .denote .title{display: table; width: 300px; margin: 0 auto; margin-top: 4px;}
.baccarat_mian .denote .title span{display: table-cell; padding:5px 0; text-align: center; color: #255d00; font-weight: 500; padding-left: 70px}
.baccarat_mian .denote .title span small{display: block; line-height: 1;}
/*.baccarat_mian .bte-box{margin-top: -15px;}*/
.baccarat_mian .bte-box .list{display: table; width: 90%; position: relative; padding-left: 100px; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; margin: 20px auto;}
.baccarat_mian .bte-box .list label{font-size: 18px; font-weight: 500; color: #255d00; text-align: center; font-weight: 500; display: table-cell; vertical-align: middle; width: 100px; position: absolute; top: 0; left: 10px;}
.baccarat_mian .bte-box .list label small{display: block; font-size: 12px;}
.baccarat_mian .bte-box .list .items{display: table-cell; vertical-align: middle; width: 50%; position: relative;}
.baccarat_mian .bte-box .list .items .pr10{padding-right: 10%; display: table-cell;}
.baccarat_mian .bte-box .list .items i{position: absolute; top: 2px;left: 9px;}
.baccarat_mian .bte-box .list .items input{font-size: 18px; font-weight: 500; padding: 0 10px; padding-left: 50px; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; width: 90%; height: 28px; line-height: 28px;}
.black_overlay{display: none; position: fixed; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:99; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=88);}
.table_id_content{display: none; text-align: center; position: absolute; top: 50%; left: 50%; width: 23%; height: 3%; padding: 20px; border: 10px solid #169C95; background-color: white; z-index:999; overflow: auto; border-radius: 8px; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); font-weight:bold; min-width: 375px;}
.table_info_content{display: none; position: absolute; width: 40%; z-index: 999; left: 50%; top: 50%; padding: 10px; border: 10px solid #169C95; background-color: #56D7CF; z-index:1002; border-radius: 8px; min-width: 620px; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); font-weight:bold;}
.table_id_content .table_button{background-color: #169C95; height: 26px; color: #fff; border-radius: 5px; padding:1px 5px 3px 5px; cursor:pointer;}
.table_info_content .table_info_line{background-color: white; padding: 5px; margin-bottom: 10px; overflow:hidden;}
.table_info_button{padding-top: 5px; text-align: center;}
.table_info_button .table_button{margin-top: 5px; background-color: #169C95; color: #fff; padding: 5px; border-radius: 5px; margin-right: 2%; margin-left: 2%; cursor:pointer;}
.table_info_line .info_memo{vertical-align: top; padding-top: 1px; border: 1px solid #C4C4C4; margin-left: 10px; width: 92%; line-height: 1.5;}
.table_info_line .compensation_cns{width: 115px; float: left;}
.compensation_cns .compensation_eng{color: #6D6D6D; text-align: center;}
.table_info_line .compensation_momey{float: left; line-height: 48px; padding-left: 5%;}
.table_info_line .chose_momey{float:left; line-height: 48px; padding-left: 10%;}
.chose_momey .c_momey{border: 1px solid #000;}
.info_table_style{text-align: center; float: left; padding:1%;}
.font_style{width: 100%; text-align: center;}
.input_style{vertical-align: top; padding-top: 1px; width: 150px;}
.iframe-box{position: fixed; top: 0; left: 0; width: 80%; height: 88%; padding:6% 10% 0; background: rgba(0,0,0,0.5); z-index: 999;}
.iframe-box .title{text-align: center; font-size: 14px; position: relative; background:#fff; font-weight: normal; padding: 5px; border-bottom: 1px solid #ccc;}
.iframe-box iframe{width: 100%; min-height: 720px;}
.baccarat_mian .denote .bte-box{margin-top: -15px;}
.off-btn{position: absolute; right: -10px; top: -10px; width: 30px; height: 30px; text-align: center; line-height: 30px; border-radius: 100px; background: #fff; -webkit-box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.45); box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.45);}
.title-table{float: left; font-size: 24px; font-weight: 500; width: 55%; margin: 4px 0; border-radius: 5px; padding: 0 10px; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; color: #bc2f35;background: #fff;}
.system-btn{overflow:hidden;}
.system-btn div{float:left; width:86px; border-radius:5px; height:40px; line-height:40px; text-align:center; background:#56D7CF; overflow:hidden; cursor:pointer; margin-left:20px; color:#fff;}
/* 隐藏的提交按钮 */
.dosubmit-area{width:500px; height:350px; position:fixed; right:-472px; top:26%; background:#6A9E76; border-radius:5px 0px 0px 5px; overflow:hidden;}
.animate-page{font-family:"黑体"; width:28px; float:left; overflow:hidden; line-height:350px; text-align:center; color:#fff; cursor:pointer;}
.animate-table{width:472px; margin:30px auto 0;}
.submit-table{width:90%; margin:0 auto;}
.submit-table td{text-align:center; padding:0; margin:0; width:20%;}
.submit-table .result-btn,.submit-table .result-btn-pair{display:inline-block; width:100%; height:40px; overflow:hidden; background:#999; color:#fff; text-align:center; line-height:40px; cursor:pointer;}
.submit-table #dosubmit{display:inline-block; margin-top:20px; width:310px; height:40px; text-align:center; line-height:40px; background:#f00; color:#fff; cursor:pointer; border-radius:5px;}
.begin-button{color: white; background-color: #1EB848; border-radius: 5px; margin-top: 20px; cursor:pointer; height:40px; line-height:40px; text-align:center; margin: 0 auto 20px; width: 120px;}
/* 状态及信息区 */
.baccarat_mian .denote{overflow:hidden; border: 10px solid #56D7CF; background: #fff; position:relative}
.baccarat_mian .denote .denote-left{width: 50%; text-align: center; padding-top: 5%; font-size: 24px; }
.baccarat_mian .denote .denote-right{width: 50%; position:absolute; height:100%; right:0;top:0;}
.denote-boot-count{width:100%; margin:0px auto; border-collapse: collapse; height:99.4%;}
.denote-boot-count td{width:20%; text-align:center; border:2px solid #000; padding:0; font-size:13px; background:#1EB4AB; color:#fff; height:11.11%; font-weight:bold; font-family:"宋体";}
.denote-boot-count td.denote-online-number{padding-left:10px; padding-right:10px;}
.denote-online-number b{display:block; float:left;}
.denote-online-number span{display:block; float:right;}
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
*{padding:0; margin:0; border:0}
body{background-image: url(../images/back.jpg);}
.main{width:1600px; height:auto; margin:0 auto;}
.header{overflow:hidden; margin-top: 6%;}
.header_left{color: #0e912b;float: left;font-size: 26px;width: 260px;}
.header_right{float: left; font-size: 16px; text-align:center;}
.type-one{color :black; background-image: url(../images/back-two.png);float: left; width:139px; height: 37px; line-height: 37px; border-top-left-radius:12px; border-bottom-left-radius:12px;}
.type-two{color :white;background-image: url(../images/back-one.png);float: left; width:139px; height: 37px; line-height: 37px;}
.type-three{color :black;background-image: url(../images/back-two.png);float: left; width:139px; height: 37px; line-height: 37px;}
.type-four{color :white;background-image: url(../images/back-one.png);float: left; width:139px; height: 37px; line-height: 37px; border-top-right-radius:12px; border-bottom-right-radius:12px;}
.second-one-button{cursor:pointer;}
.second-one-button img{width: 30px;padding: 10px 15px 0px 15px;}
.second{margin-top:4%;overflow:hidden;}
.second-one{width: 160px;background-color: black;border:1px solid #696969;color: white;float: left;margin-right:35px;overflow: hidden;height: 48px;}
.second-one .second-one-word{padding: 8px 20px;border-bottom:1px solid #696969;cursor:pointer;}
.second-one .second-one-word:hover{background-color: #10571F;}
.second-two{float: left;margin-left: 2%;border:2px dashed #10571F;width: 540px;background-color: #333132;border-radius: 10px;}
.video{padding: 7px;}
.video img{width: 100%;}
.second-three{float: left; margin-left: 140px; font-size: 20px; width:230px; overflow:hidden;}
.second-three .begin-button{color: white; background-color: #1EB848; border:5px solid #0F0F0F; border-radius: 10px; margin-top: 160px; cursor:pointer; height:60px; line-height:60px; text-align:center;}
.second-four{float: left; margin-left: 140px; width: 300px; height: 400px; background-color: rgba(66, 64, 65, 0.7); border-radius:10px;}
.submit-table{margin-top:50px; width:1600px;}
.submit-table td{text-align:center; padding:0; margin:0;}
.submit-table .result-btn,.submit-table .result-btn-pair{display:inline-block; width:310px; height:60px; overflow:hidden; background:#ccc; color:#fff; text-align:center; line-height:60px; cursor:pointer;}
.submit-table #dosubmit{display:inline-block; margin-top:20px; width:310px; height:60px; text-align:center; line-height:60px; background:#f00; color:#fff; cursor:pointer;}
.second-four #betstatus{line-height:100px; margin:0; text-align:center; color:#fff; font-size:24px;}
.second-four #opening_result{line-height:100px; margin:0; text-align:center; color:#fff; font-size:36px;}
+124
View File
@@ -0,0 +1,124 @@
/*
* @Author: Archen
* @Date: 2016-04-08 10:29:03
* @Last Modified by: Archen
* @Last Modified time: 2016-04-22 13:24:16
*/
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{margin:0;padding:0;}
/* 酌情修改 */
body {
font-family: "Lantinghei SC","Open Sans",Arial,"Hiragino Sans GB","Microsoft YaHei","微软雅黑",STHeiti,"WenQuanYi Micro Hei",SimSun,sans-serif;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
font-smooth: always;
}
body {
font-size: 14px;
line-height: 1.42857143;
color: #333;
}
/* 短引用的内容可取值:''或"" */
q:before,q:after {content:;}
/* 缩写,图片等无边框 */
fieldset,img,abbr,acronym {border: 0 none;}
abbr,acronym {font-variant: normal;}
legend {color:#000;}
/* 清除特殊标记的字体和字号 */
address,caption,cite,code,dfn,em,strong,th,var {
  font-weight: normal;
  font-style: normal;
}
/* 上下标 */
sup {vertical-align: text-top;}
sub {vertical-align: text-bottom;}
/* 设置表格的边框被合并为一个单一的边框, 指定分隔边框模型中单元格边界之间的距离为0*/
table {
  border-collapse: collapse;
  border-spacing: 0;
}
/* 表格标题及内容居左显示 */
caption,th {text-align: left;}
input,img,select,button {vertical-align:middle; border:none; text-decoration: none; outline:none;}
/* 清除列表样式 */
ol,ul {list-style: none;}
/* 输入控件字体 */
input,button,textarea,select,optgroup,option {
font-family:inherit;
font-size:inherit;
font-style:inherit;
font-weight:inherit;
}
/* 标题元素样式清除 */
h1,h2,h3,h4,h5,h6 {font-weight: normal; font-size: 100%;
}
/* 链接样式,颜色可酌情修改 */
del,ins,a {text-decoration:none; color: #555;}
a:hover,a:active{color:#6DD1C1; text-decoration:none;}
/* 鼠标样式 */
input[type="submit"] {cursor: pointer;}
button {cursor: pointer;}
input::-moz-focus-inner { border: 0; padding: 0;}
.clearfix{zoom:1;}
.clearfix:after{content:""; display:block; visibility:hidden; height:0; clear:both;}
.fl{float:left;}
.fr{float:right;}
.box-sizing{
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
img {
max-width: 100%;
height: auto;
width:auto\9; /* ie8 */
-ms-interpolation-mode:bicubic;/*为了照顾ie图片缩放失真*/
}
.transition{
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s;
-o-transition: all 1s;
transition: all 1s;
}
strong,h2{font-weight: normal;}
em,i{font-style:normal;}
.table-box{
display: table;
width: 100%;
}
.table-box .cell{
display: table-cell;
}
.noselect{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

+707
View File
@@ -0,0 +1,707 @@
var getOnlineNumber = function (connections){
var query = new Object();
query.connections = connections;
$.ajax({
url:'/index/get_online_number',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
$('#onlineNumber').html(data.data);
}
}
});
}
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/index/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
$('#result_total_tie').html(resultToatl.tie);
$('#result_total_bankerpair').html(resultToatl.bankerPair);
$('#result_total_playerpair').html(resultToatl.playerPair);
}
}
});
}
var showPng = function (opening, pair){
if(opening == 1 && pair == 0) $('#openingPng').attr('src','/static/console/img/banker.png');
if(opening == 1 && pair == 1) $('#openingPng').attr('src','/static/console/img/banker_bankerpair.png');
if(opening == 1 && pair == 2) $('#openingPng').attr('src','/static/console/img/banker_playerpair.png');
if(opening == 1 && pair == 3) $('#openingPng').attr('src','/static/console/img/banker_bothpair.png');
if(opening == 2 && pair == 0) $('#openingPng').attr('src','/static/console/img/player.png');
if(opening == 2 && pair == 1) $('#openingPng').attr('src','/static/console/img/player_bankerpair.png');
if(opening == 2 && pair == 2) $('#openingPng').attr('src','/static/console/img/player_playerpair.png');
if(opening == 2 && pair == 3) $('#openingPng').attr('src','/static/console/img/player_bothpair.png');
if(opening == 3 && pair == 0) $('#openingPng').attr('src','/static/console/img/tie.png');
if(opening == 3 && pair == 1) $('#openingPng').attr('src','/static/console/img/tie_bankerpair.png');
if(opening == 3 && pair == 2) $('#openingPng').attr('src','/static/console/img/tie_playerpair.png');
if(opening == 3 && pair == 3) $('#openingPng').attr('src','/static/console/img/tie_bothpair.png');
$('#openingElement').show().delay(1000).hide(300);
}
$(document).on("click","#next_banker",function(){
var next = new Object;
next.result = 'banker';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
$(document).on("click","#next_player",function(){
var next = new Object;
next.result = 'player';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.result = "allData";
data.table = TableId;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
console.log(data);
// 将数据结果存session
ludan = data;
// 执行画布刷新
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
}
});
}
$(window).resize(function(){
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
});
// canvas 路单
function resizeCanvas(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single1'),
ctb=table.getContext('2d');
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
Tab_w=tab_width/tab_cols
tab_height=Tab_w*tab_rows||183
Font_Size =Math.floor(Tab_w/1.8)+"px Arial"
Font_Size_s=Math.floor(Tab_w/2.8)+"px Arial"
$("#single1").attr("height",tab_height+0.4)
$("#single1").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
if(twinkledata!=undefined){
var twin=twinkledata.bigRoad.show_location,
twinlength=twin.length-1
twinkle(ctb,twin[twinlength].show_x,twin[twinlength].show_y,twin[twinlength].result);
}
// 获取本地session里的路单数据
var waybill = ludan;
if(waybill == false) return false;
var bigRoad = waybill.bigRoad;
var showRoad = waybill.showRoad;
// 第一局为和,大路展示
if(showRoad != undefined && showRoad.show_location != undefined && showRoad.first_tie_num != undefined && showRoad.first_tie_num > 0){
b_Tie(showRoad.first_tie_num);
}
//if(bigRoad.first_tie_num == 1 && bigRoad.show_location.length == 1){
// b_Tie(bigRoad.show_location[0].tie_num);
//}
// 大路路单展示
if( bigRoad != undefined && bigRoad.show_location != undefined){
for(var i=0; i<bigRoad.show_location.length; i++){
//庄赢
if(bigRoad.show_location[i].result == "banker"){
// 判断是否有和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2);
}
}
// 闲赢
if(bigRoad.show_location[i].result == "player"){
// 判断是否是和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1);
}
}
// 和
if(bigRoad.show_location[i].tie_num > 0){
if(bigRoad.first_tie_num != undefined && bigRoad.first_tie_num == 1 && i == 0 && bigRoad.show_location[i].result == 'tie'){
b_Tie(bigRoad.show_location[i].tie_num)
}else{
if(bigRoad.show_location[i].result == 'banker'){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}
}
}
}
}
ctb.closePath();
// 局数 数,文字X坐标,文字Y坐标,文字大小风格
function Font_tie(num,Font_x,Font_y,fontsize){
if(num!==undefined){
ctb.beginPath();
ctb.font=fontsize;
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillStyle ="#000" ;
ctb.fillText(num,Font_x,Font_y);
ctb.stroke();
}
}
function b_Tab(x,y,type,slash,order){
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(Tab_w*x_z-Tab_w/2.1, Tab_w*y_z-Tab_w/2.1, Tab_w*0.9, Tab_w*0.9);
if(type=="1"){
var color="#331a98";
}else if(type=="2"){
var color="#fb2603"
}
ctb.beginPath();
ctb.lineWidth = 1.5;
ctb.strokeStyle = color;
ctb.arc(Tab_w*x_z-0.5, Tab_w*y_z-0.5, Tab_w*0.38, 0, Math.PI * 2);
ctb.stroke();
if(slash=="1"){
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 2;//线条宽度
ctb.lineCap = "round";
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.moveTo(x_z*Tab_w-linewidth,Tab_w*y_z+linewidth);
ctb.lineTo(x_z*Tab_w+linewidth,Tab_w*y_z-linewidth);
ctb.stroke();
Font_tie(order,Tab_w*x_z, Tab_w*y_z,Font_Size);
}
}
// b区第一局 和
function b_Tie(order){
ctb.clearRect(Tab_w/20, 1, Tab_w*0.9, Tab_w*0.9);
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 3.5;//线条宽度
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.lineCap = "round";
ctb.moveTo(Tab_w/20,Tab_w/2);
ctb.lineTo(Tab_w*0.9,Tab_w/2);
ctb.stroke();
Font_tie(order,Tab_w/2, Tab_w/2,Font_Size);
}
// 问路
function twinkle(ctb,show_x,show_y,result){
var b=10
num1=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num1);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
if(result=="banker"){
b_Tab(show_x,show_y,2)
}else if(result=="player"){
b_Tab(show_x,show_y,1)
}
// // 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas2(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single2'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
tab_b_cols = 6,
Tab_w=tab_width/tab_cols,
tab_height=Tab_w*tab_rows||183;
$("#single2").attr("height",tab_height+0.8)
$("#single2").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
var waybill = ludan;
if(!waybill) return false;
var bigEyeRoad = waybill.bigEyeRoad; // 大眼路数据
var pathway = waybill.pathway; // 小路数据
var roach = waybill.roach;
// 小强路数据
if(twinkledata!=undefined){
twinkle(ctb,twinkledata);
}
// 大眼路数据
if(bigEyeRoad != undefined && bigEyeRoad.show_location != undefined){
for(var i=0; i<bigEyeRoad.show_location.length; i++){
// 红圈
if(bigEyeRoad.show_location[i].result == 'red'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,2);
}
// 蓝圈
if(bigEyeRoad.show_location[i].result == 'blue'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,1);
}
}
}
// 小路数据
if(pathway != undefined && pathway.show_location != undefined){
for(var i=0; i<pathway.show_location.length; i++){
// 红圈
if(pathway.show_location[i].result == 'red'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,2);
}
// 蓝圈
if(pathway.show_location[i].result == 'blue'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,1);
}
}
}
// 小强路数据
if(roach != undefined && roach.show_location != undefined){
for(var i=0; i<roach.show_location.length; i++){
// 红圈
if(roach.show_location[i].result == 'red'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,2);
}
// 蓝圈
if(roach.show_location[i].result == 'blue'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,1);
}
}
}
ctb.closePath();
// c区
function c_Tab(x,y,type){
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), tab_c*(y-1), tab_c, tab_c);
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
}
ctb.beginPath();
ctb.lineWidth = 1;
ctb.arc(tab_c*x_z, tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.stroke();
}
// d区
function d_Tab(x,y,type){
var d_y=Tab_w*tab_b_cols/2,
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), d_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 0.2;
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
ctb.fillStyle='#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
ctb.fillStyle='#ff0000';
}
ctb.arc(tab_c*x_z, d_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.fill();
ctb.stroke();
}
// e区
function e_Tab(x,y,type){
var d_x=20*Tab_w,
linewidth=Tab_w/3;
x_z=x-0.2,
y_z=y-0.2,
tab_d_x=Tab_w/2;
ctb.clearRect(d_x+tab_d_x*(x-1), tab_d_x*(y-1), tab_d_x, tab_d_x);
ctb.beginPath();
ctb.lineCap = "butt";
ctb.lineWidth = 2;//线条宽度
//线条颜色
if(type=="1"){
ctb.strokeStyle = '#331a98';
}else if(type=="2"){
ctb.strokeStyle = '#fd2203';
}
ctb.moveTo(d_x+tab_d_x*x_z,linewidth+tab_d_x*y_z-Tab_w*0.3);
ctb.lineTo(d_x-linewidth+tab_d_x*x_z,tab_d_x*y_z-Tab_w*0.3);
ctb.stroke();
}
function twinkle(ctb,twinkledata){
var b=10,
bigEyeRoad=twinkledata.bigEyeRoad.show_location,
pathway=twinkledata.pathway.show_location,
roach=twinkledata.roach.show_location
num2=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num2);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
//
if(bigEyeRoad!=undefined){
var bigEyeRoadlength=bigEyeRoad.length-1
if(bigEyeRoad[bigEyeRoadlength].result=="blue"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,1)
}else if(bigEyeRoad[bigEyeRoadlength].result=="red"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,2)
}
}
if(pathway!=undefined){
var pathwaylength=pathway.length-1
if(pathway[pathwaylength].result=="blue"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,1)
}else if(pathway[pathwaylength].result=="red"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,2)
}
}
if(roach!=undefined){
var roachlength=roach.length-1
if(roach[roachlength].result=="blue"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,1)
}else if(roach[roachlength].result=="red"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,2)
}
}
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas3(show_x,show_y,type,corners,twinkledata){
var canvaswidth= $(".baccarat_head").width()*0.5;
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single3'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=20,
tab_rows=6,
tab_x=tab_width/tab_cols
tab_y=tab_x,
tab_height=tab_y*tab_rows
$("#single3").attr("height",tab_height+1)
$("#single3").attr("width",canvaswidth+0.5)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,tab_x);
if(twinkledata!=undefined){
var showRoads=twinkledata.showRoad.show_location
showRoadlength=showRoads.length-1
twinkle(ctb,showRoads[showRoadlength].show_x,showRoads[showRoadlength].show_y,showRoads[showRoadlength].result,showRoads[showRoadlength].pair);
}
var show_x=show_x,
show_y=show_y;
type=type
if(show_x!=""||undefined){
Tab(show_x,show_y,type,corners);
}
var waybill = ludan;
if(!waybill) return false;
var showRoad = waybill.showRoad;
// 展示路的路单显示
if(showRoad != undefined && showRoad.show_location != undefined){
for(var i=0; i<showRoad.show_location.length; i++){
if(showRoad.show_location[i].result == "banker"){
// 展示路
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',5);
}
}
if(showRoad.show_location[i].result == "player"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',5);
}
}
if(showRoad.show_location[i].result == "tie"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',5);
}
}
}
}
ctb.closePath();
function Tab(x,y,type,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
var x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_x*(x-1), tab_x*(y-1), tab_x, tab_x);
if(type=="banker"){
var color='#e12217',
fonts='庄';
}else if(type=="player"){
var color='#0030ff',
fonts='闲';
}else if(type=="tie"){
var color='#27cf00',
fonts='和';
}
ctb.arc(tab_x*x_z, tab_x*y_z, tab_x*0.45, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
Font_Size =Math.floor(tab_x/1.8)+"px Arial"
ctb.font=Font_Size;
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,tab_x*x_z,tab_x*y_z);
ctb.stroke();
var corner_xy=tab_x/3.2
if(corners=="1"){
corner(x_z,y_z,corner_xy,'#1944ff');
}else if(corners=="2"){
corner(x_z,y_z,-corner_xy,'#1944ff');
}else if(corners=="3"){
corner(x_z,y_z,corner_xy,'#ff2202');
}else if(corners=="4"){
corner(x_z,y_z,-corner_xy,'#ff2202');
}else if(corners=="5"){
corner(x_z,y_z,corner_xy,'#ff2202');
corner(x_z,y_z,-corner_xy,'#1944ff');
}
}
// a区角标
function corner(x_z,y_z,corner_xy,corner_color){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
ctb.arc(tab_x*x_z-corner_xy, tab_x*y_z-corner_xy, tab_x*0.14, 0, Math.PI * 2);
ctb.fillStyle=corner_color;
ctb.fill();
ctb.stroke();
}
function twinkle(ctb,show_x,show_y,result,pair){
var b=10
num3=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num3);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
// Tab(1,1,"banker",2)
Tab(show_x,show_y,result)
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
/* 时钟 */
function startTime(){
var today=new Date();
var yyyy = today.getFullYear();
var MM = today.getMonth()+1;
var dd = today.getDate();
var hh=today.getHours();
var mm=today.getMinutes();
var ss=today.getSeconds();
MM=checkTime(MM);
dd=checkTime(dd);
mm=checkTime(mm);
ss=checkTime(ss);
var day;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
$('#nowDateSpan').html( yyyy+"-"+MM +"-"+ dd);
$('#nowTimeSpan').html(hh+":"+mm+":"+ss);
$('#nowWeekSpan').html(day);
setTimeout('startTime()',1000);
}
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
/* 时钟 end */
function canvasbg(ctb,CanvasId,tab_width,tab_height,tab_rows,tab_cols,Tab_w) {
ctb.beginPath();
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#999";
ctb.moveTo(0, 0.5);
ctb.lineTo(tab_width, 0.5);
for (var col = 1; col <= tab_rows; col++) {
var y = col * Tab_w;
ctb.moveTo(0,y-0.5);
ctb.lineTo(tab_width,y-0.5);
}
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, tab_height);
for (var row = 1; row <= tab_cols; row++) {
var x = row * Tab_w;
ctb.moveTo(x-0.5,0);
ctb.lineTo(x-0.5,tab_height);
}
ctb.stroke();
var image = new Image();
image.src = CanvasId.toDataURL("image/png");
CanvasId.style.backgroundImage = 'url(' + image.src +')';
ctb.clearRect(0, 0, 10000, 10000);
}
function audio(url){
var mp3="../static/index/mp3/"+url;
var audiohtml= '<audio style="visibility: hidden;" id="chatAudio"><source src="'+mp3+'" type="audio/mpeg"></audio>'
$(audiohtml).appendTo('body');
$("#chatAudio")[0].play()
setTimeout(function(){
$("#chatAudio").remove();
},1000);
}
+707
View File
@@ -0,0 +1,707 @@
var getOnlineNumber = function (connections){
var query = new Object();
query.connections = connections;
$.ajax({
url:'/index/get_online_number',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
$('#onlineNumber').html(data.data);
}
}
});
}
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/index/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
$('#result_total_tie').html(resultToatl.tie);
$('#result_total_bankerpair').html(resultToatl.bankerPair);
$('#result_total_playerpair').html(resultToatl.playerPair);
}
}
});
}
var showPng = function (opening, pair){
if(opening == 1 && pair == 0) $('#openingPng').attr('src','/static/console/img/banker.png');
if(opening == 1 && pair == 1) $('#openingPng').attr('src','/static/console/img/banker_bankerpair.png');
if(opening == 1 && pair == 2) $('#openingPng').attr('src','/static/console/img/banker_playerpair.png');
if(opening == 1 && pair == 3) $('#openingPng').attr('src','/static/console/img/banker_bothpair.png');
if(opening == 2 && pair == 0) $('#openingPng').attr('src','/static/console/img/player.png');
if(opening == 2 && pair == 1) $('#openingPng').attr('src','/static/console/img/player_bankerpair.png');
if(opening == 2 && pair == 2) $('#openingPng').attr('src','/static/console/img/player_playerpair.png');
if(opening == 2 && pair == 3) $('#openingPng').attr('src','/static/console/img/player_bothpair.png');
if(opening == 3 && pair == 0) $('#openingPng').attr('src','/static/console/img/tie.png');
if(opening == 3 && pair == 1) $('#openingPng').attr('src','/static/console/img/tie_bankerpair.png');
if(opening == 3 && pair == 2) $('#openingPng').attr('src','/static/console/img/tie_playerpair.png');
if(opening == 3 && pair == 3) $('#openingPng').attr('src','/static/console/img/tie_bothpair.png');
$('#openingElement').show().delay(1000).hide(300);
}
$(document).on("click","#next_banker",function(){
var next = new Object;
next.result = 'banker';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
$(document).on("click","#next_player",function(){
var next = new Object;
next.result = 'player';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.result = "allData";
data.table = TableId;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
console.log(data);
// 将数据结果存session
ludan = data;
// 执行画布刷新
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
}
});
}
$(window).resize(function(){
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
});
// canvas 路单
function resizeCanvas(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single1'),
ctb=table.getContext('2d');
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
Tab_w=tab_width/tab_cols
tab_height=Tab_w*tab_rows||183
Font_Size =Math.floor(Tab_w/1.8)+"px Arial"
Font_Size_s=Math.floor(Tab_w/2.8)+"px Arial"
$("#single1").attr("height",tab_height+0.4)
$("#single1").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
if(twinkledata!=undefined){
var twin=twinkledata.bigRoad.show_location,
twinlength=twin.length-1
twinkle(ctb,twin[twinlength].show_x,twin[twinlength].show_y,twin[twinlength].result);
}
// 获取本地session里的路单数据
var waybill = ludan;
if(waybill == false) return false;
var bigRoad = waybill.bigRoad;
var showRoad = waybill.showRoad;
// 第一局为和,大路展示
if(showRoad != undefined && showRoad.show_location != undefined && showRoad.first_tie_num != undefined && showRoad.first_tie_num > 0){
b_Tie(showRoad.first_tie_num);
}
//if(bigRoad.first_tie_num == 1 && bigRoad.show_location.length == 1){
// b_Tie(bigRoad.show_location[0].tie_num);
//}
// 大路路单展示
if( bigRoad != undefined && bigRoad.show_location != undefined){
for(var i=0; i<bigRoad.show_location.length; i++){
//庄赢
if(bigRoad.show_location[i].result == "banker"){
// 判断是否有和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2);
}
}
// 闲赢
if(bigRoad.show_location[i].result == "player"){
// 判断是否是和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1);
}
}
// 和
if(bigRoad.show_location[i].tie_num > 0){
if(bigRoad.first_tie_num != undefined && bigRoad.first_tie_num == 1 && i == 0 && bigRoad.show_location[i].result == 'tie'){
b_Tie(bigRoad.show_location[i].tie_num)
}else{
if(bigRoad.show_location[i].result == 'banker'){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}
}
}
}
}
ctb.closePath();
// 局数 数,文字X坐标,文字Y坐标,文字大小风格
function Font_tie(num,Font_x,Font_y,fontsize){
if(num!==undefined){
ctb.beginPath();
ctb.font=fontsize;
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillStyle ="#000" ;
ctb.fillText(num,Font_x,Font_y);
ctb.stroke();
}
}
function b_Tab(x,y,type,slash,order){
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(Tab_w*x_z-Tab_w/2.1, Tab_w*y_z-Tab_w/2.1, Tab_w*0.9, Tab_w*0.9);
if(type=="1"){
var color="#331a98";
}else if(type=="2"){
var color="#fb2603"
}
ctb.beginPath();
ctb.lineWidth = 1.5;
ctb.strokeStyle = color;
ctb.arc(Tab_w*x_z-0.5, Tab_w*y_z-0.5, Tab_w*0.38, 0, Math.PI * 2);
ctb.stroke();
if(slash=="1"){
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 2;//线条宽度
ctb.lineCap = "round";
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.moveTo(x_z*Tab_w-linewidth,Tab_w*y_z+linewidth);
ctb.lineTo(x_z*Tab_w+linewidth,Tab_w*y_z-linewidth);
ctb.stroke();
Font_tie(order,Tab_w*x_z, Tab_w*y_z,Font_Size);
}
}
// b区第一局 和
function b_Tie(order){
ctb.clearRect(Tab_w/20, 1, Tab_w*0.9, Tab_w*0.9);
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 3.5;//线条宽度
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.lineCap = "round";
ctb.moveTo(Tab_w/20,Tab_w/2);
ctb.lineTo(Tab_w*0.9,Tab_w/2);
ctb.stroke();
Font_tie(order,Tab_w/2, Tab_w/2,Font_Size);
}
// 问路
function twinkle(ctb,show_x,show_y,result){
var b=10
num1=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num1);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
if(result=="banker"){
b_Tab(show_x,show_y,2)
}else if(result=="player"){
b_Tab(show_x,show_y,1)
}
// // 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas2(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single2'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
tab_b_cols = 6,
Tab_w=tab_width/tab_cols,
tab_height=Tab_w*tab_rows||183;
$("#single2").attr("height",tab_height+0.8)
$("#single2").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
var waybill = ludan;
if(!waybill) return false;
var bigEyeRoad = waybill.bigEyeRoad; // 大眼路数据
var pathway = waybill.pathway; // 小路数据
var roach = waybill.roach;
// 小强路数据
if(twinkledata!=undefined){
twinkle(ctb,twinkledata);
}
// 大眼路数据
if(bigEyeRoad != undefined && bigEyeRoad.show_location != undefined){
for(var i=0; i<bigEyeRoad.show_location.length; i++){
// 红圈
if(bigEyeRoad.show_location[i].result == 'red'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,2);
}
// 蓝圈
if(bigEyeRoad.show_location[i].result == 'blue'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,1);
}
}
}
// 小路数据
if(pathway != undefined && pathway.show_location != undefined){
for(var i=0; i<pathway.show_location.length; i++){
// 红圈
if(pathway.show_location[i].result == 'red'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,2);
}
// 蓝圈
if(pathway.show_location[i].result == 'blue'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,1);
}
}
}
// 小强路数据
if(roach != undefined && roach.show_location != undefined){
for(var i=0; i<roach.show_location.length; i++){
// 红圈
if(roach.show_location[i].result == 'red'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,2);
}
// 蓝圈
if(roach.show_location[i].result == 'blue'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,1);
}
}
}
ctb.closePath();
// c区
function c_Tab(x,y,type){
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), tab_c*(y-1), tab_c, tab_c);
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
}
ctb.beginPath();
ctb.lineWidth = 1;
ctb.arc(tab_c*x_z, tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.stroke();
}
// d区
function d_Tab(x,y,type){
var d_y=Tab_w*tab_b_cols/2,
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), d_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 0.2;
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
ctb.fillStyle='#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
ctb.fillStyle='#ff0000';
}
ctb.arc(tab_c*x_z, d_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.fill();
ctb.stroke();
}
// e区
function e_Tab(x,y,type){
var d_x=20*Tab_w,
linewidth=Tab_w/3;
x_z=x-0.2,
y_z=y-0.2,
tab_d_x=Tab_w/2;
ctb.clearRect(d_x+tab_d_x*(x-1), tab_d_x*(y-1), tab_d_x, tab_d_x);
ctb.beginPath();
ctb.lineCap = "butt";
ctb.lineWidth = 2;//线条宽度
//线条颜色
if(type=="1"){
ctb.strokeStyle = '#331a98';
}else if(type=="2"){
ctb.strokeStyle = '#fd2203';
}
ctb.moveTo(d_x+tab_d_x*x_z,linewidth+tab_d_x*y_z-Tab_w*0.3);
ctb.lineTo(d_x-linewidth+tab_d_x*x_z,tab_d_x*y_z-Tab_w*0.3);
ctb.stroke();
}
function twinkle(ctb,twinkledata){
var b=10,
bigEyeRoad=twinkledata.bigEyeRoad.show_location,
pathway=twinkledata.pathway.show_location,
roach=twinkledata.roach.show_location
num2=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num2);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
//
if(bigEyeRoad!=undefined){
var bigEyeRoadlength=bigEyeRoad.length-1
if(bigEyeRoad[bigEyeRoadlength].result=="blue"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,1)
}else if(bigEyeRoad[bigEyeRoadlength].result=="red"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,2)
}
}
if(pathway!=undefined){
var pathwaylength=pathway.length-1
if(pathway[pathwaylength].result=="blue"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,1)
}else if(pathway[pathwaylength].result=="red"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,2)
}
}
if(roach!=undefined){
var roachlength=roach.length-1
if(roach[roachlength].result=="blue"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,1)
}else if(roach[roachlength].result=="red"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,2)
}
}
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas3(show_x,show_y,type,corners,twinkledata){
var canvaswidth= $(".baccarat_head").width()*0.5;
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single3'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=20,
tab_rows=6,
tab_x=tab_width/tab_cols
tab_y=tab_x,
tab_height=tab_y*tab_rows
$("#single3").attr("height",tab_height+1)
$("#single3").attr("width",canvaswidth+0.5)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,tab_x);
if(twinkledata!=undefined){
var showRoads=twinkledata.showRoad.show_location
showRoadlength=showRoads.length-1
twinkle(ctb,showRoads[showRoadlength].show_x,showRoads[showRoadlength].show_y,showRoads[showRoadlength].result,showRoads[showRoadlength].pair);
}
var show_x=show_x,
show_y=show_y;
type=type
if(show_x!=""||undefined){
Tab(show_x,show_y,type,corners);
}
var waybill = ludan;
if(!waybill) return false;
var showRoad = waybill.showRoad;
// 展示路的路单显示
if(showRoad != undefined && showRoad.show_location != undefined){
for(var i=0; i<showRoad.show_location.length; i++){
if(showRoad.show_location[i].result == "banker"){
// 展示路
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',5);
}
}
if(showRoad.show_location[i].result == "player"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',5);
}
}
if(showRoad.show_location[i].result == "tie"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',5);
}
}
}
}
ctb.closePath();
function Tab(x,y,type,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
var x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_x*(x-1), tab_x*(y-1), tab_x, tab_x);
if(type=="banker"){
var color='#e12217',
fonts='庄';
}else if(type=="player"){
var color='#0030ff',
fonts='闲';
}else if(type=="tie"){
var color='#27cf00',
fonts='和';
}
ctb.arc(tab_x*x_z, tab_x*y_z, tab_x*0.45, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
Font_Size =Math.floor(tab_x/1.8)+"px Arial"
ctb.font=Font_Size;
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,tab_x*x_z,tab_x*y_z);
ctb.stroke();
var corner_xy=tab_x/3.2
if(corners=="1"){
corner(x_z,y_z,corner_xy,'#1944ff');
}else if(corners=="2"){
corner(x_z,y_z,-corner_xy,'#1944ff');
}else if(corners=="3"){
corner(x_z,y_z,corner_xy,'#ff2202');
}else if(corners=="4"){
corner(x_z,y_z,-corner_xy,'#ff2202');
}else if(corners=="5"){
corner(x_z,y_z,corner_xy,'#ff2202');
corner(x_z,y_z,-corner_xy,'#1944ff');
}
}
// a区角标
function corner(x_z,y_z,corner_xy,corner_color){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
ctb.arc(tab_x*x_z-corner_xy, tab_x*y_z-corner_xy, tab_x*0.14, 0, Math.PI * 2);
ctb.fillStyle=corner_color;
ctb.fill();
ctb.stroke();
}
function twinkle(ctb,show_x,show_y,result,pair){
var b=10
num3=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num3);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
// Tab(1,1,"banker",2)
Tab(show_x,show_y,result)
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
/* 时钟 */
function startTime(){
var today=new Date();
var yyyy = today.getFullYear();
var MM = today.getMonth()+1;
var dd = today.getDate();
var hh=today.getHours();
var mm=today.getMinutes();
var ss=today.getSeconds();
MM=checkTime(MM);
dd=checkTime(dd);
mm=checkTime(mm);
ss=checkTime(ss);
var day;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
$('#nowDateSpan').html( yyyy+"-"+MM +"-"+ dd);
$('#nowTimeSpan').html(hh+":"+mm+":"+ss);
$('#nowWeekSpan').html(day);
setTimeout('startTime()',1000);
}
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
/* 时钟 end */
function canvasbg(ctb,CanvasId,tab_width,tab_height,tab_rows,tab_cols,Tab_w) {
ctb.beginPath();
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#999";
ctb.moveTo(0, 0.5);
ctb.lineTo(tab_width, 0.5);
for (var col = 1; col <= tab_rows; col++) {
var y = col * Tab_w;
ctb.moveTo(0,y-0.5);
ctb.lineTo(tab_width,y-0.5);
}
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, tab_height);
for (var row = 1; row <= tab_cols; row++) {
var x = row * Tab_w;
ctb.moveTo(x-0.5,0);
ctb.lineTo(x-0.5,tab_height);
}
ctb.stroke();
var image = new Image();
image.src = CanvasId.toDataURL("image/png");
CanvasId.style.backgroundImage = 'url(' + image.src +')';
ctb.clearRect(0, 0, 10000, 10000);
}
function audio(url){
var mp3="../static/index/mp3/"+url;
var audiohtml= '<audio style="visibility: hidden;" id="chatAudio"><source src="'+mp3+'" type="audio/mpeg"></audio>'
$(audiohtml).appendTo('body');
$("#chatAudio")[0].play()
setTimeout(function(){
$("#chatAudio").remove();
},1000);
}
+680
View File
@@ -0,0 +1,680 @@
var getOnlineNumber = function (connections){
var query = new Object();
query.connections = connections;
$.ajax({
url:'/index/get_online_number',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
$('#onlineNumber').html(data.data);
}
}
});
}
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/index/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
$('#result_total_tie').html(resultToatl.tie);
}
}
});
}
var showPng = function (opening){
if(opening == 1) $('#openingPng').attr('src','/static/console/img/dragon.png');
if(opening == 2) $('#openingPng').attr('src','/static/console/img/tiger.png');
if(opening == 3) $('#openingPng').attr('src','/static/console/img/tie.png');
$('#openingElement').show().delay(1000).hide(300);
}
$(document).on("click","#next_banker",function(){
var next = new Object;
next.result = 'banker';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
$(document).on("click","#next_player",function(){
var next = new Object;
next.result = 'player';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.result = "allData";
data.table = TableId;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
// 将数据结果存session
ludan = data;
// 执行画布刷新
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
}
});
}
$(window).resize(function(){
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
});
// canvas 路单
function resizeCanvas(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single1'),
ctb=table.getContext('2d');
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
Tab_w=tab_width/tab_cols
tab_height=Tab_w*tab_rows||183
Font_Size =Math.floor(Tab_w/1.8)+"px Arial"
Font_Size_s=Math.floor(Tab_w/2.8)+"px Arial"
$("#single1").attr("height",tab_height+0.4)
$("#single1").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
if(twinkledata!=undefined){
var twin=twinkledata.bigRoad.show_location,
twinlength=twin.length-1
twinkle(ctb,twin[twinlength].show_x,twin[twinlength].show_y,twin[twinlength].result);
}
// 获取本地session里的路单数据
var waybill = ludan;
if(waybill == false) return false;
var bigRoad = waybill.bigRoad;
var showRoad = waybill.showRoad;
// 第一局为和,大路展示
if(showRoad != undefined && showRoad.show_location != undefined && showRoad.first_tie_num != undefined && showRoad.first_tie_num > 0){
b_Tie(showRoad.first_tie_num);
}
// 大路路单展示
if( bigRoad != undefined && bigRoad.show_location != undefined){
for(var i=0; i<bigRoad.show_location.length; i++){
//庄赢
if(bigRoad.show_location[i].result == "banker"){
// 判断是否有和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2);
}
}
// 闲赢
if(bigRoad.show_location[i].result == "player"){
// 判断是否是和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1);
}
}
// 和
if(bigRoad.show_location[i].tie_num > 0){
if(bigRoad.first_tie_num != undefined && bigRoad.first_tie_num == 1 && i == 0){
b_Tie(bigRoad.show_location[i].tie_num)
}else{
if(bigRoad.show_location[i].result == 'banker'){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}
}
}
}
}
ctb.closePath();
// 局数 数,文字X坐标,文字Y坐标,文字大小风格
function Font_tie(num,Font_x,Font_y,fontsize){
if(num!==undefined){
ctb.beginPath();
ctb.font=fontsize;
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillStyle ="#000" ;
ctb.fillText(num,Font_x,Font_y);
ctb.stroke();
}
}
function b_Tab(x,y,type,slash,order){
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(Tab_w*x_z-Tab_w/2.1, Tab_w*y_z-Tab_w/2.1, Tab_w*0.9, Tab_w*0.9);
if(type=="1"){
var color="#331a98";
}else if(type=="2"){
var color="#fb2603"
}
ctb.beginPath();
ctb.lineWidth = 1.5;
ctb.strokeStyle = color;
ctb.arc(Tab_w*x_z-0.5, Tab_w*y_z-0.5, Tab_w*0.38, 0, Math.PI * 2);
ctb.stroke();
if(slash=="1"){
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 2;//线条宽度
ctb.lineCap = "round";
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.moveTo(x_z*Tab_w-linewidth,Tab_w*y_z+linewidth);
ctb.lineTo(x_z*Tab_w+linewidth,Tab_w*y_z-linewidth);
ctb.stroke();
Font_tie(order,Tab_w*x_z, Tab_w*y_z,Font_Size);
}
}
// b区第一局 和
function b_Tie(order){
ctb.clearRect(Tab_w/20, 1, Tab_w*0.9, Tab_w*0.9);
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 3.5;//线条宽度
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.lineCap = "round";
ctb.moveTo(Tab_w/20,Tab_w/2);
ctb.lineTo(Tab_w*0.9,Tab_w/2);
ctb.stroke();
Font_tie(order,Tab_w/2, Tab_w/2,Font_Size);
}
// 问路
function twinkle(ctb,show_x,show_y,result){
var b=10
num1=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num1);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
if(result=="banker"){
b_Tab(show_x,show_y,2)
}else if(result=="player"){
b_Tab(show_x,show_y,1)
}
// // 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas2(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single2'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
tab_b_cols = 6,
Tab_w=tab_width/tab_cols,
tab_height=Tab_w*tab_rows||183;
$("#single2").attr("height",tab_height+0.8)
$("#single2").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
var waybill = ludan;
if(!waybill) return false;
var bigEyeRoad = waybill.bigEyeRoad; // 大眼路数据
var pathway = waybill.pathway; // 小路数据
var roach = waybill.roach;
// 小强路数据
if(twinkledata!=undefined){
twinkle(ctb,twinkledata);
}
// 大眼路数据
if(bigEyeRoad != undefined && bigEyeRoad.show_location != undefined){
for(var i=0; i<bigEyeRoad.show_location.length; i++){
// 红圈
if(bigEyeRoad.show_location[i].result == 'red'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,2);
}
// 蓝圈
if(bigEyeRoad.show_location[i].result == 'blue'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,1);
}
}
}
// 小路数据
if(pathway != undefined && pathway.show_location != undefined){
for(var i=0; i<pathway.show_location.length; i++){
// 红圈
if(pathway.show_location[i].result == 'red'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,2);
}
// 蓝圈
if(pathway.show_location[i].result == 'blue'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,1);
}
}
}
// 小强路数据
if(roach != undefined && roach.show_location != undefined){
for(var i=0; i<roach.show_location.length; i++){
// 红圈
if(roach.show_location[i].result == 'red'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,2);
}
// 蓝圈
if(roach.show_location[i].result == 'blue'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,1);
}
}
}
ctb.closePath();
// c区
function c_Tab(x,y,type){
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), tab_c*(y-1), tab_c, tab_c);
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
}
ctb.beginPath();
ctb.lineWidth = 1;
ctb.arc(tab_c*x_z, tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.stroke();
}
// d区
function d_Tab(x,y,type){
var d_y=Tab_w*tab_b_cols/2,
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), d_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 0.2;
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
ctb.fillStyle='#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
ctb.fillStyle='#ff0000';
}
ctb.arc(tab_c*x_z, d_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.fill();
ctb.stroke();
}
// e区
function e_Tab(x,y,type){
var d_x=20*Tab_w,
linewidth=Tab_w/3;
x_z=x-0.2,
y_z=y-0.2,
tab_d_x=Tab_w/2;
ctb.clearRect(d_x+tab_d_x*(x-1), tab_d_x*(y-1), tab_d_x, tab_d_x);
ctb.beginPath();
ctb.lineCap = "butt";
ctb.lineWidth = 2;//线条宽度
//线条颜色
if(type=="1"){
ctb.strokeStyle = '#331a98';
}else if(type=="2"){
ctb.strokeStyle = '#fd2203';
}
ctb.moveTo(d_x+tab_d_x*x_z,linewidth+tab_d_x*y_z-Tab_w*0.3);
ctb.lineTo(d_x-linewidth+tab_d_x*x_z,tab_d_x*y_z-Tab_w*0.3);
ctb.stroke();
}
function twinkle(ctb,twinkledata){
var b=10,
bigEyeRoad=twinkledata.bigEyeRoad.show_location,
pathway=twinkledata.pathway.show_location,
roach=twinkledata.roach.show_location
num2=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num2);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
//
if(bigEyeRoad!=undefined){
var bigEyeRoadlength=bigEyeRoad.length-1
if(bigEyeRoad[bigEyeRoadlength].result=="blue"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,1)
}else if(bigEyeRoad[bigEyeRoadlength].result=="red"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,2)
}
}
if(pathway!=undefined){
var pathwaylength=pathway.length-1
if(pathway[pathwaylength].result=="blue"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,1)
}else if(pathway[pathwaylength].result=="red"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,2)
}
}
if(roach!=undefined){
var roachlength=roach.length-1
if(roach[roachlength].result=="blue"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,1)
}else if(roach[roachlength].result=="red"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,2)
}
}
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas3(show_x,show_y,type,corners,twinkledata){
var canvaswidth= $(".baccarat_head").width()*0.5;
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single3'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=20,
tab_rows=6,
tab_x=tab_width/tab_cols
tab_y=tab_x,
tab_height=tab_y*tab_rows
$("#single3").attr("height",tab_height+1)
$("#single3").attr("width",canvaswidth+0.5)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,tab_x);
if(twinkledata!=undefined){
var showRoads=twinkledata.showRoad.show_location
showRoadlength=showRoads.length-1
twinkle(ctb,showRoads[showRoadlength].show_x,showRoads[showRoadlength].show_y,showRoads[showRoadlength].result,showRoads[showRoadlength].pair);
}
var show_x=show_x,
show_y=show_y;
type=type
if(show_x!=""||undefined){
Tab(show_x,show_y,type,corners);
}
var waybill = ludan;
if(!waybill) return false;
var showRoad = waybill.showRoad;
// 展示路的路单显示
if(showRoad != undefined && showRoad.show_location != undefined){
for(var i=0; i<showRoad.show_location.length; i++){
if(showRoad.show_location[i].result == "banker"){
// 展示路
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',5);
}
}
if(showRoad.show_location[i].result == "player"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',5);
}
}
if(showRoad.show_location[i].result == "tie"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',5);
}
}
}
}
ctb.closePath();
function Tab(x,y,type,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
var x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_x*(x-1), tab_x*(y-1), tab_x, tab_x);
if(type=="banker"){
var color='#e12217',
fonts='龙';
}else if(type=="player"){
var color='#0030ff',
fonts='虎';
}else if(type=="tie"){
var color='#27cf00',
fonts='和';
}
ctb.arc(tab_x*x_z, tab_x*y_z, tab_x*0.45, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
Font_Size =Math.floor(tab_x/1.8)+"px Arial"
ctb.font=Font_Size;
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,tab_x*x_z,tab_x*y_z);
ctb.stroke();
var corner_xy=tab_x/3.2
if(corners=="1"){
corner(x_z,y_z,corner_xy,'#1944ff');
}else if(corners=="2"){
corner(x_z,y_z,-corner_xy,'#1944ff');
}else if(corners=="3"){
corner(x_z,y_z,corner_xy,'#ff2202');
}else if(corners=="4"){
corner(x_z,y_z,-corner_xy,'#ff2202');
}else if(corners=="5"){
corner(x_z,y_z,corner_xy,'#ff2202');
corner(x_z,y_z,-corner_xy,'#1944ff');
}
}
// a区角标
function corner(x_z,y_z,corner_xy,corner_color){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
ctb.arc(tab_x*x_z-corner_xy, tab_x*y_z-corner_xy, tab_x*0.14, 0, Math.PI * 2);
ctb.fillStyle=corner_color;
ctb.fill();
ctb.stroke();
}
function twinkle(ctb,show_x,show_y,result,pair){
var b=10
num3=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num3);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
// Tab(1,1,"banker",2)
Tab(show_x,show_y,result)
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
/* 时钟 */
function startTime(){
var today=new Date();
var yyyy = today.getFullYear();
var MM = today.getMonth()+1;
var dd = today.getDate();
var hh=today.getHours();
var mm=today.getMinutes();
var ss=today.getSeconds();
MM=checkTime(MM);
dd=checkTime(dd);
mm=checkTime(mm);
ss=checkTime(ss);
var day;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
$('#nowDateSpan').html( yyyy+"-"+MM +"-"+ dd);
$('#nowTimeSpan').html(hh+":"+mm+":"+ss);
$('#nowWeekSpan').html(day);
setTimeout('startTime()',1000);
}
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
/* 时钟 end */
function canvasbg(ctb,CanvasId,tab_width,tab_height,tab_rows,tab_cols,Tab_w) {
ctb.beginPath();
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#999";
ctb.moveTo(0, 0.5);
ctb.lineTo(tab_width, 0.5);
for (var col = 1; col <= tab_rows; col++) {
var y = col * Tab_w;
ctb.moveTo(0,y-0.5);
ctb.lineTo(tab_width,y-0.5);
}
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, tab_height);
for (var row = 1; row <= tab_cols; row++) {
var x = row * Tab_w;
ctb.moveTo(x-0.5,0);
ctb.lineTo(x-0.5,tab_height);
}
ctb.stroke();
var image = new Image();
image.src = CanvasId.toDataURL("image/png");
CanvasId.style.backgroundImage = 'url(' + image.src +')';
ctb.clearRect(0, 0, 10000, 10000);
}
+669
View File
@@ -0,0 +1,669 @@
/* 键盘操作 */
$(document).keydown(function (e){
if(e.keyCode == 13){
opening();
}
if(e.keyCode == 97){
$('#opening').val('1');
}
if(e.keyCode == 98){
$('#opening').val('2');
}
if(e.keyCode == 99){
$('#opening').val('3');
}
if(e.keyCode == 100){
$('#result_banker_pair').val('1');
}
if(e.keyCode == 101){
$('#result_player_pair').val('2');
}
if(e.keyCode == 107){
startBet();
}
})
/* 键盘操作 end */
$(document).on("click","#next_banker",function(){
var next = new Object;
next.result = 'banker';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
$(document).on("click","#next_player",function(){
var next = new Object;
next.result = 'player';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.result = "allData";
data.table = TableId;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
// 将数据结果存session
ludan = data;
// 执行画布刷新
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
}
});
}
$(window).resize(function(){
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
});
// canvas 路单
function resizeCanvas(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single1'),
ctb=table.getContext('2d');
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
Tab_w=tab_width/tab_cols
tab_height=Tab_w*tab_rows||183
Font_Size =Math.floor(Tab_w/1.8)+"px Arial"
Font_Size_s=Math.floor(Tab_w/2.8)+"px Arial"
$("#single1").attr("height",tab_height+0.4)
$("#single1").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
if(twinkledata!=undefined){
var twin=twinkledata.bigRoad.show_location,
twinlength=twin.length-1
twinkle(ctb,twin[twinlength].show_x,twin[twinlength].show_y,twin[twinlength].result);
}
// 获取本地session里的路单数据
var waybill = ludan;
if(waybill == false) return false;
var bigRoad = waybill.bigRoad;
var showRoad = waybill.showRoad;
// 第一局为和,大路展示
if(showRoad != undefined && showRoad.show_location != undefined && showRoad.first_tie_num != undefined && showRoad.first_tie_num > 0){
b_Tie(showRoad.first_tie_num);
}
// 大路路单展示
if( bigRoad != undefined && bigRoad.show_location != undefined){
for(var i=0; i<bigRoad.show_location.length; i++){
//庄赢
if(bigRoad.show_location[i].result == "banker"){
// 判断是否有和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2);
}
}
// 闲赢
if(bigRoad.show_location[i].result == "player"){
// 判断是否是和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1);
}
}
// 和
if(bigRoad.show_location[i].result == "tie"){
b_Tab(false,bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,tie_num)
}
}
}
ctb.closePath();
// 局数 数,文字X坐标,文字Y坐标,文字大小风格
function Font_tie(num,Font_x,Font_y,fontsize){
if(num!==undefined){
ctb.beginPath();
ctb.font=fontsize;
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillStyle ="#000" ;
ctb.fillText(num,Font_x,Font_y);
ctb.stroke();
}
}
function b_Tab(x,y,type,slash,order){
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(Tab_w*x_z-Tab_w/2.1, Tab_w*y_z-Tab_w/2.1, Tab_w*0.9, Tab_w*0.9);
if(type=="1"){
var color="#331a98";
}else if(type=="2"){
var color="#fb2603"
}
ctb.beginPath();
ctb.lineWidth = 1.5;
ctb.strokeStyle = color;
ctb.arc(Tab_w*x_z-0.5, Tab_w*y_z-0.5, Tab_w*0.38, 0, Math.PI * 2);
ctb.stroke();
if(slash=="1"){
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 2;//线条宽度
ctb.lineCap = "round";
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.moveTo(x_z*Tab_w-linewidth,Tab_w*y_z+linewidth);
ctb.lineTo(x_z*Tab_w+linewidth,Tab_w*y_z-linewidth);
ctb.stroke();
Font_tie(order,Tab_w*x_z, Tab_w*y_z,Font_Size);
}
}
// b区第一局 和
function b_Tie(order){
ctb.clearRect(Tab_w/20, 1, Tab_w*0.9, Tab_w*0.9);
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 3.5;//线条宽度
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.lineCap = "round";
ctb.moveTo(Tab_w/20,Tab_w/2);
ctb.lineTo(Tab_w*0.9,Tab_w/2);
ctb.stroke();
Font_tie(order,Tab_w/2, Tab_w/2,Font_Size);
}
// 问路
function twinkle(ctb,show_x,show_y,result){
var b=10
num1=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num1);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
if(result=="banker"){
b_Tab(show_x,show_y,2)
}else if(result=="player"){
b_Tab(show_x,show_y,1)
}
// // 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas2(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single2'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
tab_b_cols = 6,
Tab_w=tab_width/tab_cols,
tab_height=Tab_w*tab_rows||183;
$("#single2").attr("height",tab_height+0.8)
$("#single2").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
var waybill = ludan;
if(!waybill) return false;
var bigEyeRoad = waybill.bigEyeRoad; // 大眼路数据
var pathway = waybill.pathway; // 小路数据
var roach = waybill.roach;
// 小强路数据
if(twinkledata!=undefined){
twinkle(ctb,twinkledata);
}
// 大眼路数据
if(bigEyeRoad != undefined && bigEyeRoad.show_location != undefined){
for(var i=0; i<bigEyeRoad.show_location.length; i++){
// 红圈
if(bigEyeRoad.show_location[i].result == 'red'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,2);
}
// 蓝圈
if(bigEyeRoad.show_location[i].result == 'blue'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,1);
}
}
}
// 小路数据
if(pathway != undefined && pathway.show_location != undefined){
for(var i=0; i<pathway.show_location.length; i++){
// 红圈
if(pathway.show_location[i].result == 'red'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,2);
}
// 蓝圈
if(pathway.show_location[i].result == 'blue'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,1);
}
}
}
// 小强路数据
if(roach != undefined && roach.show_location != undefined){
for(var i=0; i<roach.show_location.length; i++){
// 红圈
if(roach.show_location[i].result == 'red'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,2);
}
// 蓝圈
if(roach.show_location[i].result == 'blue'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,1);
}
}
}
ctb.closePath();
// c区
function c_Tab(x,y,type){
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), tab_c*(y-1), tab_c, tab_c);
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
}
ctb.beginPath();
ctb.lineWidth = 1;
ctb.arc(tab_c*x_z, tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.stroke();
}
// d区
function d_Tab(x,y,type){
var d_y=Tab_w*tab_b_cols/2,
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), d_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 0.2;
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
ctb.fillStyle='#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
ctb.fillStyle='#ff0000';
}
ctb.arc(tab_c*x_z, d_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.fill();
ctb.stroke();
}
// e区
function e_Tab(x,y,type){
var d_x=20*Tab_w,
linewidth=Tab_w/3;
x_z=x-0.2,
y_z=y-0.2,
tab_d_x=Tab_w/2;
ctb.clearRect(d_x+tab_d_x*(x-1), tab_d_x*(y-1), tab_d_x, tab_d_x);
ctb.beginPath();
ctb.lineCap = "butt";
ctb.lineWidth = 2;//线条宽度
//线条颜色
if(type=="1"){
ctb.strokeStyle = '#331a98';
}else if(type=="2"){
ctb.strokeStyle = '#fd2203';
}
ctb.moveTo(d_x+tab_d_x*x_z,linewidth+tab_d_x*y_z-Tab_w*0.3);
ctb.lineTo(d_x-linewidth+tab_d_x*x_z,tab_d_x*y_z-Tab_w*0.3);
ctb.stroke();
}
function twinkle(ctb,twinkledata){
var b=10,
bigEyeRoad=twinkledata.bigEyeRoad.show_location,
pathway=twinkledata.pathway.show_location,
roach=twinkledata.roach.show_location
num2=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num2);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
//
if(bigEyeRoad!=undefined){
var bigEyeRoadlength=bigEyeRoad.length-1
if(bigEyeRoad[bigEyeRoadlength].result=="blue"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,1)
}else if(bigEyeRoad[bigEyeRoadlength].result=="red"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,1)
}
}
if(pathway!=undefined){
var pathwaylength=pathway.length-1
if(pathway[pathwaylength].result=="blue"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,1)
}else if(pathway[pathwaylength].result=="red"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,1)
}
}
if(roach!=undefined){
var roachlength=roach.length-1
if(roach[roachlength].result=="blue"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,1)
}else if(roach[roachlength].result=="red"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,1)
}
}
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas3(show_x,show_y,type,corners,twinkledata){
var canvaswidth= $(".baccarat_head").width()*0.5;
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single3'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=20,
tab_rows=6,
tab_x=tab_width/tab_cols
tab_y=tab_x,
tab_height=tab_y*tab_rows
$("#single3").attr("height",tab_height+1)
$("#single3").attr("width",canvaswidth+0.5)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,tab_x);
if(twinkledata!=undefined){
var showRoads=twinkledata.showRoad.show_location
showRoadlength=showRoads.length-1
twinkle(ctb,showRoads[showRoadlength].show_x,showRoads[showRoadlength].show_y,showRoads[showRoadlength].result,showRoads[showRoadlength].pair);
}
var show_x=show_x,
show_y=show_y;
type=type
if(show_x!=""||undefined){
Tab(show_x,show_y,type,corners);
}
var waybill = ludan;
if(!waybill) return false;
var showRoad = waybill.showRoad;
// 展示路的路单显示
if(showRoad != undefined && showRoad.show_location != undefined){
for(var i=0; i<showRoad.show_location.length; i++){
if(showRoad.show_location[i].result == "banker"){
// 展示路
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',5);
}
}
if(showRoad.show_location[i].result == "player"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',5);
}
}
if(showRoad.show_location[i].result == "tie"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',5);
}
}
}
}
ctb.closePath();
function Tab(x,y,type,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
var x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_x*(x-1), tab_x*(y-1), tab_x, tab_x);
if(type=="banker"){
var color='#e12217',
fonts='庄';
}else if(type=="player"){
var color='#0030ff',
fonts='闲';
}else if(type=="tie"){
var color='#27cf00',
fonts='和';
}
ctb.arc(tab_x*x_z, tab_x*y_z, tab_x*0.45, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
Font_Size =Math.floor(tab_x/1.8)+"px Arial"
ctb.font=Font_Size;
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,tab_x*x_z,tab_x*y_z);
ctb.stroke();
var corner_xy=tab_x/3.2
if(corners=="1"){
corner(x_z,y_z,corner_xy,'#1944ff');
}else if(corners=="2"){
corner(x_z,y_z,-corner_xy,'#1944ff');
}else if(corners=="3"){
corner(x_z,y_z,corner_xy,'#ff2202');
}else if(corners=="4"){
corner(x_z,y_z,-corner_xy,'#ff2202');
}else if(corners=="5"){
corner(x_z,y_z,corner_xy,'#ff2202');
corner(x_z,y_z,-corner_xy,'#1944ff');
}
}
// a区角标
function corner(x_z,y_z,corner_xy,corner_color){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
ctb.arc(tab_x*x_z-corner_xy, tab_x*y_z-corner_xy, tab_x*0.14, 0, Math.PI * 2);
ctb.fillStyle=corner_color;
ctb.fill();
ctb.stroke();
}
function twinkle(ctb,show_x,show_y,result,pair){
var b=10
num3=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num3);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
// Tab(1,1,"banker",2)
Tab(show_x,show_y,result)
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
/* 时钟 */
function startTime(){
var today=new Date();
var yyyy = today.getFullYear();
var MM = today.getMonth()+1;
var dd = today.getDate();
var hh=today.getHours();
var mm=today.getMinutes();
var ss=today.getSeconds();
MM=checkTime(MM);
dd=checkTime(dd);
mm=checkTime(mm);
ss=checkTime(ss);
var day;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
$('#nowDateSpan').html( yyyy+"-"+MM +"-"+ dd);
$('#nowTimeSpan').html(hh+":"+mm+":"+ss);
$('#nowWeekSpan').html(day);
setTimeout('startTime()',1000);
}
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
/* 时钟 end */
function canvasbg(ctb,CanvasId,tab_width,tab_height,tab_rows,tab_cols,Tab_w) {
ctb.beginPath();
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#999";
ctb.moveTo(0, 0.5);
ctb.lineTo(tab_width, 0.5);
for (var col = 1; col <= tab_rows; col++) {
var y = col * Tab_w;
ctb.moveTo(0,y-0.5);
ctb.lineTo(tab_width,y-0.5);
}
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, tab_height);
for (var row = 1; row <= tab_cols; row++) {
var x = row * Tab_w;
ctb.moveTo(x-0.5,0);
ctb.lineTo(x-0.5,tab_height);
}
ctb.stroke();
var image = new Image();
image.src = CanvasId.toDataURL("image/png");
CanvasId.style.backgroundImage = 'url(' + image.src +')';
ctb.clearRect(0, 0, 10000, 10000);
}
function audio(url){
var mp3="../static/index/mp3/"+url;
var audiohtml= '<audio style="visibility: hidden;" id="chatAudio"><source src="'+mp3+'" type="audio/mpeg"></audio>'
$(audiohtml).appendTo('body');
$("#chatAudio")[0].play()
setTimeout(function(){
$("#chatAudio").remove();
},1000);
}
+236
View File
@@ -0,0 +1,236 @@
/* @license
* jQuery.print, version 1.3.2
* (c) Sathvik Ponangi, Doers' Guild
* Licence: CC-By (http://creativecommons.org/licenses/by/3.0/)
*--------------------------------------------------------------------------*/
(function ($) {
"use strict";
// A nice closure for our definitions
function getjQueryObject(string) {
// Make string a vaild jQuery thing
var jqObj = $("");
try {
jqObj = $(string)
.clone();
} catch (e) {
jqObj = $("<span />")
.html(string);
}
return jqObj;
}
function printFrame(frameWindow) {
// Print the selected window/iframe
var def = $.Deferred();
try {
setTimeout(function () {
// Fix for IE : Allow it to render the iframe
frameWindow.focus();
try {
// Fix for IE11 - printng the whole page instead of the iframe content
if (!frameWindow.document.execCommand('print', false, null)) {
// document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891
frameWindow.print();
}
} catch (e) {
frameWindow.print();
}
frameWindow.close();
def.resolve();
}, 250);
} catch (err) {
def.reject(err);
}
return def;
}
function printContentInNewWindow(content) {
// Open a new window and print selected content
var w = window.open();
w.document.write(content);
w.document.close();
return printFrame(w);
}
function isNode(o) {
/* http://stackoverflow.com/a/384380/937891 */
return !!(typeof Node === "object" ? o instanceof Node : o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string");
}
$.print = $.fn.print = function () {
// Print a given set of elements
var options, $this, self = this;
// console.log("Printing", this, arguments);
if (self instanceof $) {
// Get the node if it is a jQuery object
self = self.get(0);
}
if (isNode(self)) {
// If `this` is a HTML element, i.e. for
// $(selector).print()
$this = $(self);
if (arguments.length > 0) {
options = arguments[0];
}
} else {
if (arguments.length > 0) {
// $.print(selector,options)
$this = $(arguments[0]);
if (isNode($this[0])) {
if (arguments.length > 1) {
options = arguments[1];
}
} else {
// $.print(options)
options = arguments[0];
$this = $("html");
}
} else {
// $.print()
$this = $("html");
}
}
// Default options
var defaults = {
globalStyles: true,
mediaPrint: false,
stylesheet: null,
noPrintSelector: ".no-print",
iframe: true,
append: null,
prepend: null,
manuallyCopyFormValues: true,
deferred: $.Deferred()
};
// Merge with user-options
options = $.extend({}, defaults, (options || {}));
var $styles = $("");
if (options.globalStyles) {
// Apply the stlyes from the current sheet to the printed page
$styles = $("style, link, meta, title");
} else if (options.mediaPrint) {
// Apply the media-print stylesheet
$styles = $("link[media=print]");
}
if (options.stylesheet) {
// Add a custom stylesheet if given
$styles = $.merge($styles, $('<link rel="stylesheet" href="' + options.stylesheet + '">'));
}
// Create a copy of the element to print
var copy = $this.clone();
// Wrap it in a span to get the HTML markup string
copy = $("<span/>")
.append(copy);
// Remove unwanted elements
copy.find(options.noPrintSelector)
.remove();
// Add in the styles
copy.append($styles.clone());
// Appedned content
copy.append(getjQueryObject(options.append));
// Prepended content
copy.prepend(getjQueryObject(options.prepend));
if (options.manuallyCopyFormValues) {
// Manually copy form values into the HTML for printing user-modified input fields
// http://stackoverflow.com/a/26707753
copy.find("input")
.each(function () {
var $field = $(this);
if ($field.is("[type='radio']") || $field.is("[type='checkbox']")) {
if ($field.prop("checked")) {
$field.attr("checked", "checked");
}
} else {
$field.attr("value", $field.val());
}
});
copy.find("select").each(function () {
var $field = $(this);
$field.find(":selected").attr("selected", "selected");
});
copy.find("textarea").each(function () {
// Fix for https://github.com/DoersGuild/jQuery.print/issues/18#issuecomment-96451589
var $field = $(this);
$field.text($field.val());
});
}
// Get the HTML markup string
var content = copy.html();
// Notify with generated markup & cloned elements - useful for logging, etc
try {
options.deferred.notify('generated_markup', content, copy);
} catch (err) {
console.warn('Error notifying deferred', err);
}
// Destroy the copy
copy.remove();
if (options.iframe) {
// Use an iframe for printing
try {
var $iframe = $(options.iframe + "");
var iframeCount = $iframe.length;
if (iframeCount === 0) {
// Create a new iFrame if none is given
$iframe = $('<iframe height="0" width="0" border="0" wmode="Opaque"/>')
.prependTo('body')
.css({
"position": "absolute",
"top": -999,
"left": -999
});
}
var w, wdoc;
w = $iframe.get(0);
w = w.contentWindow || w.contentDocument || w;
wdoc = w.document || w.contentDocument || w;
wdoc.open();
wdoc.write(content);
wdoc.close();
printFrame(w)
.done(function () {
// Success
setTimeout(function () {
// Wait for IE
if (iframeCount === 0) {
// Destroy the iframe if created here
$iframe.remove();
}
}, 100);
})
.fail(function (err) {
// Use the pop-up method if iframe fails for some reason
console.error("Failed to print from iframe", err);
printContentInNewWindow(content);
})
.always(function () {
try {
options.deferred.resolve();
} catch (err) {
console.warn('Error notifying deferred', err);
}
});
} catch (e) {
// Use the pop-up method if iframe fails for some reason
console.error("Failed to print from iframe", e.stack, e.message);
printContentInNewWindow(content)
.always(function () {
try {
options.deferred.resolve();
} catch (err) {
console.warn('Error notifying deferred', err);
}
});
}
} else {
// Use a new window for printing
printContentInNewWindow(content)
.always(function () {
try {
options.deferred.resolve();
} catch (err) {
console.warn('Error notifying deferred', err);
}
});
}
return this;
};
})(jQuery);
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+1508
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+841
View File
@@ -0,0 +1,841 @@
var smallH=0,smallW=0,bigH=0,bigW=0;
var unitsmall=0,unitbig=0,colsmall=0,colbig=0;
var roll=0;LiWidth=0;
var BetStatus;
var askData = false;
$(function(){
$(window).resize(function(){
requestData(ludan);
})
requestData(ludan);
getTime();
// 滚动广告
$(".notice ul li").each(function(){
LiWidth+=$(this).innerWidth()
})
$(".notice ul").append($(".notice ul").html())
var timer = setInterval(notice, 20);
$(".notice").hover(function() {
clearInterval(timer);
},function() {
timer = setInterval(notice, 20);
})
// 日期
setInterval(function(){
getTime();
}, 1000);
// 侧栏控台
$(".control-box").hover(function(){
$(this).stop().animate({right:"0"})
},function(){
$(this).stop().animate({right:"-410px"})
})
/* 键盘操作 */
$(document).keydown(function (e){
//alert(e.keyCode);
//return false;
if(e.keyCode == 98){
$('#times').val('2');
}
if(e.keyCode == 99){
$('#times').val('3');
}
if(e.keyCode == 100){
$('#times').val('4');
}
if(e.keyCode == 101){
$('#times').val('5');
}
if(e.keyCode == 13){
opening();
}
if(e.keyCode == 97){
$('#opening').val('1');
showPng_noVoice(1);
}
if(e.keyCode == 102){
$('#opening').val('2');
showPng_noVoice(2);
}
if(e.keyCode == 107){
startBet();
}
if(e.keyCode == 111){
endBet();
}
if(e.keyCode == 109){
$('#opening').val('0');
$('#times').val('1');
$('#openingPng').attr('src','');
}
if(e.keyCode == 103){
$('#update_ludan').toggle();
}
//修改当前状态
if(e.keyCode == 96){
$('#update_ludan').toggle();
}
})
$("#confirm_update_ludan").click(function (){
retreated();
});
$("#cancel_update_ludan").click(function (){
$('#update_ludan').hide();
});
})
var keyT;
window.onkeydown = function(e){
var timeout;
if(!keyT){
keyT=true;
if(e.keyCode==105 || e.keyCode==57 || e.keyCode==33){
timeout=setTimeout(function(){
keyT=false;
},500)
}
}else{
keyT=false;
if(e.keyCode==105 || e.keyCode==57 || e.keyCode==33){
var image = new Image();
var nid = $('#number_tab_dt_id').val();
// var game_id = "{$table.game_id}";
var game_id = $('#game_id').val();
image.src1 = $("#canvas1")[0].toDataURL("image/png");
image.src2 = $("#canvas2")[0].toDataURL("image/png");
var canvas_bg=$("#canvas1").css("background");
sessionStorage.setItem("canvas1",image.src1);
sessionStorage.setItem("canvas2",image.src2);
sessionStorage.setItem("canvas_bg",canvas_bg);
$('#print_iframe').attr('src', '/index/stamp?nid='+nid+'&game_id='+game_id);
$(".iframe-box").show();
}
}
}
function close_print(){
$(".iframe-box").hide();
}
var getOnlineNumber = function (connections){
var query = new Object();
query.connections = connections;
$.ajax({
url:'/index/get_online_number',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
$('#onlineNumber').html(data.data);
}
}
});
}
var showPng = function (opening){
if(opening == 1) {
$('#openingPng').attr('src','/static/console/new_img/banker.png');
mp3List = ['banker_win.mp3'];
}
if(opening == 2) {
$('#openingPng').attr('src','/static/console/new_img/player.png');
mp3List = ['player_win.mp3'];
}
if(opening == 3) {
$('#openingPng').attr('src','/static/console/new_img/tie.png');
mp3List = ['tie.mp3'];
}
audioMp3(mp3List).Play();
$('#openingElement').show().delay(3000).hide(300);
}
var showPng_noVoice = function (opening){
var status = $('#number_tab_status').val();
if(status == '2'){
if(opening == 1) {
$('#openingPng').attr('src','/static/console/new_img/banker.png');
}
if(opening == 2) {
$('#openingPng').attr('src','/static/console/new_img/player.png');
}
if(opening == 3) {
$('#openingPng').attr('src','/static/console/new_img/tie.png');
}
$('#openingElement').show();
}else{
layer.msg('开结果失败,请确认该铺是处于停止下注的状态');
}
}
var audio=$("#audio").get(0);
var mp3List;
var num=0;
function audioMp3(mp3List){
var mp3=new Object();
mp3.mp3List=mp3List;
mp3.url="/static/console/mp3/";
mp3.auto_play=false;
mp3.loop=false;
mp3.Play=function(){
audio.src=this.url+this.mp3List[0];
audio.play();
}
mp3.Muted=function(){
audio.muted ? audio.muted = false : audio.muted = true;
}
mp3.volumeAdd=function(){
if(audio.volume.toFixed(1)>=1){
audio.volume=1
}else{
audio.volume = audio.volume + 0.1;
}
}
mp3.volumeMinus=function(){
if(audio.volume.toFixed(1)<=0){
audio.volume=0
}else{
audio.volume = audio.volume - 0.1;
}
}
return mp3;
}
audio.addEventListener("ended", nextAudio);
function nextAudio(){
num+=1
if(num<mp3List.length){
audio.src="/static/console/mp3/"+mp3List[num];
audio.play();
}else{
audio.pause();
audio.currentTime = 0.0;
// console.log("播完")
num=0;
}
}
// WebSocket 数据交互
var number_tab_id;
if(window.WebSocket){
var webSocket = new WebSocket(websocketUrl);
webSocket.onerror = function(event){
layer.alert('您已断开链接,请返回重新进入。',{icon:2,closeBtn:0});
}
webSocket.onopen = function (event) {
var userid = $('#userid').val();
var account = $('#account').val();
var online_token = $('#online_token').val();
if(parseInt(userid) > 0 && account != '' && online_token != ''){
webSocket.send('{"connect":"space","mode":"onlineLogin","account":"'+account+'","userid":"'+userid+'","online_token":"'+online_token+'"}');
}else{
webSocket.close();
layer.alert('您已断开链接,请返回重新进入。',{icon:2,closeBtn:0});
}
};
// 桌子状态
var setBetStatus = function (BetStatus){
// console.log(BetStatus)
if(BetStatus.type == 1){
$('#betstatus').html(BetStatus.msg);
}else if(BetStatus.type == 2){
$('#number_tab_status').val(BetStatus.betStatus);
$('#betstatus').html(BetStatus.betMsg);
$('#opening_result').html('');
}
};
// 获取桌子数据
var setNumberInfo = function (round){
number_tab_id=round.number_tab_id
$('#boot_num').val(round.boot_num);//靴数
$('#number').val(round.number_tab_number);// 局数
$('#number_tab_dt_id').val(round.number_tab_id);
$('#boot_id').val(round.boot_id);
getResultToatl(round.tid,round.boot_id);
};
// 重置下注
var clearBetAmount = function (){
$('#banker_amount').html(0);
$('#player_amount').html(0);
$('#tie_amount').html(0);
$('#all_amount').html(0);
};
// 获取 庄、闲、和、对 开局次数
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/index/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
$('#result_total_tie').html(resultToatl.tie);
}
}
});
};
var setBetAmount = function (amount){
if(parseInt($('#all_amount').html()) > 0){
var o_all_amount = parseInt($('#all_amount').html());
}else{
var o_all_amount = 0;
}
var all_amount = o_all_amount + amount.banker_amount + amount.player_amount + amount.banker_doub_amount + amount.player_doub_amount;
$('#all_amount').html(all_amount);
};
webSocket.onmessage = function (event) {
var data = $.parseJSON(event.data);
if(data.sendMode == 'onlineLogin'){
if(data.status === true){
//登录成功
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status)
clearBetAmount();
waybillFunc();
// showForecast(); // 自动问路
}else{
//登录失败
webSocket.close();
layer.alert(data.msg,{icon:2,closeBtn:0});
}
}else if(data.sendMode == 'resetBoot' || data.sendMode == 'changeBoot'){
//console.log(data);
if(data.status === true){
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
clearBetAmount();
waybillFunc();
hiddenForecast(); //隐藏自动问路
}else{
layer.alert(data.msg,{icon:2,closeBtn:0});
}
}else if(data.sendMode == 'startBet'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
}else{
layer.alert(data.msg,{icon:2,closeBtn:0});
}
}else if(data.sendMode == 'startBetCountDown'){
if(data.status === true && data.countDown >= 0){
countDown(data.countDown);
}else{
layer.alert(data.msg,{icon:2,closeBtn:0});
}
}else if(data.sendMode == 'endBet'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
clearTimeout(t);
c = parseInt($('#wait_time').val());
}else{
layer.alert(data.msg,{icon:2,closeBtn:0});
}
}else if(data.sendMode == 'toBet'){
if(data.status === true){
setBetAmount(data.betAmountMsgAdd);
}
}else if(data.sendMode == 'inCheckout'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
clearBetAmount();
}else{
layer.alert(data.msg,{icon:2,closeBtn:0});
}
}else if(data.sendMode == 'openingDn'){
if(data.status === true){
showPng(data.round.opening);
$('#opening').val(0);
$('#times').val(1);
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
clearBetAmount();
waybillFunc();
// showForecast(); // 自动问路
//autoBet(); // 自动开始下注
}else{
$('#opening').val(0);
$('#times').val(1);
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'sendOnlienNumberExit' || data.sendMode == 'sendOnlienNumberEntry' || data.sendMode == 'sendOnlienNumberSpaceEntry'){
$('#onlineNumber').html(data.number);
if(data.sendMode == 'sendOnlienNumberEntry'){
if(data.betStatus == 0){
//mp3List = ['welcome.mp3'];
//audioMp3(mp3List).Play();
//autoBet(true);
}
}
}else if(data.sendMode == 'retreated'){
if(data.status === true){
$("#update_ludan").hide();
waybillFunc();
}else{
layer.msg(data.msg);
}
}else if(data.sendMode == 'RepeatedEntry'){
webSocket.close();
layer.msg(lang[data.msg]);
setTimeout(function (){
window.location.href='/login/logout';
},2000);
}
};
var inCheckout = function(){
layer.confirm('是否需要将桌子的状态设置为"洗牌中"',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"inCheckout","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
}
var resetBoot = function(){
layer.confirm('是否需要进行日结算?',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"resetBoot","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var changeBoot = function(){
layer.confirm('是否需要进行换靴?',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"changeBoot","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var startBet = function(){
webSocket.send('{"connect":"space","mode":"startBet","number_tab_id":"'+parseInt(number_tab_id)+'"}');
var betStatus=$("#number_tab_status").val()
if(betStatus==0){
mp3List = ['start.mp3'];
audioMp3(mp3List).Play();
}
};
var endBet = function (){
webSocket.send('{"connect":"space","mode":"endBet","number_tab_id":"'+parseInt(number_tab_id)+'"}');
var betStatus=$("#number_tab_status").val()
if(betStatus==1){
$(".countdown .num").html($("#wait_time").val())
$(".countdown").fadeOut();
mp3List = ['stop_2.mp3'];
audioMp3(mp3List).Play();
}
};
var opening = function(){
$('.control-box .btn-box2 span').removeClass('on');
var opening = $('#opening').val();
var times = $('#times').val();
var number_tab_dt_id = $('#number_tab_dt_id').val();
webSocket.send('{"connect":"space","mode":"openingDn","number_tab_id":"'+parseInt(number_tab_dt_id)+'","opening":"'+opening+'","times":"'+parseInt(times)+'"}');
$('#openingElement').addClass("blink")
setTimeout(function(){
$('#openingElement').removeClass("blink").delay(3000).hide(1);
},2900)
};
//回档方法
var retreated = function(){
var game_id = parseInt($('#game_id').val());
var table_id = parseInt($('#table_id').val());
var boot_id = parseInt($('#boot_id').val());
var number_tab_id = parseInt($('#number_tab_dt_id').val());
var update_ludan_result = $('#update_ludan_result').val();
if(update_ludan_result == ''){
layer.msg('请选择要修改的结果');
return false;
}
webSocket.send('{"connect":"space","mode":"retreated","number_tab_id":"'+number_tab_id+'","boot_id":"'+boot_id+'","table_id":"'+table_id+'","game_id":"'+game_id+'","result":"'+update_ludan_result+'"}');
}
/* *** 确认提交结果方法 *** */
var confirmResult = function(id,result){
$('.control-box .btn-box2 span').eq(0).removeClass('on');
$('.control-box .btn-box2 span').eq(1).removeClass('on');
$('.control-box .btn-box2 span').eq(2).removeClass('on');
var is_on=$("#"+id).hasClass("on");
if(is_on){
$("#"+id).removeClass("on")
}else{
$("#"+id).addClass("on")
}
$('#opening').val(result);
showPng_noVoice(result);
};
/* *** 确认提交结果方法 *** */
}else{
layer.alert('您的浏览器不支持WebSocket',{icon:2,closeBtn:0});
}
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.boot_id = $('#boot_id').val();
data.game_id = $('#game_id').val();
$.ajax({
url:"/index/waybill",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
// 将数据结果存session
ludan = data;
// 执行画布刷新
requestData(ludan);
}
});
}
//庄问路
var getLudanBanker = function(){
var next = new Object;
next.boot_id = $('#boot_id').val();
next.game_id = $('#game_id').val();
next.forecast = 1;
$.ajax({
url:"/index/waybill",
type:"POST",
dataType:"JSON",
data:next,
async:false,
success:function(data){
askData = data;
}
});
return askData
}
//闲问路
var getLudanPlayer = function(){
var next = new Object;
next.boot_id = $('#boot_id').val();
next.game_id = $('#game_id').val();
next.forecast = 2;
$.ajax({
url:"/index/waybill",
type:"POST",
dataType:"JSON",
data:next,
async:false,
success:function(data){
askData = data;
}
});
return askData
}
// 自动问路
// 自动问路
// var showForecast = function(){
// var len = 0;
// // 庄自动问路
// var bankerResult = getLudanBanker();
// if(bankerResult.status == true){
// var bankerResult = bankerResult.waybill;
// // 大眼路
// if(bankerResult.bigEyeRoad!=""){
// len = bankerResult.bigEyeRoad.length - 1;
// if(bankerResult.bigEyeRoad[len].result == 1){
// $('#bankerask').find('.circle').css('border-color','red').css('opacity',1);
// }else if(bankerResult.bigEyeRoad[len].result == 2){
// $('#bankerask').find('.circle').css('border-color','blue').css('opacity',1);
// }
// }
// // 小路
// if(bankerResult.pathway!=""){
// len = bankerResult.pathway.length - 1;
// if(bankerResult.pathway[len].result == 1){
// $('#bankerask').find('.round').css('border-color','red').css('background-color','red').css('opacity',1);
// }else if(bankerResult.pathway[len].result == 2){
// $('#bankerask').find('.round').css('border-color','blue').css('background-color','blue').css('opacity',1);
// }
// }
// // 曱甴路
// if(bankerResult.roach!=""){
// len = bankerResult.roach.length - 1;
// if(bankerResult.roach[len].result == 1){
// $('#bankerask').find('.bar').removeClass('blue').removeClass('red');
// $('#bankerask').find('.bar').addClass('red').css('opacity',1);
// }else if(bankerResult.roach[len].result == 2){
// $('#bankerask').find('.bar').removeClass('blue').removeClass('red');
// $('#bankerask').find('.bar').addClass('blue').css('opacity',1);
// }
// }
// }
// // 闲自动问路
// var playerResult = getLudanPlayer();
// if(playerResult.status == true){
// var playerResult = playerResult.waybill;
// // 大眼路
// if(playerResult.bigEyeRoad!=""){
// var len = playerResult.bigEyeRoad.length - 1;
// if(playerResult.bigEyeRoad[len].result == 1){
// $('#playerask').find('.circle').css('border-color','red').css('opacity',1);
// }else if(playerResult.bigEyeRoad[len].result == 2){
// $('#playerask').find('.circle').css('border-color','blue').css('opacity',1);
// }
// }
// // 小路
// if(playerResult.pathway!=""){
// len = playerResult.pathway.length - 1;
// if(playerResult.pathway[len].result == 1){
// $('#playerask').find('.round').css('border-color','red').css('background-color','red').css('opacity',1);
// }else if(playerResult.pathway[len].result == 2){
// $('#playerask').find('.round').css('border-color','blue').css('background-color','blue').css('opacity',1);
// }
// }
// // 曱甴路
// if(playerResult.roach!=""){
// len = playerResult.roach.length - 1;
// if(playerResult.roach[len].result == 1){
// $('#playerask').find('.bar').removeClass('blue').removeClass('red');
// $('#playerask').find('.bar').addClass('red').css('opacity',1);
// }else if(playerResult.roach[len].result == 2){
// $('#playerask').find('.bar').removeClass('blue').removeClass('red');
// $('#playerask').find('.bar').addClass('blue').css('opacity',1);
// }
// }
// }
// };
// 换靴时隐藏自动问路
var hiddenForecast = function(){
$('#bankerask').find('.circle').css('opacity',0);
$('#bankerask').find('.round').css('opacity',0);
$('#bankerask').find('.bar').css('opacity',0);
$('#playerask').find('.circle').css('opacity',0);
$('#playerask').find('.round').css('opacity',0);
$('#playerask').find('.bar').css('opacity',0);
}
// 问路方法
var askInterval;
function ask(newdata,olddata){
var time=8;
askInterval=setInterval(function(){
time--;
var num=time%2;
if(time<0){
clearInterval(askInterval);
}else{
if(num==1){
requestData(newdata)
}else{
requestData(olddata)
}
}
},200);
}
function requestData(data){
smallH=$(".canvas-box.small").height();
smallW=$(".canvas-box.small").width();
// 计算单位
unitsmall=smallH/18;
// 计算列个数
colsmall=Math.floor(smallW/unitsmall);
colbig=Math.floor(bigW/unitbig);
CanvasTable("#canvas1",unitsmall,18,colsmall,data);
// $(".canvas-box .active-box").width($(".table-data").width()+16)
}
function CanvasTable(Id,unit,rows,cols,data){
var width=unit*cols,
height=unit*rows;
$(Id).attr("width",width)
$(Id).attr("height",height)
// $(Id).css("width",width)
$(Id).css("height",height)
var canvasId=$(Id);
var ctb=canvasId[0].getContext('2d');
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#919191";//线条颜色
ctb.beginPath();
ctb.moveTo(0, 0.5);
ctb.lineTo(width, 0.5);
for (var i = 0; i <= rows; i++) {
ctb.moveTo(0, unit*i);
ctb.lineTo(width, unit*i);
}
ctb.closePath()
ctb.stroke();
ctb.beginPath();
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, height);
for (var j = 1; j <= cols; j++) {
ctb.moveTo(unit*j,0);
ctb.lineTo(unit*j,height);
}
ctb.closePath()
ctb.stroke();
ctb.beginPath();
ctb.lineWidth = 1.5;//线条宽度
ctb.strokeStyle = "#000";//线条颜色
ctb.moveTo(0, unit*6);
ctb.lineTo(width, unit*6);
ctb.moveTo(0, unit*12);
ctb.lineTo(width, unit*12);
ctb.closePath()
ctb.stroke();
if(data){
if(data.waybill){
if(data.waybill.bigRoad){
$.each(data.waybill.bigRoad,function(i,v){
if(v.show_x<=cols){
BigPath(ctb,unit,v.show_x,v.show_y,v.result)
}else if(v.show_x<=2*cols){
BigPath(ctb,unit,v.show_x-cols,v.show_y+6,v.result)
}else if(v.show_x<=3*cols){
BigPath(ctb,unit,v.show_x-2*cols,v.show_y+12,v.result)
}
})
}
}
}
}
// 大路
function BigPath(ctb,unit,x,y,type,slash,corners){
ctb.beginPath();
ctb.lineWidth = unit*0.06;
var radius=unit/2
if(type==2){
var color="#0000ff";
}else if(type==1){
var color="#bc1025"
}
ctb.strokeStyle = color;
ctb.arc(radius+unit*(x-1),radius+unit*(y-1), unit*0.38, 0, Math.PI * 2);
ctb.closePath()
ctb.stroke();
}
function countDown(time) {
$(".countdown .num").html(time);
$(".countdown").fadeIn();
if(time<=0){
mp3List = ['stop_2.mp3'];
audioMp3(mp3List).Play();
$(".countdown").fadeOut();
webSocket.send('{"connect":"space","mode":"endBet","number_tab_id":"'+parseInt(number_tab_id)+'"}');
return;
}
}
function notice(){
if (roll == -LiWidth) {
roll = 0;
}
roll -= 1;
$(".notice .scroll").css({
left: roll
})
}
function getTime() {
var today = new Date();
var h = today.getHours();
var minute = today.getMinutes()
var s = today.getSeconds();
if (h < 10) {
h = "0" + h;
}
if (minute < 10) {
minute = "0" + minute;
}
if (s < 10) {
s = "0" + s;
}
var strDate = (" " + today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日" + h + ":" + minute + ":" + s);
var n_day = today.getDay();
switch (n_day) {
case 0:
var week = " 星期日 "
break;
case 1:
var week = " 星期一 "
break;
case 2:
var week = " 星期二 "
break;
case 3:
var week = " 星期三 "
break;
case 4:
var week = " 星期四 "
break;
case 5:
var week = " 星期五 "
break;
case 6:
var week = " 星期六 "
break;
case 7:
var week = " 星期日 "
break;
}
$('.date').find('p').html(strDate);
$('.date').find('span').html(week);
}
function autoBet(data){
var number = $('#onlineNumber').text();
var bet_type = $('#bet_type').val();
// 只有网络投注的桌子才自动开始下注
if(bet_type == 1 || bet_type == 3){
if(data == true){
// 客户刚进来
startBet();
}else{
// 开结果之后 只有在线人数大于0时才自动开始下注
if(number > 0){
setTimeout(function(){
startBet();
},5000)
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+868
View File
@@ -0,0 +1,868 @@
var smallH=0,smallW=0,bigH=0,bigW=0;
var unitsmall=0,unitbig=0,colsmall=0,colbig=0;
var roll=0;LiWidth=0;
var BetStatus;
var askData = false;
$(function(){
$(window).resize(function(){
waybillFunc()
})
// waybillFunc()
getTime();
// 滚动广告
$(".notice ul li").each(function(){
LiWidth+=$(this).innerWidth()
});
$(".notice ul").append($(".notice ul").html())
var timer = setInterval(notice, 20);
$(".notice").hover(function() {
clearInterval(timer);
},function() {
timer = setInterval(notice, 20);
})
// 日期
setInterval(function(){
getTime();
}, 1000);
// 侧栏控台
$(".control-box").hover(function(){
$(this).stop().animate({right:"0"})
},function(){
$(this).stop().animate({right:"-410px"})
})
/* 键盘操作 */
$(document).keydown(function (e){
if(e.keyCode == 111){
startBet();
}
if(e.keyCode == 96){
endBet();
}
if(e.keyCode == 13){
opening();
}
})
$("#confirm_update_ludan").click(function (){
retreated();
});
$("#cancel_update_ludan").click(function (){
$('#update_ludan').hide();
});
})
function close_print(){
$(".iframe-box").hide();
}
var showPng = function (opening){
if(opening == 1) {
$('#openingPng').attr('src','/static/console/new_img/banker.png');
mp3List = ['banker_win.mp3'];
}
if(opening == 2) {
$('#openingPng').attr('src','/static/console/new_img/player.png');
mp3List = ['player_win.mp3'];
}
if(opening == 3) {
$('#openingPng').attr('src','/static/console/new_img/tie.png');
mp3List = ['tie.mp3'];
}
audioMp3(mp3List).Play();
$('#openingElement').show().delay(3000).hide(300);
}
var showPng_noVoice = function (opening){
var status = $('#number_tab_status').val();
if(status == '2'){
if(opening == 1) {
$('#openingPng').attr('src','/static/console/new_img/banker.png');
}
if(opening == 2) {
$('#openingPng').attr('src','/static/console/new_img/player.png');
}
if(opening == 3) {
$('#openingPng').attr('src','/static/console/new_img/tie.png');
}
$('#openingElement').show();
}else{
layer.msg('开结果失败,请确认该铺是处于停止下注的状态');
}
}
function flop_position(data){
pokercard=data.round.card;
pokersrc="/static/poker/"+pokercard+".png";
$('.begincard .position-card .card').css("opacity",1);
$('.begincard .position-card .card').find(".face").css("background-image","url("+pokersrc+")");
}
function flop_card(data){
order_num = data.round.order_num;
card_cow = order_num.substring(0,1);
card_list = order_num.substring(1,2) - 1;
if(card_cow == 1){
box_name = 'player-1-card';
if(data.round.result){
$('.player_1_result').html(data.round.result);
}
}else if(card_cow == 2){
box_name = 'player-2-card';
if(data.round.result){
$('.player_2_result').html(data.round.result);
}
}else if(card_cow == 3){
box_name = 'player-3-card';
if(data.round.result){
$('.player_3_result').html(data.round.result);
}
}else if(card_cow == 4){
box_name = 'banker-card';
if(data.round.result){
$('.banker_result').html(data.round.result);
}
}
if(40<order_num){
$('.box1').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
if(10<order_num && order_num<20){
$('.box2').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
if(20<order_num && order_num<30){
$('.box3').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
if(30<order_num && order_num<40){
$('.box4').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
}
pokercard=data.round.card;
$poker=$('.begincard '+'.'+ box_name+' .card');
pokersrc="/static/poker/"+pokercard+".png";
$poker.eq(card_list).find(".face").css("background-image","url("+pokersrc+")")
$('.begincard '+'.'+ box_name).find(".card").eq(card_list).css('opacity',1);
}
var audio=$("#audio").get(0);
var mp3List;
var num=0;
function audioMp3(mp3List){
var mp3=new Object();
mp3.mp3List=mp3List;
mp3.url="/static/console/mp3/";
mp3.auto_play=false;
mp3.loop=false;
mp3.Play=function(){
audio.src=this.url+this.mp3List[0];
audio.play();
}
mp3.Muted=function(){
audio.muted ? audio.muted = false : audio.muted = true;
}
mp3.volumeAdd=function(){
if(audio.volume.toFixed(1)>=1){
audio.volume=1
}else{
audio.volume = audio.volume + 0.1;
}
}
mp3.volumeMinus=function(){
if(audio.volume.toFixed(1)<=0){
audio.volume=0
}else{
audio.volume = audio.volume - 0.1;
}
}
return mp3;
}
audio.addEventListener("ended", nextAudio);
function nextAudio(){
num+=1
if(num<mp3List.length){
audio.src="/static/console/mp3/"+mp3List[num];
audio.play();
}else{
audio.pause();
audio.currentTime = 0.0;
num=0;
}
}
// WebSocket 数据交互
var number_tab_id;
if(window.WebSocket){
var webSocket = new ReconnectingWebSocket(websocketUrl,null,{debug:true,reconnectInterval:3000});
webSocket.onerror = function(event){
layer.msg('您已断开链接,请返回重新进入。');
}
webSocket.onopen = function (event) {
var userid = $('#userid').val();
var account = $('#account').val();
var online_token = $('#online_token').val();
var table_id = $('#table_id').val();
if(parseInt(userid) > 0 && account != '' && online_token != ''){
webSocket.send('{"connect":"space","mode":"onlineLogin","account":"'+account+'","userid":"'+userid+'","table_id":"'+table_id+'","online_token":"'+online_token+'"}');
}else{
webSocket.close();
layer.msg('您已断开链接,请返回重新进入。');
}
};
// 桌子状态
var setBetStatus = function (BetStatus){
if(BetStatus.type == 1){
$('#betstatus').html(BetStatus.msg);
}else if(BetStatus.type == 2){
$('#number_tab_status').val(BetStatus.betStatus);
$('#betstatus').html(BetStatus.betMsg);
$('#opening_result').html('');
}
};
// 获取桌子数据
var setNumberInfo = function (round){
number_tab_id=round.number_tab_id
$('#boot_num').val(round.boot_num);//靴数
$('#number').val(round.number_tab_number);// 局数
$('#number_tab_dt_id').val(round.number_tab_id);
$('#boot_id').val(round.boot_id);
getResultToatl(round.tid,round.boot_id);
};
// 获取 庄、闲、和、对 开局次数
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/nn/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
}
}
});
};
webSocket.onmessage = function (event) {
var data = $.parseJSON(event.data);
var table_id = parseInt($('#table_id').val());
if(data.table_id == table_id){
if(data.sendMode == 'onlineLogin'){
if(data.status === true){
//登录成功
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
waybillFunc();
if(data.round.bet_status == 2){
$(".begincard").fadeIn(function(){
$(".begincard .box").animate({"top":"100%","opacity":"1"});
$(".begincard .box1").animate({"top":"100%","opacity":"1"});
$(".begincard .box2").animate({"top":"100%","opacity":"1"});
$(".begincard .box3").animate({"top":"100%","opacity":"1"});
$(".begincard .box4").animate({"top":"100%","opacity":"1"});
});
card_number_info = data.card_info;
if(card_number_info.length > 0){
for(var i=0;i<card_number_info.length;i++){
if(card_number_info[i]['order_num'] == 0){
pokercard=card_number_info[i]['card'];
pokersrc="/static/poker/"+pokercard+".png";
$('.begincard .position-card .card').css("opacity",1);
$('.begincard .position-card .card').find(".face").css("background-image","url("+pokersrc+")");
}else{
pokercard=card_number_info[i]['card'];
order_num = card_number_info[i]['order_num'];
card_cow = card_number_info[i]['order_num'].substring(0,1);
card_list = card_number_info[i]['order_num'].substring(1,2) - 1;
if(card_cow == 1){
box_name = 'player-1-card';
if(card_number_info[i]['result']){
$('.player_1_result').html(card_number_info[i]['result']);
}
}else if(card_cow == 2){
box_name = 'player-2-card';
if(card_number_info[i]['result']){
$('.player_2_result').html(card_number_info[i]['result']);
}
}else if(card_cow == 3){
box_name = 'player-3-card';
if(card_number_info[i]['result']){
$('.player_3_result').html(card_number_info[i]['result']);
}
}else if(card_cow == 4){
box_name = 'banker-card';
if(card_number_info[i]['result']){
$('.banker_result').html(card_number_info[i]['result']);
}
}
$poker=$('.begincard '+'.'+ box_name+' .card');
pokersrc="/static/poker/"+pokercard+".png";
$poker.eq(card_list).find(".face").css("background-image","url("+pokersrc+")")
$('.begincard '+'.'+ box_name).find(".card").eq(card_list).css('opacity',1);
}
}
}
}
}else{
webSocket.close();
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'sendScanResult'){
if(data.round.position == 0){
flop_position(data);
}else{
flop_card(data);
}
}else if(data.sendMode == 'resetBoot' || data.sendMode == 'changeBoot'){
if(data.status === true){
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
waybillFunc();
hiddenForecast(); //隐藏自动问路
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'startBet'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'startBetCountDown'){
if(data.status === true && data.countDown >= 0){
countDown(data.countDown);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'endBet'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
$(".begincard").fadeIn(function(){
$(".list .card").css("opacity","0");
$(".banker_result").html('');
$(".player_1_result").html('');
$(".player_2_result").html('');
$(".player_3_result").html('');
$(".begincard .box").animate({"top":"100%","opacity":"1"});
$(".begincard .box1").animate({"top":"100%","opacity":"1"});
$(".begincard .box2").animate({"top":"100%","opacity":"1"});
$(".begincard .box3").animate({"top":"100%","opacity":"1"});
$(".begincard .box4").animate({"top":"100%","opacity":"1"});
});
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'toBet'){
}else if(data.sendMode == 'inCheckout'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'openingNn'){
if(data.status === true){
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
waybillFunc();
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
setTimeout(function(){
$(".begincard").fadeOut(function(){
$(".begincard .box").animate({"top":"100%","opacity":"0"});
$(".begincard .box1").animate({"top":"100%","opacity":"0"});
$(".begincard .box2").animate({"top":"100%","opacity":"0"});
$(".begincard .box3").animate({"top":"100%","opacity":"0"});
$(".begincard .box4").animate({"top":"100%","opacity":"0"});
});
},1000);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'sendScanReset'){
if(data.status === true){
$(".list .card").css("opacity","0");
$(".banker_result").html('');
$(".player_1_result").html('');
$(".player_2_result").html('');
$(".player_3_result").html('');
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
}else if(data.sendMode == 'retreated'){
if(data.status === true){
$("#update_ludan").hide();
waybillFunc();
}else{
layer.msg(data.msg);
}
}else if(data.sendMode == 'RepeatedEntry'){
webSocket.close();
layer.msg(lang[data.msg]);
setTimeout(function (){
window.location.href='/login/logout';
},2000);
}else if(data.sendMode == 'resetNumberTab'){
if(data.status == true){
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
$(".countdown").fadeOut();
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
setTimeout(function(){
$(".begincard").fadeOut(function(){
$(".begincard .box").animate({"top":"100%","opacity":"0"});
$(".begincard .box1").animate({"top":"100%","opacity":"0"});
$(".begincard .box2").animate({"top":"100%","opacity":"0"});
$(".begincard .box3").animate({"top":"100%","opacity":"0"});
$(".begincard .box4").animate({"top":"100%","opacity":"0"});
});
},200);
}else{
layer.msg(lang[data.msg] || data.msg);
}
}
}
};
var inCheckout = function(){
layer.confirm('是否需要将桌子的状态设置为"洗牌中"',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"inCheckout","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
}
var resetBoot = function(){
layer.confirm('是否需要进行日结算?',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"resetBoot","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var changeBoot = function(){
layer.confirm('是否需要进行换靴?',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"changeBoot","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var resetNumberTab = function(){
layer.confirm(lang.is_reset_number,{btn: [lang.confirm,lang.cancel],title:lang.message}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"resetNumberTab","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var startBet = function(){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"startBet","number_tab_id":"'+parseInt(number_tab_id)+'","table_id":"'+parseInt(table_id)+'"}');
var betStatus=$("#number_tab_status").val();
if(betStatus==0){
mp3List = ['start.mp3'];
audioMp3(mp3List).Play();
}
};
var endBet = function (){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"endBet","number_tab_id":"'+parseInt(number_tab_id)+'","table_id":"'+parseInt(table_id)+'"}');
var betStatus=$("#number_tab_status").val();
if(betStatus==1){
$(".countdown .num").html($("#wait_time").val())
$(".countdown").fadeOut();
mp3List = ['stop_2.mp3'];
audioMp3(mp3List).Play();
}
};
var opening = function(){
var table_id = $('#table_id').val();
$('.control-box .btn-box2 span').removeClass('on');
var number_tab_dt_id = $('#number_tab_dt_id').val();
webSocket.send('{"connect":"space","mode":"openingNn","number_tab_id":"'+parseInt(number_tab_dt_id)+'","table_id":"'+parseInt(table_id)+'"}');
};
//回档方法
var retreated = function(){
var game_id = parseInt($('#game_id').val());
var table_id = parseInt($('#table_id').val());
var boot_id = parseInt($('#boot_id').val());
var number_tab_id = parseInt($('#number_tab_dt_id').val());
var update_ludan_result = $('#update_ludan_result').val();
if(update_ludan_result == ''){
layer.msg('请选择要修改的结果');
return false;
}
webSocket.send('{"connect":"space","mode":"retreated","number_tab_id":"'+number_tab_id+'","boot_id":"'+boot_id+'","table_id":"'+table_id+'","game_id":"'+game_id+'","result":"'+update_ludan_result+'"}');
}
var confirmResult = function(id,result){
$('.control-box .btn-box2 span').eq(0).removeClass('on');
$('.control-box .btn-box2 span').eq(1).removeClass('on');
$('.control-box .btn-box2 span').eq(2).removeClass('on');
var is_on=$("#"+id).hasClass("on");
if(is_on){
$("#"+id).removeClass("on")
}else{
$("#"+id).addClass("on")
}
showPng_noVoice(result);
};
}else{
layer.msg('您的浏览器不支持WebSocket');
}
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.boot_id = $('#boot_id').val();
data.game_id = $('#game_id').val();
$.ajax({
url:"/nn/waybill",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
// 将数据结果存session
ludan = data;
// 执行画布刷新
requestData(ludan.waybill);
}
});
}
// 换靴时隐藏自动问路
var hiddenForecast = function(){
$('#bankerask').find('.circle').css('opacity',0);
$('#bankerask').find('.round').css('opacity',0);
$('#bankerask').find('.bar').css('opacity',0);
$('#playerask').find('.circle').css('opacity',0);
$('#playerask').find('.round').css('opacity',0);
$('#playerask').find('.bar').css('opacity',0);
}
function requestData(data){
smallH=$(".canvas-box.small").height();
smallW=$(".canvas-box.small").width();
// 计算单位
unitsmall=smallH/12;
// 计算列个数
colsmall=Math.floor(smallW/unitsmall);
if(colsmall%2!=0){
colsmall=colsmall-1
}
CanvasTable("#canvas1",unitsmall,12,colsmall,data);
}
function CanvasTable(Id,unit,rows,cols,data){
var width=unit*cols,
height=unit*rows;
$(Id).attr("width",width)
$(Id).attr("height",height)
$(Id).css("height",height)
var canvasId=$(Id);
var ctb=canvasId[0].getContext('2d');
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#919191";//线条颜色
ctb.beginPath();
ctb.moveTo(0, 0.5);
ctb.lineTo(width, 0.5);
for (var i = 0; i <= rows; i++) {
ctb.moveTo(0, unit*i);
ctb.lineTo(width, unit*i);
}
ctb.closePath()
ctb.stroke();
ctb.beginPath();
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, height);
for (var j = 1; j <= cols; j++) {
ctb.moveTo(unit*j*2,0);
ctb.lineTo(unit*j*2,height);
}
ctb.closePath()
ctb.stroke();
ctb.beginPath();
ctb.lineWidth = 1.5;//线条宽度
ctb.strokeStyle = "#000";//线条颜色
ctb.moveTo(0, unit*4);
ctb.lineTo(width, unit*4);
ctb.moveTo(0, unit*8);
ctb.lineTo(width, unit*8);
ctb.closePath()
ctb.stroke();
title(ctb,unit,1,1,1);
title(ctb,unit,1,2,2);
title(ctb,unit,1,3,3);
title(ctb,unit,1,4,4);
title(ctb,unit,1,5,1);
title(ctb,unit,1,6,2);
title(ctb,unit,1,7,3);
title(ctb,unit,1,8,4);
title(ctb,unit,1,9,1);
title(ctb,unit,1,10,2);
title(ctb,unit,1,11,3);
title(ctb,unit,1,12,4);
cutRoad(ctb,unit,data,cols);
}
function cutRoad(ctb,unit,data,cols){
var L=data.length/4;
var new_roadData=[];
var Tab=0;
last_x = (cols/2-1)*3-1;
if(L > (cols/2-1)*3-1){
var cut = L - last_x;
$.each(data,function(i,v){
if(v.show_x>cut){
new_roadData.push(v)
}
})
$.each(new_roadData,function(i,v){
v.show_x = v.show_x - cut;
if(v.show_x<=(cols/2-1)){
showPath(ctb,unit,v.show_x,v.show_y,v.type,v.result,v.is_win)
}else if(v.show_x<=cols-2){
showPath(ctb,unit,v.show_x-(cols/2)+1,v.show_y+4,v.type,v.result,v.is_win)
}else if(v.show_x<=3*(cols/2)){
showPath(ctb,unit,v.show_x-cols+2,v.show_y+8,v.type,v.result,v.is_win)
}
})
}else{
if(data){
$.each(data,function(i,v){
if(v.show_x<=(cols/2-1)){
showPath(ctb,unit,v.show_x,v.show_y,v.type,v.result,v.is_win)
}else if(v.show_x<=cols-2){
showPath(ctb,unit,v.show_x-(cols/2)+1,v.show_y+4,v.type,v.result,v.is_win)
}else if(v.show_x<=3*(cols/2)){
showPath(ctb,unit,v.show_x-cols+2,v.show_y+8,v.type,v.result,v.is_win)
}
})
}
}
}
function title(ctb,unit,x,y,type){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
if(type==1){
fonts= '庄家';
var font_color = '#b20a00';
}else if(type==2){
fonts= '闲一';
var font_color = '#0543bc';
}else if(type==3){
fonts= '闲二';
var font_color = '#0543bc';
}else if(type==4){
fonts= '闲三';
var font_color = '#0543bc';
}
if(type == 1){
var color = '#ffad97';
}else{
var color = '#73d8f7';
}
//背景色
ctb.fillStyle = color ; // 颜色
ctb.fillRect(x,(y-1)*unit,unit*2-1,unit-0.5);
ctb.fill();
//文字
ctb.font=unit*0.5+"px Arial";//字的大小
ctb.fillStyle = font_color ; // 颜色
ctb.textAlign = 'center'; //字的位置
ctb.textBaseline = 'middle';
ctb.fillText(fonts,radius+unit*(x/2),radius+unit*(y-1));
ctb.stroke();
}
function showPath(ctb,unit,x,y,type,result,is_win){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
if(type==1){
var font_color = '#b20a00';
}else{
var font_color = '#1e14d3';
}
if(result == 0){
var fonts = '无牛';
}else if(result == 1){
var fonts = '牛1';
}else if(result == 2){
var fonts = '牛2';
}else if(result == 3){
var fonts = '牛3';
}else if(result == 4){
var fonts = '牛4';
}else if(result == 5){
var fonts = '牛5';
}else if(result == 6){
var fonts = '牛6';
}else if(result == 7){
var fonts = '牛7';
}else if(result == 8){
var fonts = '牛8';
}else if(result == 9){
var fonts = '牛9';
}else if(result == 10){
var fonts = '牛牛';
}else if(result == 11){
var fonts = '五公';
}
//背景色
if(is_win == 1){
if(type == 1){
ctb.fillStyle = '#b20a00' ; // 颜色
}else{
ctb.fillStyle = '#1e14d3' ; // 颜色
}
ctb.fillRect(unit*x*2,unit*(y-0.25),unit*2,unit*0.25);
ctb.fill();
win(ctb,unit,x,y);
}
//文字
ctb.font=unit*0.45+"px Arial";//字的大小
ctb.fillStyle = font_color ; // 颜色
ctb.textAlign = 'center'; //字的位置
ctb.textBaseline = 'middle';
ctb.fillText(fonts,2*x*unit+unit,radius+unit*(y-1));
ctb.stroke();
}
function win(ctb,unit,x,y){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
fonts = 'WIN';
ctb.font=unit*0.25+"px Arial";//字的大小
ctb.fillStyle = '#fff' ; // 颜色
ctb.textAlign = 'center'; //字的位置
ctb.textBaseline = 'middle';
ctb.fillText(fonts,2*x*unit+unit,unit*(y-0.11));
ctb.stroke();
}
// 大路
function BigPath(ctb,unit,x,y,type,slash,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
if(type==1){
var color='#b20a00',
fonts= lang.banker;
ctb.strokeStyle = "#ff4a68";
}else if(type==2){
var color='#0543bc',
fonts= lang.player;
ctb.strokeStyle = "#7e7df6";
}else if(type==3){
var color='#1d8701',
fonts= lang.tie;
ctb.strokeStyle = "#71df57";
}
ctb.arc(radius+unit*(x-1), radius+unit*(y-1), unit*0.4, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
ctb.font=unit*0.45+"px Arial";
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,radius+unit*(x-1),radius+unit*(y-1));
ctb.stroke();
}
function countDown(time) {
var table_id = $('#table_id').val();
$(".countdown .num").html(time);
$(".countdown").fadeIn();
if(time == 10){
mp3List = ['time_tip_10.mp3'];
audioMp3(mp3List).Play();
}
if(time < 9 && time > 0){
mp3List = ['time.mp3'];
audioMp3(mp3List).Play();
}
if(time<=0){
mp3List = ['stop_2.mp3'];
audioMp3(mp3List).Play();
$(".countdown").fadeOut();
webSocket.send('{"connect":"space","mode":"endBet","number_tab_id":"'+parseInt(number_tab_id)+'","table_id":"'+parseInt(table_id)+'"}');
return;
}
}
function notice(){
if (roll == -LiWidth) {
roll = 0;
}
roll -= 1;
$(".notice .scroll").css({
left: roll
})
}
function getTime() {
var today = new Date();
var h = today.getHours();
var minute = today.getMinutes()
var s = today.getSeconds();
if (h < 10) {
h = "0" + h;
}
if (minute < 10) {
minute = "0" + minute;
}
if (s < 10) {
s = "0" + s;
}
var strDate = (" " + today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日" + h + ":" + minute + ":" + s);
var n_day = today.getDay();
switch (n_day) {
case 0:
var week = " 星期日 "
break;
case 1:
var week = " 星期一 "
break;
case 2:
var week = " 星期二 "
break;
case 3:
var week = " 星期三 "
break;
case 4:
var week = " 星期四 "
break;
case 5:
var week = " 星期五 "
break;
case 6:
var week = " 星期六 "
break;
case 7:
var week = " 星期日 "
break;
}
$('.date').find('p').html(strDate);
$('.date').find('span').html(week);
}
+796
View File
@@ -0,0 +1,796 @@
var smallH=0,smallW=0,bigH=0,bigW=0;
var unitsmall=0,unitbig=0,colsmall=0,colbig=0;
var roll=0;LiWidth=0;
var BetStatus;
var askData = false;
$(function(){
$(window).resize(function(){
waybillFunc()
})
waybillFunc()
getTime();
// 滚动广告
$(".notice ul li").each(function(){
LiWidth+=$(this).innerWidth()
});
$(".notice ul").append($(".notice ul").html())
var timer = setInterval(notice, 20);
$(".notice").hover(function() {
clearInterval(timer);
},function() {
timer = setInterval(notice, 20);
})
// 日期
setInterval(function(){
getTime();
}, 1000);
// 侧栏控台
$(".control-box").hover(function(){
$(this).stop().animate({right:"0"})
},function(){
$(this).stop().animate({right:"-410px"})
})
/* 键盘操作 */
$(document).keydown(function (e){
if(e.keyCode == 111){
startBet();
}
if(e.keyCode == 96){
endBet();
}
if(e.keyCode == 13){
opening();
}
})
$("#confirm_update_ludan").click(function (){
retreated();
});
$("#cancel_update_ludan").click(function (){
$('#update_ludan').hide();
});
})
function close_print(){
$(".iframe-box").hide();
}
var showPng = function (opening){
if(opening == 1) {
$('#openingPng').attr('src','/static/console/new_img/banker.png');
mp3List = ['banker_win.mp3'];
}
if(opening == 2) {
$('#openingPng').attr('src','/static/console/new_img/player.png');
mp3List = ['player_win.mp3'];
}
if(opening == 3) {
$('#openingPng').attr('src','/static/console/new_img/tie.png');
mp3List = ['tie.mp3'];
}
audioMp3(mp3List).Play();
$('#openingElement').show().delay(3000).hide(300);
}
var showPng_noVoice = function (opening){
var status = $('#number_tab_status').val();
if(status == '2'){
if(opening == 1) {
$('#openingPng').attr('src','/static/console/new_img/banker.png');
}
if(opening == 2) {
$('#openingPng').attr('src','/static/console/new_img/player.png');
}
if(opening == 3) {
$('#openingPng').attr('src','/static/console/new_img/tie.png');
}
$('#openingElement').show();
}else{
layer.msg('开结果失败,请确认该铺是处于停止下注的状态');
}
}
function flop_position(data){
pokercard=data.round.card;
pokersrc="/static/poker/"+pokercard+".png";
$('.begincard .position-card .card').css("opacity",1);
$('.begincard .position-card .card').find(".face").css("background-image","url("+pokersrc+")");
}
function flop_card(data){
order_num = data.round.order_num;
card_cow = order_num.substring(0,1);
card_list = order_num.substring(1,2) - 1;
if(card_cow == 1){
box_name = 'player-1-card';
if(data.round.result){
$('.player_1_result').html(data.round.result);
}
}else if(card_cow == 2){
box_name = 'player-2-card';
if(data.round.result){
$('.player_2_result').html(data.round.result);
}
}else if(card_cow == 3){
box_name = 'player-3-card';
if(data.round.result){
$('.player_3_result').html(data.round.result);
}
}else if(card_cow == 4){
box_name = 'banker-card';
if(data.round.result){
$('.banker_result').html(data.round.result);
}
}
if(40<order_num){
$('.box1').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
if(10<order_num && order_num<20){
$('.box2').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
if(20<order_num && order_num<30){
$('.box3').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
}
if(30<order_num && order_num<40){
$('.box4').css("background-color","rgba(226, 212, 71, 0.5)");
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
}
pokercard=data.round.card;
$poker=$('.begincard '+'.'+ box_name+' .card');
pokersrc="/static/poker/"+pokercard+".png";
$poker.eq(card_list).find(".face").css("background-image","url("+pokersrc+")")
$('.begincard '+'.'+ box_name).find(".card").eq(card_list).css('opacity',1);
}
var audio=$("#audio").get(0);
var mp3List;
var num=0;
function audioMp3(mp3List){
var mp3=new Object();
mp3.mp3List=mp3List;
mp3.url="/static/console/mp3/";
mp3.auto_play=false;
mp3.loop=false;
mp3.Play=function(){
audio.src=this.url+this.mp3List[0];
audio.play();
}
mp3.Muted=function(){
audio.muted ? audio.muted = false : audio.muted = true;
}
mp3.volumeAdd=function(){
if(audio.volume.toFixed(1)>=1){
audio.volume=1
}else{
audio.volume = audio.volume + 0.1;
}
}
mp3.volumeMinus=function(){
if(audio.volume.toFixed(1)<=0){
audio.volume=0
}else{
audio.volume = audio.volume - 0.1;
}
}
return mp3;
}
audio.addEventListener("ended", nextAudio);
function nextAudio(){
num+=1
if(num<mp3List.length){
audio.src="/static/console/mp3/"+mp3List[num];
audio.play();
}else{
audio.pause();
audio.currentTime = 0.0;
num=0;
}
}
// WebSocket 数据交互
var number_tab_id;
if(window.WebSocket){
var webSocket = new WebSocket(websocketUrl);
webSocket.onerror = function(event){
layer.msg('您已断开链接,请返回重新进入。');
}
webSocket.onopen = function (event) {
var userid = $('#userid').val();
var account = $('#account').val();
var online_token = $('#online_token').val();
var table_id = $('#table_id').val();
if(parseInt(userid) > 0 && account != '' && online_token != ''){
webSocket.send('{"connect":"space","mode":"onlineLogin","account":"'+account+'","userid":"'+userid+'","table_id":"'+table_id+'","online_token":"'+online_token+'"}');
}else{
webSocket.close();
layer.msg('您已断开链接,请返回重新进入。');
}
};
// 桌子状态
var setBetStatus = function (BetStatus){
if(BetStatus.type == 1){
$('#betstatus').html(BetStatus.msg);
}else if(BetStatus.type == 2){
$('#number_tab_status').val(BetStatus.betStatus);
$('#betstatus').html(BetStatus.betMsg);
$('#opening_result').html('');
}
};
// 获取桌子数据
var setNumberInfo = function (round){
number_tab_id=round.number_tab_id
$('#boot_num').val(round.boot_num);//靴数
$('#number').val(round.number_tab_number);// 局数
$('#number_tab_dt_id').val(round.number_tab_id);
$('#boot_id').val(round.boot_id);
getResultToatl(round.tid,round.boot_id);
};
// 获取 庄、闲、和、对 开局次数
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/nn/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
}
}
});
};
webSocket.onmessage = function (event) {
var data = $.parseJSON(event.data);
var table_id = parseInt($('#table_id').val());
if(data.table_id == table_id){
if(data.sendMode == 'onlineLogin'){
if(data.status === true){
//登录成功
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
waybillFunc();
console.log(data);
if(data.round.bet_status == 2){
$(".begincard").fadeIn(function(){
$(".begincard .box").animate({"top":"100%","opacity":"1"});
$(".begincard .box1").animate({"top":"100%","opacity":"1"});
$(".begincard .box2").animate({"top":"100%","opacity":"1"});
$(".begincard .box3").animate({"top":"100%","opacity":"1"});
$(".begincard .box4").animate({"top":"100%","opacity":"1"});
});
card_number_info = data.card_info;
if(card_number_info.length > 0){
for(var i=0;i<card_number_info.length;i++){
if(card_number_info[i]['order_num'] == 0){
pokercard=card_number_info[i]['card'];
pokersrc="/static/poker/"+pokercard+".png";
$('.begincard .position-card .card').css("opacity",1);
$('.begincard .position-card .card').find(".face").css("background-image","url("+pokersrc+")");
}else{
pokercard=card_number_info[i]['card'];
order_num = card_number_info[i]['order_num'];
card_cow = card_number_info[i]['order_num'].substring(0,1);
card_list = card_number_info[i]['order_num'].substring(1,2) - 1;
if(card_cow == 1){
box_name = 'player-1-card';
if(card_number_info[i]['result']){
$('.player_1_result').html(card_number_info[i]['result']);
}
}else if(card_cow == 2){
box_name = 'player-2-card';
if(card_number_info[i]['result']){
$('.player_2_result').html(card_number_info[i]['result']);
}
}else if(card_cow == 3){
box_name = 'player-3-card';
if(card_number_info[i]['result']){
$('.player_3_result').html(card_number_info[i]['result']);
}
}else if(card_cow == 4){
box_name = 'banker-card';
if(card_number_info[i]['result']){
$('.banker_result').html(card_number_info[i]['result']);
}
}
$poker=$('.begincard '+'.'+ box_name+' .card');
pokersrc="/static/poker/"+pokercard+".png";
$poker.eq(card_list).find(".face").css("background-image","url("+pokersrc+")")
$('.begincard '+'.'+ box_name).find(".card").eq(card_list).css('opacity',1);
}
}
}
}
}else{
webSocket.close();
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'sendScanResult'){
if(data.round.position == 0){
flop_position(data);
}else{
flop_card(data);
}
}else if(data.sendMode == 'resetBoot' || data.sendMode == 'changeBoot'){
if(data.status === true){
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
waybillFunc();
hiddenForecast(); //隐藏自动问路
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'startBet'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'startBetCountDown'){
if(data.status === true && data.countDown >= 0){
countDown(data.countDown);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'endBet'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
$(".begincard").fadeIn(function(){
$(".list .card").css("opacity","0");
$(".banker_result").html('');
$(".player_1_result").html('');
$(".player_2_result").html('');
$(".player_3_result").html('');
$(".begincard .box").animate({"top":"100%","opacity":"1"});
$(".begincard .box1").animate({"top":"100%","opacity":"1"});
$(".begincard .box2").animate({"top":"100%","opacity":"1"});
$(".begincard .box3").animate({"top":"100%","opacity":"1"});
$(".begincard .box4").animate({"top":"100%","opacity":"1"});
});
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'toBet'){
}else if(data.sendMode == 'inCheckout'){
if(data.status === true){
setBetStatus(data.round.number_tab_status);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'openingTc'){
if(data.status === true){
setNumberInfo(data.round);
setBetStatus(data.round.number_tab_status);
waybillFunc();
$('.box1').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box2').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box3').css("background-color","rgba(0, 0, 0, 0.5)");
$('.box4').css("background-color","rgba(0, 0, 0, 0.5)");
setTimeout(function(){
$(".begincard").fadeOut(function(){
$(".begincard .box").animate({"top":"100%","opacity":"0"});
$(".begincard .box1").animate({"top":"100%","opacity":"0"});
$(".begincard .box2").animate({"top":"100%","opacity":"0"});
$(".begincard .box3").animate({"top":"100%","opacity":"0"});
$(".begincard .box4").animate({"top":"100%","opacity":"0"});
});
},1000);
}else{
layer.msg(lang[data.msg]);
}
}else if(data.sendMode == 'retreated'){
if(data.status === true){
$("#update_ludan").hide();
waybillFunc();
}else{
layer.msg(data.msg);
}
}else if(data.sendMode == 'RepeatedEntry'){
webSocket.close();
layer.msg(lang[data.msg]);
setTimeout(function (){
window.location.href='/login/logout';
},2000);
}
}
};
var inCheckout = function(){
layer.confirm('是否需要将桌子的状态设置为"洗牌中"',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"inCheckout","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
}
var resetBoot = function(){
layer.confirm('是否需要进行日结算?',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"resetBoot","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var changeBoot = function(){
layer.confirm('是否需要进行换靴?',{btn: ['确认','取消']}, function(index){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"changeBoot","table_id":"'+parseInt(table_id)+'"}');
layer.close(index);
});
};
var startBet = function(){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"startBet","number_tab_id":"'+parseInt(number_tab_id)+'","table_id":"'+parseInt(table_id)+'"}');
var betStatus=$("#number_tab_status").val();
if(betStatus==0){
mp3List = ['start.mp3'];
audioMp3(mp3List).Play();
}
};
var endBet = function (){
var table_id = $('#table_id').val();
webSocket.send('{"connect":"space","mode":"endBet","number_tab_id":"'+parseInt(number_tab_id)+'","table_id":"'+parseInt(table_id)+'"}');
var betStatus=$("#number_tab_status").val();
if(betStatus==1){
$(".countdown .num").html($("#wait_time").val())
$(".countdown").fadeOut();
mp3List = ['stop_2.mp3'];
audioMp3(mp3List).Play();
}
};
var opening = function(){
var table_id = $('#table_id').val();
$('.control-box .btn-box2 span').removeClass('on');
var number_tab_dt_id = $('#number_tab_dt_id').val();
webSocket.send('{"connect":"space","mode":"openingTc","number_tab_id":"'+parseInt(number_tab_dt_id)+'","table_id":"'+parseInt(table_id)+'"}');
};
//回档方法
var retreated = function(){
var game_id = parseInt($('#game_id').val());
var table_id = parseInt($('#table_id').val());
var boot_id = parseInt($('#boot_id').val());
var number_tab_id = parseInt($('#number_tab_dt_id').val());
var update_ludan_result = $('#update_ludan_result').val();
if(update_ludan_result == ''){
layer.msg('请选择要修改的结果');
return false;
}
webSocket.send('{"connect":"space","mode":"retreated","number_tab_id":"'+number_tab_id+'","boot_id":"'+boot_id+'","table_id":"'+table_id+'","game_id":"'+game_id+'","result":"'+update_ludan_result+'"}');
}
var confirmResult = function(id,result){
$('.control-box .btn-box2 span').eq(0).removeClass('on');
$('.control-box .btn-box2 span').eq(1).removeClass('on');
$('.control-box .btn-box2 span').eq(2).removeClass('on');
var is_on=$("#"+id).hasClass("on");
if(is_on){
$("#"+id).removeClass("on")
}else{
$("#"+id).addClass("on")
}
showPng_noVoice(result);
};
}else{
layer.msg('您的浏览器不支持WebSocket');
}
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.boot_id = $('#boot_id').val();
data.game_id = $('#game_id').val();
$.ajax({
url:"/tc/waybill",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
// 将数据结果存session
ludan = data;
// 执行画布刷新
requestData(ludan.waybill);
}
});
}
// 换靴时隐藏自动问路
var hiddenForecast = function(){
$('#bankerask').find('.circle').css('opacity',0);
$('#bankerask').find('.round').css('opacity',0);
$('#bankerask').find('.bar').css('opacity',0);
$('#playerask').find('.circle').css('opacity',0);
$('#playerask').find('.round').css('opacity',0);
$('#playerask').find('.bar').css('opacity',0);
}
function requestData(data){
smallH=$(".canvas-box.small").height();
smallW=$(".canvas-box.small").width();
// 计算单位
unitsmall=smallH/12;
// 计算列个数
colsmall=Math.floor(smallW/unitsmall);
if(colsmall%2!=0){
colsmall=colsmall-1
}
CanvasTable("#canvas1",unitsmall,12,colsmall,data);
}
function CanvasTable(Id,unit,rows,cols,data){
var width=unit*cols,
height=unit*rows;
$(Id).attr("width",width)
$(Id).attr("height",height)
$(Id).css("height",height)
var canvasId=$(Id);
var ctb=canvasId[0].getContext('2d');
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#919191";//线条颜色
ctb.beginPath();
ctb.moveTo(0, 0.5);
ctb.lineTo(width, 0.5);
for (var i = 0; i <= rows; i++) {
ctb.moveTo(0, unit*i);
ctb.lineTo(width, unit*i);
}
ctb.closePath()
ctb.stroke();
ctb.beginPath();
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, height);
for (var j = 1; j <= cols; j++) {
ctb.moveTo(unit*j*2,0);
ctb.lineTo(unit*j*2,height);
}
ctb.closePath()
ctb.stroke();
ctb.beginPath();
ctb.lineWidth = 1.5;//线条宽度
ctb.strokeStyle = "#000";//线条颜色
ctb.moveTo(0, unit*4);
ctb.lineTo(width, unit*4);
ctb.moveTo(0, unit*8);
ctb.lineTo(width, unit*8);
ctb.closePath()
ctb.stroke();
title(ctb,unit,1,1,1);
title(ctb,unit,1,2,2);
title(ctb,unit,1,3,3);
title(ctb,unit,1,4,4);
title(ctb,unit,1,5,1);
title(ctb,unit,1,6,2);
title(ctb,unit,1,7,3);
title(ctb,unit,1,8,4);
title(ctb,unit,1,9,1);
title(ctb,unit,1,10,2);
title(ctb,unit,1,11,3);
title(ctb,unit,1,12,4);
if(data){
$.each(data,function(i,v){
if(v.show_x<=(cols/2-1)){
showPath(ctb,unit,v.show_x,v.show_y,v.type,v.result,v.is_win)
}else if(v.show_x<=cols-1){
showPath(ctb,unit,v.show_x-(cols/2)+1,v.show_y+4,v.type,v.result,v.is_win)
}else if(v.show_x<=3*(cols/2)){
showPath(ctb,unit,v.show_x-cols+1,v.show_y+8,v.type,v.result,v.is_win)
}
})
}
}
function title(ctb,unit,x,y,type){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
if(type==1){
fonts= '庄家';
var font_color = '#b20a00';
}else if(type==2){
fonts= '闲一';
var font_color = '#0543bc';
}else if(type==3){
fonts= '闲二';
var font_color = '#0543bc';
}else if(type==4){
fonts= '闲三';
var font_color = '#0543bc';
}
if(type == 1){
var color = '#ffad97';
}else{
var color = '#73d8f7';
}
//背景色
ctb.fillStyle = color ; // 颜色
ctb.fillRect(x,(y-1)*unit,unit*2-1,unit-0.5);
ctb.fill();
//文字
ctb.font=unit*0.5+"px Arial";//字的大小
ctb.fillStyle = font_color ; // 颜色
ctb.textAlign = 'center'; //字的位置
ctb.textBaseline = 'middle';
ctb.fillText(fonts,radius+unit*(x/2),radius+unit*(y-1));
ctb.stroke();
}
function showPath(ctb,unit,x,y,type,result,is_win){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
if(type==1){
var font_color = '#b20a00';
}else{
var font_color = '#1e14d3';
}
if(result == 1){
var fonts = '牛1';
}else if(result == 2){
var fonts = '牛2';
}else if(result == 3){
var fonts = '牛3';
}else if(result == 4){
var fonts = '牛4';
}else if(result == 5){
var fonts = '牛5';
}else if(result == 6){
var fonts = '牛6';
}else if(result == 7){
var fonts = '牛7';
}else if(result == 8){
var fonts = '牛8';
}else if(result == 9){
var fonts = '牛9';
}else if(result == 10){
var fonts = '牛牛';
}else if(result == 11){
var fonts = '豹子';
}else if(result == 12){
var fonts = '同花顺';
}else if(result == 13){
var fonts = '皇家同花顺';
}
//背景色
if(is_win == 1){
if(type == 1){
ctb.fillStyle = '#b20a00' ; // 颜色
}else{
ctb.fillStyle = '#1e14d3' ; // 颜色
}
ctb.fillRect(unit*x*2,unit*(y-0.25),unit*2,unit*0.25);
ctb.fill();
win(ctb,unit,x,y);
}
//文字
ctb.font=unit*0.4+"px Arial";//字的大小
ctb.fillStyle = font_color ; // 颜色
ctb.textAlign = 'center'; //字的位置
ctb.textBaseline = 'middle';
ctb.fillText(fonts,2*x*unit+unit,radius+unit*(y-1));
ctb.stroke();
}
function win(ctb,unit,x,y){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
fonts = 'WIN';
ctb.font=unit*0.25+"px Arial";//字的大小
ctb.fillStyle = '#fff' ; // 颜色
ctb.textAlign = 'center'; //字的位置
ctb.textBaseline = 'middle';
ctb.fillText(fonts,2*x*unit+unit,unit*(y-0.11));
ctb.stroke();
}
// 大路
function BigPath(ctb,unit,x,y,type,slash,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#000";
var radius=unit/2||0;
if(type==1){
var color='#b20a00',
fonts= lang.banker;
ctb.strokeStyle = "#ff4a68";
}else if(type==2){
var color='#0543bc',
fonts= lang.player;
ctb.strokeStyle = "#7e7df6";
}else if(type==3){
var color='#1d8701',
fonts= lang.tie;
ctb.strokeStyle = "#71df57";
}
ctb.arc(radius+unit*(x-1), radius+unit*(y-1), unit*0.4, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
ctb.font=unit*0.45+"px Arial";
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,radius+unit*(x-1),radius+unit*(y-1));
ctb.stroke();
}
function countDown(time) {
var table_id = $('#table_id').val();
$(".countdown .num").html(time);
$(".countdown").fadeIn();
if(time<=0){
mp3List = ['stop_2.mp3'];
audioMp3(mp3List).Play();
$(".countdown").fadeOut();
webSocket.send('{"connect":"space","mode":"endBet","number_tab_id":"'+parseInt(number_tab_id)+'","table_id":"'+parseInt(table_id)+'"}');
return;
}
}
function notice(){
if (roll == -LiWidth) {
roll = 0;
}
roll -= 1;
$(".notice .scroll").css({
left: roll
})
}
function getTime() {
var today = new Date();
var h = today.getHours();
var minute = today.getMinutes()
var s = today.getSeconds();
if (h < 10) {
h = "0" + h;
}
if (minute < 10) {
minute = "0" + minute;
}
if (s < 10) {
s = "0" + s;
}
var strDate = (" " + today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日" + h + ":" + minute + ":" + s);
var n_day = today.getDay();
switch (n_day) {
case 0:
var week = " 星期日 "
break;
case 1:
var week = " 星期一 "
break;
case 2:
var week = " 星期二 "
break;
case 3:
var week = " 星期三 "
break;
case 4:
var week = " 星期四 "
break;
case 5:
var week = " 星期五 "
break;
case 6:
var week = " 星期六 "
break;
case 7:
var week = " 星期日 "
break;
}
$('.date').find('p').html(strDate);
$('.date').find('span').html(week);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,365 @@
// MIT License:
//
// Copyright (c) 2010-2012, Joe Walnes
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/**
* This behaves like a WebSocket in every way, except if it fails to connect,
* or it gets disconnected, it will repeatedly poll until it successfully connects
* again.
*
* It is API compatible, so when you have:
* ws = new WebSocket('ws://....');
* you can replace with:
* ws = new ReconnectingWebSocket('ws://....');
*
* The event stream will typically look like:
* onconnecting
* onopen
* onmessage
* onmessage
* onclose // lost connection
* onconnecting
* onopen // sometime later...
* onmessage
* onmessage
* etc...
*
* It is API compatible with the standard WebSocket API, apart from the following members:
*
* - `bufferedAmount`
* - `extensions`
* - `binaryType`
*
* Latest version: https://github.com/joewalnes/reconnecting-websocket/
* - Joe Walnes
*
* Syntax
* ======
* var socket = new ReconnectingWebSocket(url, protocols, options);
*
* Parameters
* ==========
* url - The url you are connecting to.
* protocols - Optional string or array of protocols.
* options - See below
*
* Options
* =======
* Options can either be passed upon instantiation or set after instantiation:
*
* var socket = new ReconnectingWebSocket(url, null, { debug: true, reconnectInterval: 4000 });
*
* or
*
* var socket = new ReconnectingWebSocket(url);
* socket.debug = true;
* socket.reconnectInterval = 4000;
*
* debug
* - Whether this instance should log debug messages. Accepts true or false. Default: false.
*
* automaticOpen
* - Whether or not the websocket should attempt to connect immediately upon instantiation. The socket can be manually opened or closed at any time using ws.open() and ws.close().
*
* reconnectInterval
* - The number of milliseconds to delay before attempting to reconnect. Accepts integer. Default: 1000.
*
* maxReconnectInterval
* - The maximum number of milliseconds to delay a reconnection attempt. Accepts integer. Default: 30000.
*
* reconnectDecay
* - The rate of increase of the reconnect delay. Allows reconnect attempts to back off when problems persist. Accepts integer or float. Default: 1.5.
*
* timeoutInterval
* - The maximum time in milliseconds to wait for a connection to succeed before closing and retrying. Accepts integer. Default: 2000.
*
*/
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof module !== 'undefined' && module.exports){
module.exports = factory();
} else {
global.ReconnectingWebSocket = factory();
}
})(this, function () {
if (!('WebSocket' in window)) {
return;
}
function ReconnectingWebSocket(url, protocols, options) {
// Default settings
var settings = {
/** Whether this instance should log debug messages. */
debug: false,
/** Whether or not the websocket should attempt to connect immediately upon instantiation. */
automaticOpen: true,
/** The number of milliseconds to delay before attempting to reconnect. */
reconnectInterval: 1000,
/** The maximum number of milliseconds to delay a reconnection attempt. */
maxReconnectInterval: 30000,
/** The rate of increase of the reconnect delay. Allows reconnect attempts to back off when problems persist. */
reconnectDecay: 1.5,
/** The maximum time in milliseconds to wait for a connection to succeed before closing and retrying. */
timeoutInterval: 2000,
/** The maximum number of reconnection attempts to make. Unlimited if null. */
maxReconnectAttempts: null,
/** The binary type, possible values 'blob' or 'arraybuffer', default 'blob'. */
binaryType: 'blob'
}
if (!options) { options = {}; }
// Overwrite and define settings with options if they exist.
for (var key in settings) {
if (typeof options[key] !== 'undefined') {
this[key] = options[key];
} else {
this[key] = settings[key];
}
}
// These should be treated as read-only properties
/** The URL as resolved by the constructor. This is always an absolute URL. Read only. */
this.url = url;
/** The number of attempted reconnects since starting, or the last successful connection. Read only. */
this.reconnectAttempts = 0;
/**
* The current state of the connection.
* Can be one of: WebSocket.CONNECTING, WebSocket.OPEN, WebSocket.CLOSING, WebSocket.CLOSED
* Read only.
*/
this.readyState = WebSocket.CONNECTING;
/**
* A string indicating the name of the sub-protocol the server selected; this will be one of
* the strings specified in the protocols parameter when creating the WebSocket object.
* Read only.
*/
this.protocol = null;
// Private state variables
var self = this;
var ws;
var forcedClose = false;
var timedOut = false;
var eventTarget = document.createElement('div');
// Wire up "on*" properties as event handlers
eventTarget.addEventListener('open', function(event) { self.onopen(event); });
eventTarget.addEventListener('close', function(event) { self.onclose(event); });
eventTarget.addEventListener('connecting', function(event) { self.onconnecting(event); });
eventTarget.addEventListener('message', function(event) { self.onmessage(event); });
eventTarget.addEventListener('error', function(event) { self.onerror(event); });
// Expose the API required by EventTarget
this.addEventListener = eventTarget.addEventListener.bind(eventTarget);
this.removeEventListener = eventTarget.removeEventListener.bind(eventTarget);
this.dispatchEvent = eventTarget.dispatchEvent.bind(eventTarget);
/**
* This function generates an event that is compatible with standard
* compliant browsers and IE9 - IE11
*
* This will prevent the error:
* Object doesn't support this action
*
* http://stackoverflow.com/questions/19345392/why-arent-my-parameters-getting-passed-through-to-a-dispatched-event/19345563#19345563
* @param s String The name that the event should use
* @param args Object an optional object that the event will use
*/
function generateEvent(s, args) {
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent(s, false, false, args);
return evt;
};
this.open = function (reconnectAttempt) {
ws = new WebSocket(self.url, protocols || []);
ws.binaryType = this.binaryType;
if (reconnectAttempt) {
if (this.maxReconnectAttempts && this.reconnectAttempts > this.maxReconnectAttempts) {
return;
}
} else {
eventTarget.dispatchEvent(generateEvent('connecting'));
this.reconnectAttempts = 0;
}
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'attempt-connect', self.url);
}
var localWs = ws;
var timeout = setTimeout(function() {
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'connection-timeout', self.url);
}
timedOut = true;
localWs.close();
timedOut = false;
}, self.timeoutInterval);
ws.onopen = function(event) {
clearTimeout(timeout);
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'onopen', self.url);
}
self.protocol = ws.protocol;
self.readyState = WebSocket.OPEN;
self.reconnectAttempts = 0;
var e = generateEvent('open');
e.isReconnect = reconnectAttempt;
reconnectAttempt = false;
eventTarget.dispatchEvent(e);
};
ws.onclose = function(event) {
clearTimeout(timeout);
ws = null;
if (forcedClose) {
self.readyState = WebSocket.CLOSED;
eventTarget.dispatchEvent(generateEvent('close'));
} else {
self.readyState = WebSocket.CONNECTING;
var e = generateEvent('connecting');
e.code = event.code;
e.reason = event.reason;
e.wasClean = event.wasClean;
eventTarget.dispatchEvent(e);
if (!reconnectAttempt && !timedOut) {
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'onclose', self.url);
}
eventTarget.dispatchEvent(generateEvent('close'));
}
var timeout = self.reconnectInterval * Math.pow(self.reconnectDecay, self.reconnectAttempts);
setTimeout(function() {
self.reconnectAttempts++;
self.open(true);
}, timeout > self.maxReconnectInterval ? self.maxReconnectInterval : timeout);
}
};
ws.onmessage = function(event) {
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'onmessage', self.url, event.data);
}
var e = generateEvent('message');
e.data = event.data;
eventTarget.dispatchEvent(e);
};
ws.onerror = function(event) {
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'onerror', self.url, event);
}
eventTarget.dispatchEvent(generateEvent('error'));
};
}
// Whether or not to create a websocket upon instantiation
if (this.automaticOpen == true) {
this.open(false);
}
/**
* Transmits data to the server over the WebSocket connection.
*
* @param data a text string, ArrayBuffer or Blob to send to the server.
*/
this.send = function(data) {
if (ws) {
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug('ReconnectingWebSocket', 'send', self.url, data);
}
return ws.send(data);
} else {
throw 'INVALID_STATE_ERR : Pausing to reconnect websocket';
}
};
/**
* Closes the WebSocket connection or connection attempt, if any.
* If the connection is already CLOSED, this method does nothing.
*/
this.close = function(code, reason) {
// Default CLOSE_NORMAL code
if (typeof code == 'undefined') {
code = 1000;
}
forcedClose = true;
if (ws) {
ws.close(code, reason);
}
};
/**
* Additional public API method to refresh the connection if still open (close, re-open).
* For example, if the app suspects bad data / missed heart beats, it can try to refresh.
*/
this.refresh = function() {
if (ws) {
ws.close();
}
};
}
/**
* An event listener to be called when the WebSocket connection's readyState changes to OPEN;
* this indicates that the connection is ready to send and receive data.
*/
ReconnectingWebSocket.prototype.onopen = function(event) {};
/** An event listener to be called when the WebSocket connection's readyState changes to CLOSED. */
ReconnectingWebSocket.prototype.onclose = function(event) {};
/** An event listener to be called when a connection begins being attempted. */
ReconnectingWebSocket.prototype.onconnecting = function(event) {};
/** An event listener to be called when a message is received from the server. */
ReconnectingWebSocket.prototype.onmessage = function(event) {};
/** An event listener to be called when an error occurs. */
ReconnectingWebSocket.prototype.onerror = function(event) {};
/**
* Whether all instances of ReconnectingWebSocket should log debug messages.
* Setting this to true is the equivalent of setting all instances of ReconnectingWebSocket.debug to true.
*/
ReconnectingWebSocket.debugAll = false;
ReconnectingWebSocket.CONNECTING = WebSocket.CONNECTING;
ReconnectingWebSocket.OPEN = WebSocket.OPEN;
ReconnectingWebSocket.CLOSING = WebSocket.CLOSING;
ReconnectingWebSocket.CLOSED = WebSocket.CLOSED;
return ReconnectingWebSocket;
});
@@ -0,0 +1 @@
!function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()}(this,function(){function a(b,c,d){function l(a,b){var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!1,!1,b),c}var e={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3};d||(d={});for(var f in e)this[f]="undefined"!=typeof d[f]?d[f]:e[f];this.url=b,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i=!1,j=!1,k=document.createElement("div");k.addEventListener("open",function(a){g.onopen(a)}),k.addEventListener("close",function(a){g.onclose(a)}),k.addEventListener("connecting",function(a){g.onconnecting(a)}),k.addEventListener("message",function(a){g.onmessage(a)}),k.addEventListener("error",function(a){g.onerror(a)}),this.addEventListener=k.addEventListener.bind(k),this.removeEventListener=k.removeEventListener.bind(k),this.dispatchEvent=k.dispatchEvent.bind(k),this.open=function(b){h=new WebSocket(g.url,c||[]),b||k.dispatchEvent(l("connecting")),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",g.url);var d=h,e=setTimeout(function(){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",g.url),j=!0,d.close(),j=!1},g.timeoutInterval);h.onopen=function(){clearTimeout(e),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",g.url),g.protocol=h.protocol,g.readyState=WebSocket.OPEN,g.reconnectAttempts=0;var d=l("open");d.isReconnect=b,b=!1,k.dispatchEvent(d)},h.onclose=function(c){if(clearTimeout(e),h=null,i)g.readyState=WebSocket.CLOSED,k.dispatchEvent(l("close"));else{g.readyState=WebSocket.CONNECTING;var d=l("connecting");d.code=c.code,d.reason=c.reason,d.wasClean=c.wasClean,k.dispatchEvent(d),b||j||((g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",g.url),k.dispatchEvent(l("close")));var e=g.reconnectInterval*Math.pow(g.reconnectDecay,g.reconnectAttempts);setTimeout(function(){g.reconnectAttempts++,g.open(!0)},e>g.maxReconnectInterval?g.maxReconnectInterval:e)}},h.onmessage=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",g.url,b.data);var c=l("message");c.data=b.data,k.dispatchEvent(c)},h.onerror=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",g.url,b),k.dispatchEvent(l("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(b){if(h)return(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",g.url,b),h.send(b);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(a,b){"undefined"==typeof a&&(a=1e3),i=!0,h&&h.close(a,b)},this.refresh=function(){h&&h.close()}}return a.prototype.onopen=function(){},a.prototype.onclose=function(){},a.prototype.onconnecting=function(){},a.prototype.onmessage=function(){},a.prototype.onerror=function(){},a.debugAll=!1,a.CONNECTING=WebSocket.CONNECTING,a.OPEN=WebSocket.OPEN,a.CLOSING=WebSocket.CLOSING,a.CLOSED=WebSocket.CLOSED,a});
+197
View File
@@ -0,0 +1,197 @@
class WebSocketClass {
constructor (wsUrl) {
this.successFn = {} // 成功的回掉函数
this.wsUrl = wsUrl // 请求的url
this.errorCallBackFunArr = [] // 当推送异常时执行的数组
this.isConnection = false // 判断是否支持weosocket
this.isErrorCallBack = false
this.lockReconnect = false // 避免重复连接
this.ping = null
this.sendObj = {}
this.heartCheck()
this.createWebSocket()
}
createWebSocket () {
try {
this.webSocket = new WebSocket(this.wsUrl)
this.initEventHandle()
} catch (e) {
this.errorCallBackData()
this.reconnect(this.wsUrl)
}
}
initEventHandle () {
this.webSocket.onclose = () => {
this.errorCallBackData()
this.reconnect(this.wsUrl)
}
this.webSocket.onerror = () => {
this.errorCallBackData()
this.reconnect(this.wsUrl)
}
this.webSocket.onopen = () => {
this.isConnection = true
this.isErrorCallBack = false
clearInterval(this.ping)
this.ping = setInterval(() => {
this.send('{"event": "ping"}')
}, 10000)
// 心跳检测重置
this.heartCheck.start()
}
this.webSocket.onmessage = data => {
// 如果获取到消息,心跳检测重置
// 拿到任何消息都说明当前连接是正常的
this.heartCheck.start()
this.decodeData(data)
}
}
send(cmd) {
// 只有当 webSocket.readyState 为 OPEN才发送订阅
// readyState属性返回实例对象的当前状态,共有四种。
// CONNECTING:值为0,表示正在连接。
// OPEN:值为1,表示连接成功,可以通信了。
// CLOSING:值为2,表示连接正在关闭。
// CLOSED:值为3,表示连接已经关闭,或者打开连接失败。
if (!cmd) {
return
}
// this.sendObj[cmd] && (delete clearTimeout(this.sendObj[cmd]))
if (this.webSocket.readyState === 1) { // 只有当链接打开时才进行订阅
this.webSocket.send(cmd)
}
// else if (this.webSocket.readyState === 0) { // 如果链接处于正在链接中,则进行延时订阅
// this.sendObj[cmd] = setTimeout(() => {
// this.send(cmd)
// }, 50)
// }
}
reconnect (url) {
if (this.lockReconnect) {
return
}
this.lockReconnect = true
// 没连接上会一直重连,设置延迟避免请求过多
setTimeout(() => {
this.createWebSocket(url)
this.lockReconnect = false
}, 2000)
}
errorCallBackData () {
this.isConnection = false
if (!this.isErrorCallBack && this.errorCallBackFunArr.length) {
this.isErrorCallBack = true
for (let i = 0, len = this.errorCallBackFunArr.length; i < len; i++) {
if ((typeof this.errorCallBackFunArr[i]) === 'function') {
this.errorCallBackFunArr[i]()
}
}
}
}
decodeData (data) {
if (data.data instanceof Blob) {
let blob = data.data
// js中的blob没有没有直接读出其数据的方法,通过FileReader来读取相关数据
let reader = new FileReader()
reader.readAsArrayBuffer(blob)
// 当读取操作成功完成时调用.
reader.onload = (evt) => {
if (evt.target.readyState === FileReader.DONE) {
let result = new Uint8Array(evt.target.result)
// 如果后端进行压缩数据处理(zlib),那么要引入解析zlib的js
result = (new window.Zlib.RawInflate(result)).decompress()
let strResult = ''
let length = result.length
for (let i = 0; i < length; i++) {
strResult += String.fromCharCode(result[i])
}
this.callBackData(JSON.parse(strResult))
}
}
return
}
let d = JSON.parse(data.data)
// 如果后端需要等待,则返回code:10010,过一段时间后重新订阅
if (d.code === '10010') {
let dt = {}
Object.assign(dt, d)
delete dt.code
delete dt.msg
setTimeout(() => {
this.send(JSON.stringify(dt))
}, 2000)
return
}
this.callBackData(JSON.parse(data.data))
}
callBackData (data) {
if (data instanceof Array) {
for (let i = 0; i < data.length; i++) {
this.doCallback(data[i])
}
} else if (data instanceof Object) {
if (data.hasOwnProperty('event') && data.event === 'pong') {
return
}
data.payload && (data.payload = JSON.parse(data.payload))
this.doCallback(data)
}
}
doCallback (data) {
if (data.event) {
let fn = this.successFn[data.event]
if (typeof fn === 'function') {
fn(data)
}
}
}
// 心跳检测
heartCheck () {
let that = this
this.heartCheck = {
timeout: 10000, // 10秒
timeoutObj: null,
serverTimeoutObj: null,
reset: function () {
clearTimeout(this.timeoutObj)
clearTimeout(this.serverTimeoutObj)
},
start: function () {
this.reset()
let self = this
this.timeoutObj = setTimeout(function () {
// 这里发送一个心跳,后端收到后,返回一个心跳消息
// onmessage拿到返回的心跳就说明连接正常
that.send('{"event": "ping"}')
self.serverTimeoutObj = setTimeout(function () { // 如果超过一定时间还没重置,说明后端主动断开了
// 如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
that.webSocket.close()
}, self.timeout)
}, this.timeout)
}
}
}
}
function webSocketFn (url) {
let wb = new WebSocketClass(url)
return {
webSocketSend: wb.send.bind(wb),
errorCallBackFunArr: wb.errorCallBackFunArr,
successFn: wb.successFn,
isConnection: function () {
return wb.isConnection
},
getSocketFile (webSocketData, ajaxData) {
let socketFail = (isFirst) => {
if (this.isConnection()) {
webSocketData()
} else {
ajaxData()
setTimeout(socketFail, 2000)
}
}
return socketFail
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Some files were not shown because too many files have changed in this diff Show More