修改活动结束时间异常问题以及跳转房间问题

This commit is contained in:
Dragon
2023-11-15 14:31:44 +08:00
parent cfb313281a
commit fe010cd895
3 changed files with 25 additions and 17 deletions

View File

@@ -273,13 +273,13 @@ body {
} }
.top3 .no2 p { .top3 .no2 p {
width: 100%; width: 90%;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 0.42667rem; font-size: 0.42667rem;
font-weight: 500; font-weight: 500;
position: absolute; position: absolute;
left: 0; left: 0.13333rem;
top: 3.73333rem; top: 3.73333rem;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@@ -340,13 +340,13 @@ body {
} }
.top3 .no3 p { .top3 .no3 p {
width: 100%; width: 90%;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 0.42667rem; font-size: 0.42667rem;
font-weight: 500; font-weight: 500;
position: absolute; position: absolute;
left: 0; left: 0.26667rem;
top: 3.73333rem; top: 3.73333rem;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@@ -275,13 +275,13 @@ body {
} }
p { p {
width: 100%; width: 90%;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: px2rem(32); font-size: px2rem(32);
font-weight: 500; font-weight: 500;
position: absolute; position: absolute;
left: 0; left: px2rem(10);
top: px2rem(280); top: px2rem(280);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@@ -342,13 +342,13 @@ body {
} }
p { p {
width: 100%; width: 90%;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: px2rem(32); font-size: px2rem(32);
font-weight: 500; font-weight: 500;
position: absolute; position: absolute;
left: 0; left: px2rem(20);
top: px2rem(280); top: px2rem(280);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@@ -67,7 +67,12 @@ function getRank (rankType, date) {
// 处理倒计时 // 处理倒计时
if (rankType == 1) { if (rankType == 1) {
const curTime = res.timestamp const curTime = res.timestamp
const endTime = (new Date(`${res.data.dateList[res.data.dateList.length - 1]} 23:59:59`).getTime()) var endTime = null;
if (browser.ios) {
endTime = (new Date(`${res.data.dateList[res.data.dateList.length - 1]} 11:59:59`.replace(/-/g, "/")).getTime())
} else {
endTime = (new Date(`${res.data.dateList[res.data.dateList.length - 1]} 11:59:59`).getTime())
}
leftTime = endTime - res.timestamp; leftTime = endTime - res.timestamp;
const hadEnd = (endTime - curTime) <= 0 const hadEnd = (endTime - curTime) <= 0
if (hadEnd) { if (hadEnd) {
@@ -106,7 +111,7 @@ function getRank (rankType, date) {
str += ` str += `
<li> <li>
<div class="num">${res.ranking}</div> <div class="num">${res.ranking}</div>
<img src="${res.avatar}" alt="" class="tx"> <img src="${res.avatar}" uid=${res.uid} alt="" class="tx">
<div class="box"> <div class="box">
<p>${res.nick}</p> <p>${res.nick}</p>
<span>ID: ${res.erbanNo}</span> <span>ID: ${res.erbanNo}</span>
@@ -175,7 +180,12 @@ function countup () {
var s = 0; var s = 0;
//定义变量 d,h,m,s保存倒计时的时间 //定义变量 d,h,m,s保存倒计时的时间
var d, h, m, s; var d, h, m, s;
if (leftTime > 0) { //递归每秒调⽤countTime⽅法显⽰动态时间效果
if (leftTime >= 0 && leftTime < 1000) {
rankType = 2;
date = null;
getRank(rankType, date);
} else if (leftTime > 1000) {
d = getzf(Math.floor(leftTime / 1000 / 60 / 60 / 24)); d = getzf(Math.floor(leftTime / 1000 / 60 / 60 / 24));
h = getzf(Math.floor(leftTime / 1000 / 60 / 60 % 24)); h = getzf(Math.floor(leftTime / 1000 / 60 / 60 % 24));
m = getzf(Math.floor(leftTime / 1000 / 60 % 60)); m = getzf(Math.floor(leftTime / 1000 / 60 % 60));
@@ -185,11 +195,6 @@ function countup () {
$('.time .sp2').text(h); $('.time .sp2').text(h);
$('.time .sp3').text(m); $('.time .sp3').text(m);
$('.time .sp4').text(s); $('.time .sp4').text(s);
leftTime = leftTime - 1000;
//递归每秒调⽤countTime⽅法显⽰动态时间效果
} else if (leftTime == 0) {
getRank(rankType, date);
return
} else { } else {
//todo 展示活动已结束 //todo 展示活动已结束
$('.timeOutTab').show(); $('.timeOutTab').show();
@@ -197,6 +202,9 @@ function countup () {
$('.tab').hide(); $('.tab').hide();
$('.time').hide(); $('.time').hide();
} }
if (leftTime > 0){
leftTime = leftTime - 1000;
}
timeOut2 = setTimeout(countup, 1000); timeOut2 = setTimeout(countup, 1000);
} }
//补0操作 //补0操作
@@ -220,6 +228,7 @@ $('.top3 .no .ts').on('click', function () {
// 点击非前三按钮 // 点击非前三按钮
$('.list').on('click', 'li .tx', function () { $('.list').on('click', 'li .tx', function () {
var uid = $(this).attr('uid'); var uid = $(this).attr('uid');
console.log(uid);
if (browser.ios) { if (browser.ios) {
window.webkit.messageHandlers.openRoom.postMessage(uid); window.webkit.messageHandlers.openRoom.postMessage(uid);
} else if (browser.android) { } else if (browser.android) {
@@ -227,5 +236,4 @@ $('.list').on('click', 'li .tx', function () {
window.androidJsObj.openRoom(uid); window.androidJsObj.openRoom(uid);
} }
} }
}) })