完善所有中秋活动

This commit is contained in:
Dragon
2023-09-20 14:46:37 +08:00
parent 4848b27c51
commit b1807e8f52
6 changed files with 158 additions and 15 deletions

View File

@@ -132,9 +132,6 @@ body::-webkit-scrollbar {
background-size: 100% 100%;
}
.page1 .play1 {
display: none;
}
.page1 .play1 .playBox {
width: 9.72rem;
height: 11.8933333333rem;
@@ -402,6 +399,9 @@ body::-webkit-scrollbar {
.page1 .play2 .playBox2 .task .taks5 .but {
margin-top: 0.48rem;
}
.page1 .play3 {
display: none;
}
.page1 .play3 .draw {
width: 9.0666666667rem;
height: 9.8133333333rem;

View File

@@ -160,7 +160,7 @@ body {
// display: none;
.play1 {
display: none;
// display: none;
.playBox {
width: px2rem(729, );
@@ -471,7 +471,7 @@ body {
}
.play3 {
// display: none;
display: none;
.draw {
width: px2rem(680, );

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -53,8 +53,8 @@
<img src="./images/dividerecords.png" alt="" class="dividerecords">
<div class="dosBg">
<img src="./images/h3Title.png" alt="" class="h3Title">
<b>88888888</b>
<p><span>00</span><span>00</span><span>00</span></p>
<b>0</b>
<p><span class="span1">00</span><span class="span2">00</span><span class="span3">00</span></p>
</div>
</div>
<div class="bRuleBg">

View File

@@ -36,6 +36,9 @@ var moonCakeNum = 0;//我的
var page = 1;//抽奖页码
var drawPageSizeLack = true;//抽奖锁
var drawLock = true;//控制抽奖锁
var dynamicWorldId;//话题id
var timeOut2;//时间戳存储器
var leftTime;//倒计时暂存
// 初始化函数
$(function () {
getInfoFromClient()
@@ -59,6 +62,7 @@ $(function () {
swiperFun();
getConfig();
getRecommendRoom();
jackpotConfig();
}, 100)
})
// 获取月饼券接口
@@ -103,6 +107,70 @@ function getRecommendRoom () {
}
})
}
// 获取瓜分接口
function jackpotConfig () {
showLoading()
networkRequest({
type: 'GEt',
url: urlPrefix + '/act/2023MidAutumn/jackpot/getConfig',
success (res) {
if (res.code === 200) {
// 处理瓜分按钮状态
$('.page1 .play1 .bRuleBg .guafenBut').attr('src', res.data.allotStatus == 0 ? './images/guafenBut2.png' : res.data.allotStatus == 1 ? './images/guafenBut.png' : './images/guafenBut3.png')
if (res.data.allotStatus == 1) {
$('.page1 .play1 .bRuleBg .guafenBut').attr('click', 1);
}
// 设置当前奖池数量
$('.page1 .play1 .playBox .dosBg b').text(res.data.jackpotDiamonds);
// 设置倒计时
leftTime = res.data.jackpotEndTime - res.timestamp;
countup();
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('网络错误,请退出重进')
}
})
}
// 倒计时
function countup () {
clearTimeout(timeOut2)
//获取当前时间
var d = 0;
var h = 0;
var m = 0;
var s = 0;
//定义变量 d,h,m,s保存倒计时的时间
var d, h, m, s;
if (leftTime >= 0) {
d = 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));
s = getzf(Math.floor(leftTime / 1000 % 60));
//将倒计时赋值到div中
$('.page1 .play1 .playBox .dosBg p .span1').text(h)
$('.page1 .play1 .playBox .dosBg p .span2').text(m)
$('.page1 .play1 .playBox .dosBg p .span3').text(s)
leftTime = leftTime - 1000;
//递归每秒调⽤countTime⽅法显⽰动态时间效果
} else {
location.reload();
return
}
timeOut2 = setTimeout(countup, 1000);
}
//补0操作
function getzf (num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}
// 获取首页任务接口
function getConfig () {
showLoading()
@@ -111,6 +179,8 @@ function getConfig () {
url: urlPrefix + '/act/2023MidAutumn/task/getConfig',
success (res) {
if (res.code === 200) {
// 设置话题id
dynamicWorldId = res.data.worldId;
// 判断活动结束时间
if (res.timestamp > res.data.endTime) {
isEndTime = true;
@@ -395,11 +465,6 @@ $('.rule').click(function () {
$('.rule').hide();
bodyScroolFun(false);
})
// 打开瓜分记录弹窗
$('.page1 .play1 .playBox .dividerecords').click(function () {
$('.dividerecordsBg').show();
bodyScroolFun(true);
})
// 关闭瓜分记录弹窗
$('.dividerecordsBg').click(function () {
$('.dividerecordsBg').hide();
@@ -468,6 +533,46 @@ $(".duihuanBg .dividerecordsBg_in .ul").scroll(function () {
}
}
});
// 打开瓜分记录弹窗
$('.page1 .play1 .playBox .dividerecords').click(function () {
jackpotListRecord();
})
// 获取抽奖记录
function jackpotListRecord (page) {
$('.dividerecordsBg .dividerecordsBg_in .ul .list').remove();
showLoading()
networkRequest({
type: 'GEt',
url: urlPrefix + '/act/2023MidAutumn/jackpot/listRecord',
data: { page, size: 20 },
success (res) {
if (res.code === 200) {
var str = '';
res.data.forEach((res, i) => {
str += `
<div class="list">
<span>
${dateFormat(res.time, 'yyyy/MM/dd')}<br>
${dateFormat(res.time, 'hh:mm:ss')}
</span>
<p>${res.diamonds}钻</p>
</div>
`
})
$('.dividerecordsBg .dividerecordsBg_in .ul').append(str);
$('.dividerecordsBg').show();
bodyScroolFun(true);
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('网络错误,请退出重进')
}
})
}
// 关闭兑换记录弹窗
$('.duihuanBg').click(function () {
$('.duihuanBg').hide();
@@ -475,9 +580,35 @@ $('.duihuanBg').click(function () {
})
// 打开瓜分弹窗
$('.page1 .play1 .bRuleBg .guafenBut').click(function () {
$('.carveup').show();
bodyScroolFun(true);
var bool = $(this).attr('click');
if (bool == 1) {
jackpotAllotJackpot();
}
})
// 瓜分钻石接口
function jackpotAllotJackpot () {
showLoading()
networkRequest({
type: 'GEt',
url: urlPrefix + '/act/2023MidAutumn/jackpot/allotJackpot',
success (res) {
if (res.code === 200) {
$('.carveup .carveup_in p').text(`钻石${res.data}`);
$('.carveup').show();
bodyScroolFun(true);
jackpotConfig();
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('网络错误,请退出重进')
}
})
}
// 关闭瓜分弹窗
$('.carveup').click(function () {
$('.carveup').hide();
@@ -540,4 +671,16 @@ $('.page1 .play2 .playBox2 .task .taks3 .but,.page1 .play2 .playBox2 .task .taks
window.androidJsObj.openRoomForGiftId(roomUid, 0);
}
}
})
})
//返回页面 重新请求接口
var hiddenProperty = 'hidden' in document ? 'hidden' :
'webkitHidden' in document ? 'webkitHidden' :
'mozHidden' in document ? 'mozHidden' : null;
var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange');
var onVisibilityChange = function () {
if (!document[hiddenProperty]) {
location.reload()
}
}
document.addEventListener(visibilityChangeEvent, onVisibilityChange);