Commit 8f5821e0 authored by Mac's avatar Mac
parents fdbbd215 f37c2cc6
......@@ -173,15 +173,15 @@
}).fail(data => {});
getMsg()
let i = 110;
let i = 101;
createPage()
function createPage() {
if (i === 160) return
window.open(`./test.html?id=${i}&name=ABC${i}`)
if (i === 200) return
window.open(`./test1.html?id=${i}&name=ABC${i}`)
i++
setTimeout(()=>{
createPage()
}, 1000)
}, 500)
}
function sendMsg(msg,type) {
//0,未开始;1,准备中;2,进行中;-1,已结束 菜单状态
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="full-screen" content="true">
<meta name="screen-orientation" content="portrait">
<meta name="x5-fullscreen" content="true">
<meta name="360-fullscreen" content="true">
<link rel="stylesheet" href="css/money.css" type="text/css" />
<title>疯狂数钞票</title>
</head>
<body style="height: 100%;overflow: hidden;width: 100%;position: fixed;">
<audio src="video/welcom_money.mp3" id="sound" autoplay></audio>
<a id="goali" href="alipays://platformapi/startapp" target="_blank" style="position: absolute;z-index: -1;">GO</a>
<div class="money_count">
<div class="useropera">
<div class="content-opt-title">
<button type="button" class="home" id="back_ico"></button>
<span class="title">疯狂数钞票</span>
<button type="button" class="rank" id="rankBtn"></button>
</div>
</div>
<div class="score">分数:<span id="my_score">0</span></div>
<div class="timer">
倒计时:<span id="time">30</span>
<img class="ico" src="img/money/timer.png"/>
</div>
<div class="reg_bag" style='background-image: url("img/money/red_bag.png")'></div>
<div class="money_box">
<img src="img/money/money.png" alt=""/>
</div>
<div class="wait_tips" id="wait_tips"></div>
<div class="mask"></div>
<div class="gold"></div>
<div id="touchBox"></div>
<!-- <input type="button" value="开始" id="Start" style="z-index:9999;position: fixed;top:0;">
<input type="button" value="重置" id="reset" style="z-index:9999;position: fixed;top:0;left:40px;"> -->
<!-- <div class="time">
<div class="time-txt">倒计时</div>
<span>
<span id="time">0</span>秒
</span>
</div> -->
<div class="tipsDiv">保存体力,等待开始</div>
<div class="circleCount">3</div>
</div>
<div class="play_tips" id="play_tips">
<div class="arrow"></div>
<div class="hand"></div>
</div>
<!-- <div class="opt">
<div class="back_ico" id="back_ico"></div>
<div class="rank_ico" id="rankBtn"></div>
</div> -->
<div class="rank_mask" id="smm">
<div style="height:3rem"></div>
<div class="close" id="closeBtn"></div>
<div class="rank_list_box">
<div class="rank_dec"></div>
<div class="rank_list_ranking">
<div class="rank_list_rankingBs">
<div class="my_rank">
<p class="my_rankTop" style="padding:1.5rem 0 0.2rem 0">
<span class="my-rank-title">您当前排名为</span>&nbsp;&nbsp;
<span class="rank_myTop" id="myTop"></span>&nbsp;&nbsp;
</p>
</div>
<div class="rank" id="rankBox" style="height: 29rem;"></div>
</div>
</div>
</div>
</div>
<div class="rank_mask rank_mask2" id="notice">
<div class="zhezao"></div>
<div class="notice_box">
<img src="../../images/aM/all_d.png" alt="" class="notice_top">
<span>恭喜你获得支付宝口令红包</span>
<input class="notice_content" id="tokenReadPackage" readonly="readonly" value="" />
<button class="all_Receive" id="getAliPay" data-clipboard-action="copy" data-clipboard-target="#tokenReadPackage">
复制并领取
</button>
<div class="all_Close"></div>
</div>
</div>
</body>
<script type="text/javascript" src="../../js/jquery-1.10.2.js"></script>
<script src="../../js/moveJs/jquery.signalR.min.js"></script>
<script src="js/clipboard.min.js"></script>
<script src="../../js/mian.js"></script>
<script>
//ios禁止被拖动
let userInfo = {
id: '66',
name: '1asd'
}
if(window.location.href.split('?')[1]){
var param = window.location.href.split('?')[1].split("&") ? window.location.href.split('?')[1].split("&") : null;
userInfo.id = param ? param[0].split('=')[1] : 0;
userInfo.name = param ? param[1].split('=')[1] : 0;
}
document.body.addEventListener('touchmove', function (e) {
e.preventDefault();
}, {passive: false});
let conn;
let proxy;
let status=0;
let clock=null;
let isWinning=false;
var EmployeeId = userInfo.id + '_Money';
// clipboard.on('success', function(e) {
// console.log(e);
// });
// clipboard.on('error', function(e) {
// console.log(e);
// });
function getMyRank(){
proxy.invoke('GetUserRank','Money',EmployeeId).done(r=>{
console.log(r);
if(r.r!=-1){
$('#myTop').html(r.r);
}else{
$('#myTop').html('未上榜');
}
$('#my_score').html(r.s);
})
}
function GetStatus(){
proxy.invoke("GetMenuStatus", "Money").done(m => {
if (m.status == -1) {
getMyRank();
proxy.invoke('GetGameResult','Money').done(d=>{
var html=''
if(d && d.length>0){
for (var i=0;i<d.length;i++) {
html+='<div class="rank-row"><span class="rank-num num'+(i+1)+'">'+(i>2?(i+1)+"":"")+'</span><img src="'+d[i].p+'"/>'
html+='<span class="rank-name">'+d[i].n+'</span><span class="rank-score">'+d[i].s+'</span></div>'
}
}
$("#rankBox").html(html);
$('.play_tips').css('display','none');
$('.tipsDiv').text('游戏已经结束咯');
//$('.rank_mask').css('display','block');
});
}else if(m.status==2){
$('.play_tips').css('display','none');
$('.tipsDiv').text('你来晚了,游戏已经开始了');
proxy.on("notifyGamerResult",function(d){
var html=''
if(d && d.length>0){
for (var i=0;i<d.length;i++) {
html+='<div class="rank-row"><span class="rank-num num'+(i+1)+'">'+(i>2?i+"":"")+'</span><img src="'+d[i].p+'"/>'
html+='<span class="rank-name">'+d[i].n+'</span><span class="rank-score">'+d[i].s+'</span></div>'
}
}
$("#rankBox").html(html);
getMyRank();
});
}
});
}
function initConnection(){
var conn = $.hubConnection(getApiUrl().urlSignalr, {
qs: `i=${userInfo.id}&n=${userInfo.name}&p=http://192.168.2.214:8130/Upload/Temporary/20200103060438316.jpg}&e=2018-01-02`
});
proxy = conn.createHubProxy("annualLeaveHub");
conn.start().done(data => {
console.log('connection 链接成功');
GetStatus();
winning();
}).fail(data => {
console.log('链接失败:'+data)
});
}
function winning(){
proxy.on("notifyWinning",function(d){
//alert("恭喜你中奖了:"+d);
$("#sound").attr("src","video/zhongjiang.mp3");
$('#notice').css('display','flex');
$('#tokenReadPackage').val(d);
$("#smm").css('display','none');
})
}
this.initConnection()
$(function () {
var clipboard = new Clipboard('.all_Receive');
var music=document.getElementById('music');
var money_en = $("body");
//传递后台的分数
var i= 0;
var off =true;
var Count=3;
var Count2=30;
proxy.on("notifyGamerResult",function(d){
console.log(d)
var html=''
if(d && d.length>0){
for (var i=0;i<d.length;i++) {
html+='<div class="rank-row"><span class="rank-num num'+(i+1)+'">'+(i>2?i+"":"")+'</span><img src="'+d[i].p+'"/>'
html+='<span class="rank-name">'+d[i].n+'</span><span class="rank-score">'+d[i].s+'</span></div>'
}
}
$("#rankBox").html(html);
getMyRank();
});
// proxy.on("notifyGamerResult",function(d){
// var html=''
// if(d && d.length>0){
// for (var i=0;i<d.length;i++) {
// html+='<div class="rank-row"><span class="rank-num num'+(i+1)+'">'+(i>2?i+"":"")+'</span><img src="'+d[i].p+'"/>'
// html+='<span class="rank-name">'+d[i].n+'</span><span class="rank-score">'+d[i].s+'</span></div>'
// }
// }
// $("#rankBox").html(html);
// });
//点击关闭统计弹窗
$('.close').click(function(){
$('#smm').css('display','none');
});
$('#getAliPay').click(function(){
setTimeout(function(){
let data = {
'action': 'Linking',
}
window.postMessage(JSON.stringify(data));
},500);
});
//点击查看排行榜
$('#rankBtn').click(function(){
$('#smm').css('display','block');
});
$('.all_Close').click(function () {
$('#notice').css('display','none')
})
proxy.on("getChangeMenu", function(data) {
if (data.code == "Money") {
if(data.status==2){
StartGame();
}else if(data.status==1||data.status==0){
//conn.disconnect();
//initConnection();
$('.play_tips').css('display','block');
$('#notice').css('display','none');
$('#smm').css('display','none');
$('.tipsDiv').text('保存体力,等待开始');
if(data.status==1){
proxy.invoke('JoinGame','Money').done(data=>{
});
}
$("#rankBox").html("");
$("#my_score").html("0");
}else if(data.status==-1){
window.clearInterval(clock);
clock=null;
getMyRank();
//显示统计窗口
$('#smm').css('display','block');
$('.play_tips').css('display','none');
$('.tipsDiv').text('游戏已经结束咯');
$('.tipsDiv').css('display','block');
$("#sound").attr("src","video/gameover.mp3");
}
}
})
//游戏开始
function StartGame(){
$("#sound").attr("src","video/ready321go.mp3");
//$("#sound").play();
//3秒倒计时
$('.circleCount').html("Ready");
Count=4;
Count2=30;
$('.circleCount').css('display','block');
$('.tipsDiv').css('display','block');
$('.play_tips').css('display','none');
var clockReady = window.setInterval(function(){
if(Count==1){
$('.circleCount').html("GO");
}else{
$('.circleCount').html(Count-1);
}
Count--;
$('.circleCount').html(Count);
if(Count==0){
$('.circleCount').css('display','none');
$('.tipsDiv').css('display','none');
window.clearInterval(clockReady);
Count30();
startMove();
}
}, 1000);
}
//30秒倒计时
function Count30(){
$("#time").html(30);
clock = window.setInterval(function() {
Count2--;
$("#time").html(Count2);
if (Count2 === 0) {
window.clearInterval(clock);
//显示统计窗口
$('#smm').css('display','block');
}
}, 1000)
}
function startMove(){
let startX=0;
let startY=0;
money_en.on("touchstart", function(e) {
if (e.cancelable) {
// 判断默认行为是否已经被禁用
// if (!e.defaultPrevented) {
// e.preventDefault();
// }
}
startX = e.originalEvent.changedTouches[0].pageX;
startY = e.originalEvent.changedTouches[0].pageY;
});
money_en.on("touchend", function(e) {
if (e.cancelable) {
// 判断默认行为是否已经被禁用
// if (!e.defaultPrevented) {
// e.preventDefault();
// }
$('.play_tips').css('display','none');
}
moveEndX = e.originalEvent.changedTouches[0].pageX;
moveEndY = e.originalEvent.changedTouches[0].pageY;
X = moveEndX - startX;
Y = moveEndY - startY;
if ( Y < 0 ) {
//music.play();
if(off){
var time= setInterval(function () {
if(Count2==0){
clearInterval(time);
$(".money_box").remove();
}
},1000);
}
off =false;
// setTimeout(function () {
// music.play();
// },10);
// music.playbackRate = 4;
// music.defaultPlaybackRate = 4;
$(".money_box").find('img').animate({
"top":"-1000"
},400, function () {
$(this).remove();
i+=100;
proxy.invoke("SetGameScore","Money", 100).done(msg => {
// dosomething
$("#my_score").html(msg)
});
//$(".money_add span").html("¥"+i)
});
setTimeout(function () {
$(".money_box").append('<img src="img/money/money.png">');
},100)
}
});
}
document.addEventListener("WeixinJSBridgeReady", function () {
music.load();
}, false);
});
</script>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment