|
@@ -62,21 +62,12 @@ var uid = getQueryString('uid');
|
|
|
var uname = getQueryString('uname');
|
|
|
var round_id = getQueryString('round_id');
|
|
|
if (!uid || !uname) {
|
|
|
- window.location.href = "https://www.100t.com/gjnh/2022.php";
|
|
|
+ // window.location.href = "http://www.100t.com/gjnh/2022.php";
|
|
|
} else {
|
|
|
$.post(registUrl, JSON.stringify({
|
|
|
uid,
|
|
|
uname
|
|
|
- }), function(res) {
|
|
|
- if (res.status == 0 && res.game_status == 0) {
|
|
|
- $load.fadeOut(function() {
|
|
|
- $(this).remove();
|
|
|
- init();
|
|
|
- $ren.html(res.data.length);
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+ }), function(res) {})
|
|
|
waiting(function() {
|
|
|
preload(["bg.png", "figure.png", "img1.png", "img2.png", "img3.png", "line.png",
|
|
|
"qus-top.png",
|
|
@@ -86,7 +77,6 @@ if (!uid || !uname) {
|
|
|
$load.fadeOut(function() {
|
|
|
$(this).remove();
|
|
|
init();
|
|
|
- $ren.html(res.data.length);
|
|
|
});
|
|
|
})
|
|
|
})
|
|
@@ -117,13 +107,11 @@ function init() {
|
|
|
}
|
|
|
|
|
|
getIn(me.$id, 1, 1, "20ms");
|
|
|
- console.log(peopleArr);
|
|
|
clearTimeout(timer1);
|
|
|
}, 100);
|
|
|
|
|
|
setTimeout(function() {
|
|
|
startQues();
|
|
|
- // getCounter();
|
|
|
}, 1000);
|
|
|
}
|
|
|
|
|
@@ -139,7 +127,6 @@ function getIn(str, i, j, delay) {
|
|
|
function startQues() {
|
|
|
if (!me.$id.hasClass('row1')) {
|
|
|
postAns(-1, 0, 30);
|
|
|
- console.log("失败");
|
|
|
fail();
|
|
|
isQuesEnd = true;
|
|
|
window.clearInterval(timer);
|
|
@@ -165,7 +152,7 @@ function startQues() {
|
|
|
}
|
|
|
quesCount--;
|
|
|
$countDown.html(quesCount);
|
|
|
- }, 100);
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
|
isQuesEnd = true;
|
|
|
clearTimeout(quesTimer);
|
|
@@ -188,7 +175,6 @@ function nextGame(ques) {
|
|
|
$(".row0").removeClass("row0");
|
|
|
$(".row2").removeClass("row2").addClass("row1");
|
|
|
}
|
|
|
- console.log(trapHtml);
|
|
|
$trap.html(trapHtml).show();
|
|
|
setTimeout(function() {
|
|
|
var $rows = $(".row1"),
|
|
@@ -235,11 +221,13 @@ function getRandAns() {
|
|
|
var tempPeople = peopleArr.concat();
|
|
|
for (var i = 0; i < 3; i++) {
|
|
|
for (var j = 0; j < 36; j++) {
|
|
|
+ if (i == 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if (j == 1) {
|
|
|
continue;
|
|
|
}
|
|
|
var rand = Math.floor(Math.random() * tempPeople.length);
|
|
|
- console.log(rand, tempPeople[rand]);
|
|
|
var id = tempPeople.splice(rand, 1)[0];
|
|
|
delay = Math.floor(Math.random() * 3000) + "ms";
|
|
|
if (id) {
|
|
@@ -284,12 +272,15 @@ $("#ansBox").on("click", ".ans", function() {
|
|
|
$this.addClass("active").siblings().removeClass("active");
|
|
|
removePos(me.$id).removeAttr("style").addClass("d" + dataId + "-" + 1).addClass("row" + dataId);
|
|
|
me.row = dataId;
|
|
|
- var iscorrect = -1,
|
|
|
- time = quesEnd - quesCount;
|
|
|
+ var ans = -1,
|
|
|
+ time = quesEnd - quesCount,
|
|
|
+ iscorrect = 0;
|
|
|
if (quesData[quesFlag].right == "A") {
|
|
|
+ ans = dataId == 0 ? 1 : 0;
|
|
|
iscorrect = dataId == 0 ? 1 : 0;
|
|
|
- } else if (quesData[quesFlag].right == "A") {
|
|
|
- iscorrect = dataId == 2 ? 0 : 1;
|
|
|
+ } else if (quesData[quesFlag].right == "B") {
|
|
|
+ ans = dataId == 2 ? 0 : 1;
|
|
|
+ iscorrect = dataId == 2 ? 1 : 0;
|
|
|
}
|
|
|
postAns(ans, iscorrect, time);
|
|
|
}
|
|
@@ -331,7 +322,6 @@ function reconnect(service) {
|
|
|
}
|
|
|
}
|
|
|
var isWait = true;
|
|
|
-
|
|
|
var timer = null;
|
|
|
|
|
|
function waiting(callback) {
|
|
@@ -346,24 +336,32 @@ function waiting(callback) {
|
|
|
}
|
|
|
ws.onmessage = function(e) {
|
|
|
var res = JSON.parse(e.data);
|
|
|
- if (res.status == 1 && isWait) {
|
|
|
+ if (res.status == 1 && isWait&& res.game_status == 1) {
|
|
|
+ window.location.href = "gameready.html";
|
|
|
+ }
|
|
|
+ if (res.status == 1 && isWait && res.game_status != 1) {
|
|
|
isWait = false;
|
|
|
callback();
|
|
|
}
|
|
|
- if (res.status == 2 && !isWait && game_status != 1) {
|
|
|
+ if (res.status == 2 && !isWait && res.game_status == 1) {
|
|
|
isQuesEnd = true;
|
|
|
clearTimeout(quesTimer);
|
|
|
success();
|
|
|
}
|
|
|
+ /* if(res.status == 1 && !isWait && res.data.length<100){
|
|
|
+ isQuesEnd = true;
|
|
|
+ clearTimeout(quesTimer);
|
|
|
+ window.clearInterval(timer);
|
|
|
+ success();
|
|
|
+ } */
|
|
|
$ren.html(res.data.length);
|
|
|
}
|
|
|
ws.onclose = function() {
|
|
|
console.log("closed...")
|
|
|
window.clearInterval(timer)
|
|
|
- //这里仿照page.html添加上重连机制
|
|
|
- reconnect(wsWaitUrl)
|
|
|
+ //这里仿照page.html、
|
|
|
+ ws.onerror = function(err) {
|
|
|
+ window.clearInterval(timer)
|
|
|
+ };
|
|
|
}
|
|
|
- ws.onerror = function(err) {
|
|
|
- window.clearInterval(timer)
|
|
|
- };
|
|
|
}
|