完成愚人节活动

This commit is contained in:
Dragon
2024-03-25 15:25:46 +08:00
parent 880d9db326
commit f71a301cd1
56 changed files with 3052 additions and 21 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 463 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -14,6 +14,7 @@
<div class="back">
<img src="./images/travel/back.png" alt="">
</div>
<!-- 头部 -->
<div class="header">
<!-- 限定礼物 -->
@@ -21,19 +22,21 @@
<!-- 活动规则 -->
<img src="./images/rule_icon.png" alt="" class="rule_icon">
</div>
<!-- tab切换 -->
<div class="tab">
<div class="tabs">
<div class="tab1 act1"></div>
<div class="tab2"></div>
<div class="tab3"></div>
<div class="tab4"></div>
</div>
<!-- 页面1 -->
<div class="page1">
<!-- 奇幻魔盒 -->
<div class="box1">
<img src="./images/pageBox1Rule_icon.png" alt="" class="pageBox1Rule_icon">
<div class="time">3分钟倒计时: <span>00</span><span>00</span></div>
<div class="time">3分钟倒计时: <span class="sp1">00</span><span class="sp2">00</span></div>
<div class="text">用戶在送出第一個奇幻魔盒後開啓3分鐘倒計時<br>在此期間內點亮所有禮物,可獲得<b>【愚人慶典】</b>禮物*1</div>
<div class="giftBoxs">
<div class="act">
@@ -59,7 +62,196 @@
</div>
</div>
<!-- 奇幻榜 -->
<div class="box2"></div>
<div class="box2">
<!-- 前三 -->
<div class="top3">
<div class="no1">
<img src="./images/page1Top1.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值:0</div>
</div>
<div class="no2">
<img src="./images/page1Top2.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值:0</div>
</div>
<div class="no3">
<img src="./images/page1Top3.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值:0</div>
</div>
</div>
<!-- 非前三 -->
<ul>
<li>
<div class="num">1.</div>
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值: 20</div>
</li>
</ul>
</div>
<!-- 自己榜单 -->
<div class="my">
<div class="num">1.</div>
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值: 20</div>
</div>
</div>
<!-- 页面2 -->
<div class="page2">
<!-- 切换 -->
<div class="tab">
<div class="act1">牌照房间</div>
<div class="">个播房间</div>
</div>
<!-- 第一名房间 -->
<div class="topRoom">
<img src="./images/logo.png" alt="" class="tx">
<div class="roomName">房间昵称</div>
<div class="score">房间进度值: <b>00.0%</b></div>
</div>
<!-- 第一名进度 -->
<div class="topLine">
<div></div>
<span>0/0</span>
</div>
<!-- 文案介绍 -->
<div class="text">房間進度值達到100%,即可開啓紅包雨</div>
<!-- 第一名房间跳转 -->
<img src="./images/page2ToRoomBut.png" alt="" class="page2ToRoomBut">
<div class="page2NotTopTitle">其他房间推荐</div>
<!-- 其他房间 -->
<ul>
<li>
<img src="./images/logo.png" alt="" class="tx">
<div class="live">直播中</div>
<div class="roomName">房间昵称</div>
<div class="score">房间进度值: <b>00.0%</b></div>
<div class="line_in">
<div></div>
<span>0/0</span>
</div>
<img src="./images/go.png" alt="" class="go">
<img src="./images/notGo.png" alt="" class="notGo">
</li>
</ul>
</div>
<!-- 页面3 -->
<div class="page3"></div>
<!-- 页面4 -->
<div class="page4 page41">
<!-- 切换 -->
<div class="page4_tab">
<div></div>
<div></div>
</div>
<!-- 日榜总榜切换 -->
<div class="dayTab">
<div class="act">日榜</div>
<div>总榜</div>
</div>
<!-- 日期切换 -->
<div class="timeTab">
<div class="act">3.27</div>
<div>3.27</div>
<div>3.27</div>
<div>3.27</div>
<div>3.27</div>
<div>3.27</div>
</div>
<!-- 前三 -->
<div class="top3">
<div class="no1">
<img src="./images/page1Top1.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值:0</div>
</div>
<div class="no2">
<img src="./images/page1Top2.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值:0</div>
</div>
<div class="no3">
<img src="./images/page1Top3.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值:0</div>
</div>
</div>
<!-- 非前三 -->
<ul>
<li>
<div class="num">1.</div>
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值: 20</div>
</li>
</ul>
<!-- 自己榜单 -->
<div class="my">
<div class="num">1.</div>
<img src="./images/logo.png" alt="" class="tx">
<div class="nick">用户昵称</div>
<div class="score">奇幻值: 20</div>
</div>
</div>
<!-- 魔盒说明 -->
<div class="MagicBoxRule">
<div class="MagicBoxRule_in MagicBoxRule1">
<!-- 切换 -->
<div class="tab">
<div></div>
<div></div>
</div>
<!-- 切换页面1 -->
<img src="./images/MagicBoxRule1Bg.png" alt="" class="MagicBoxRulePage1">
<!-- 切换页面2 -->
<div class="MagicBoxRulePage2">
<ul>
<li>
<div>
<p>2024/3/19</p>
<b>14:07:07</b>
</div>
<div class="centen">用户昵称</div>
<div class="right">
<p>获得:礼物名称</p>
<b>0 <img src="./images/diamond.png" alt=""></b>
</div>
</li>
</ul>
</div>
</div>
</div>
<!-- 活动规则 -->
<div class="rule">
<div class="rule_in">
<div class="box">
<img src="./images/rule_in.png" alt="" srcset="">
</div>
</div>
</div>
<!-- 限定礼物规则 -->
<div class="limitedGift">
<div class="limitedGift_in">
<div class="box">
<img src="./images/limitedGift_in.png" alt="" srcset="">
</div>
</div>
</div>
</body>

View File

@@ -26,7 +26,16 @@ const toastMsg = (content = '操作完成', time = 2) => {
skin: 'msg'
})
}
var page = 1;
var isLock = true;
var timeOut = null;
var countupTime = 0;
var XIAO_CHOU_ROOM = 'XIAO_CHOU_ROOM_1 ';
var rankType = 1; //排行榜類型1=送禮日榜2=送禮總榜3=收禮日榜4=收禮總榜);
var data = null;//默認日榜;
var type = 'a';//a:送禮b:收禮;
var type2 = 'a';//a:日榜b:總榜;
var curDate; //當天日期;
// 初始化函數
$(function () {
getInfoFromClient()
@@ -47,18 +56,32 @@ $(function () {
window.webkit.messageHandlers.closeWebView.postMessage(null)
}
})
getTime();
getRank();
}, 100)
})
// 獲取接口
function get () {
// 獲取任务接口
function getTaskUser () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '',
url: urlPrefix + '/activity/task/user',
data: { componentCode: "QI_HUAN_MO_HE" },
success (res) {
if (res.code === 200) {
// 渲染愚人盛典礼物
$('.page1 .box1 .giftBoxs div').remove();
var str = '';
res.data[0].children.forEach((res, i) => {
str += `
<div class="${res.completed ? 'act' : ''}">
<img src = "${res.taskIcon}" alt = "" >
${res.taskName}
</div >
`
});
$('.page1 .box1 .giftBoxs').append(str);
} else {
toastMsg(res.message)
}
@@ -70,3 +93,455 @@ function get () {
}
})
}
// 獲取倒计时接口
function getTime () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/act/2024AprilFoolsDay/getTime',
data: { activityCode: "ACT_2024_APRIL_FOOLS_DAY", taskCode: "QI_HUAN_GIFT" },
success (res) {
if (res.code === 200) {
countupTime = res.data - res.timestamp;
countup();
getTaskUser();
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 倒計時
function countup () {
clearTimeout(timeOut)
//獲取當前時間
var d = 0;
var h = 0;
var m = 0;
var s = 0;
//定義變量 d,h,m,s保存倒計時的時間
var d, h, m, s;
if (countupTime >= 0) {
d = getzf(Math.floor(countupTime / 1000 / 60 / 60 / 24));
h = getzf(Math.floor(countupTime / 1000 / 60 / 60 % 24));
m = getzf(Math.floor(countupTime / 1000 / 60 % 60));
s = getzf(Math.floor(countupTime / 1000 % 60));
//將倒計時賦值到div中
$('.page1 .box1 .time .sp1').text(m);
$('.page1 .box1 .time .sp2').text(s);
countupTime = countupTime - 1000;
//遞歸每秒調⽤countTime⽅法顯⽰動態時間效果
} else {
getTime();
return
}
timeOut = setTimeout(countup, 1000);
}
//補0操作
function getzf (num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}
// tab切换
$('.tabs div').click(function () {
var i = $(this).index() + 1;
$('.tabs div').removeClass('act1').removeClass('act2').removeClass('act3').removeClass('act4');
$(this).addClass(`act${i}`);
$('.page1,.page2,.page3,.page4').hide();
$(`.page${i}`).show();
if (i == 1) {
getRank();
} else if (i == 2) {
getRooms();
} else if (i == 4) {
giftGetRank(rankType, data);
}
})
// 獲取奇幻榜接口
function getRank () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/act/2023Halloween/rank/getRank',
data: { rankType: 4 },
success (res) {
if (res.code === 200) {
// 處理前三
var top3 = res.data.rankList.slice(0, 3);
var notTop3 = res.data.rankList.slice(3);
if (top3.length < 3) {
let arr = new Array(3 - top3.length).fill({
avatar: './images/logo.png',
nick: '虛位以待',
score: "0"
})
top3.push(...arr)
}
top3.forEach((res, i) => {
$(`.page1 .box2 .top3 .no${i + 1} .tx`).attr('src', res.avatar);
$(`.page1 .box2 .top3 .no${i + 1} .nick`).text(res.nick);
$(`.page1 .box2 .top3 .no${i + 1} .score`).html('奇幻值<br>' + unitProcessing(res.score, 10000, 1, 'w'))
})
// 非前三
var str = '';
$('.page1 .box2 ul li').remove();
notTop3.forEach((res, i) => {
str += `
<li>
<div class="num">${res.ranking}.</div>
<img src="${res.avatar}" alt="" class="tx">
<div class="nick">${res.nick}</div>
<div class="score">奇幻值: ${unitProcessing(res.score, 10000, 1, 'w')}</div>
</li>
`
})
$('.page1 .box2 ul').append(str);
// 处理自己榜单
$('.page1 .my .num').text(res.data.meRank.ranking == 0 ? '未上榜' : res.data.meRank.ranking);
$('.page1 .my .tx').attr('src', res.data.meRank.avatar);
$('.page1 .my .nick').text(res.data.meRank.nick);
$('.page1 .my .score').text('奇幻值' + unitProcessing(res.data.meRank.score, 10000, 1, 'w'));
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 页面2切换
$('.page2 .tab div').click(function () {
var i = $(this).index() + 1;
$('.page2 .tab div').removeClass('act1').removeClass('act2');
$(this).addClass(`act${i}`);
XIAO_CHOU_ROOM = i == 1 ? 'XIAO_CHOU_ROOM_1' : 'XIAO_CHOU_ROOM_4';
getRooms();
})
// 獲取房间榜接口
function getRooms () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/act/2024AprilFoolsDay/getRooms',
data: { activityCode: "XIAO_CHOU_ROOM_1 ", taskCode: XIAO_CHOU_ROOM },
success (res) {
if (res.code === 200) {
var top = res.data.slice(0, 1);
if (top.length < 3) {
let arr = new Array(1 - top.length).fill({
roomAvatar: './images/logo.png',
roomTitle: '虛位以待',
percentage: 0,
activityValue: 0,
conditionValue: 0,
})
top.push(...arr)
}
console.log(top);
var notTop = res.data.slice(1);
// 第一房间
$('.page2 .topRoom .tx').attr('src', top[0].roomAvatar);
$('.page2 .topRoom .roomName').text(top[0].roomTitle);
$('.page2 .topRoom .score b').text(top[0].percentage + '%');
$('.page2 .topLine div').css('width', top[0].percentage);
$('.page2 .topLine span').text(`${top[0].activityValue}/${top[0].conditionValue}`);
$('.page2 .page2ToRoomBut').attr("uid", top[0].roomUid);
$('.page2 .page2ToRoomBut').attr("src", top[0].isUnderway ? './images/page2ToRoomBut.png' : './images/page2ToRoomBut2.png');
$('.page2 .page2ToRoomBut').attr("isUnderway", top[0].isUnderway);
// 其他房间
$('.page2 ul li').remove();
var str = '';
notTop.forEach(res => {
str += `
<li>
<img src="${res.roomAvatar}" alt="" class="tx">
<div class="live" style="display:${res.isLive ? 'block' : 'none'}">直播中</div>
<div class="roomName">${res.roomTitle}</div>
<div class="score">房間進度值: <b>${res.percentage}%</b></div>
<div class="line_in">
<div style="width:${res.percentage}"></div>
<span>${res.activityValue}/${res.conditionValue}</span>
</div>
<img style="display:${res.isUnderway ? 'block' : 'none'}" src="./images/go.png" alt="" class="go" uid=${res.roomUid}>
<img style="display:${!res.isUnderway ? 'block' : 'none'}" src="./images/notGo.png" alt="" class="notGo">
</li>
`
})
$('.page2 ul').append(str);
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 房间最前面的跳转按钮
$('.page2 .page2ToRoomBut').click(function () {
var uid = $(this).attr('uid');
var isUnderway = $(this).attr('isUnderway');
if (isUnderway) {
if (browser.ios) {
window.webkit.messageHandlers.openRoom.postMessage(uid);
} else if (browser.android) {
if (androidJsObj && typeof androidJsObj === 'object') {
window.androidJsObj.openRoom(uid);
}
}
}
})
// 其他房间跳转房间按钮
$('.page2 ul').on('click', ' li .go', function () {
var uid = $(this).attr('uid');
if (browser.ios) {
window.webkit.messageHandlers.openRoom.postMessage(uid);
} else if (browser.android) {
if (androidJsObj && typeof androidJsObj === 'object') {
window.androidJsObj.openRoom(uid);
}
}
})
// 页面4切换
$('.page4 .page4_tab div').click(function () {
var i = $(this).index() + 1;
$('.page4').removeClass('page41').removeClass('page42');
$('.page4').addClass(`page4${i}`);
if (i == 1) {
type = 'a';
rankType = type2 == "a" ? 1 : 2;
} else {
type = 'b';
rankType = type2 == "a" ? 3 : 4;
}
giftGetRank(rankType, data);
})
// 页面4 日榜/总榜切换
$('.page4 .dayTab div').click(function () {
var i = $(this).index() + 1;
$(this).addClass('act').siblings().removeClass('act')
if (i == 1) {
type2 = 'a';
rankType = type == "a" ? 1 : 3;
$('.page4 .timeTab').show();
} else {
type2 = 'b';
rankType = type == "a" ? 2 : 4;
$('.page4 .timeTab').hide();
}
giftGetRank(rankType, data);
})
// 页面4 日期切换
$('.page4 .timeTab div').click(function () {
var i = $(this).index() + 1;
var datas = $(this).attr('data');
$(this).addClass('act').siblings().removeClass('act')
rankType = type == "a" ? 1 : 3;//排行榜類型1=甜蜜日榜2=甜蜜總榜3=愛意日榜4=愛意總榜)
data = datas;
giftGetRank(rankType, data);
})
// 獲取愚人榜单接口
function giftGetRank (rankType, date) {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/act/special/gift/getRank',
data: { rankType, date, pageSize: 30 },
success (res) {
if (res.code === 200) {
// 設置當天日期
curDate = res.data.curDate;
// 處理日期
if (res.data.dateList) {
res.data.dateList.forEach((res, i) => {
$('.page4 .timeTab div').eq(i).text(`${res[5]}${res[6]}.${res[8]}${res[9]}`);
$('.page4 .timeTab div').eq(i).attr('data', res);
if (res == curDate && date == null) {
$('.page4 .timeTab div').removeClass('act')
$('.page4 .timeTab div').eq(i).addClass('act');
}
})
}
// 處理前三
var top3 = res.data.rankList.slice(0, 3);
var notTop3 = res.data.rankList.slice(3);
if (top3.length < 3) {
let arr = new Array(3 - top3.length).fill({
avatar: './images/logo.png',
nick: '虛位以待',
score: "0"
})
top3.push(...arr)
}
top3.forEach((res, i) => {
$(`.page4 .top3 .no${i + 1} .tx`).attr('src', res.avatar);
$(`.page4 .top3 .no${i + 1} .nick`).text(res.nick);
$(`.page4 .top3 .no${i + 1} .score`).html(`${rankType == 1 || rankType == 2 ? '愚乐值' : '娱乐值'}<br>` + unitProcessing(res.score, 10000, 1, 'w'))
})
// 非前三
var str = '';
$('.page4 ul li').remove();
notTop3.forEach((res, i) => {
str += `
<li>
<div class="num">${res.ranking}.</div>
<img src="${res.avatar}" alt="" class="tx">
<div class="nick">${res.nick}</div>
<div class="score">${rankType == 1 || rankType == 2 ? '愚乐值' : '娱乐值'}: ${unitProcessing(res.score, 10000, 1, 'w')}</div>
</li>
`
})
$('.page4 ul').append(str);
// 处理自己榜单
$('.page4 .my .num').text(res.data.meRank.ranking == 0 ? '未上榜' : res.data.meRank.ranking);
$('.page4 .my .tx').attr('src', res.data.meRank.avatar);
$('.page4 .my .nick').text(res.data.meRank.nick);
$('.page4 .my .score').text(`${rankType == 1 || rankType == 2 ? '愚乐值' : '娱乐值'}` + unitProcessing(res.data.meRank.score, 10000, 1, 'w'));
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 魔盒切换
$('.MagicBoxRule .MagicBoxRule_in .tab div').click(function () {
var i = $(this).index() + 1;
$('.MagicBoxRule .MagicBoxRule_in').removeClass('MagicBoxRule1').removeClass('MagicBoxRule2');
$('.MagicBoxRule .MagicBoxRule_in').addClass(`MagicBoxRule${i}`);
$('.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage1,.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage2').hide();
$(`.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage${i}`).show();
return false;
})
// 獲取魔盒接口
function getRecordPage () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/activity/task/user/record/page',
data: {
componentCode: "QI_HUAN_MO_HE",
activityCode: 'ACT_2024_APRIL_FOOLS_DAY',
pageNum: page,
pageSize: 20,
},
success (res) {
if (res.code === 200) {
var str = ''
if (res.data.records.length == 0) {
str = `
<li class="not">暂无记录</li>
`
isLock = false;
} else {
res.data.records.forEach(res => {
str += `
<li>
<div>
<p>${dateFormat(res.createTime, 'yyyy/MM/dd')}</p>
<b>${dateFormat(res.createTime, 'hh:mm:ss')}</b>
</div>
<div class="centen">${res.nick}</div>
<div class="right">
<p>獲得:${res.rewardName}</p>
<b>${res.showValue} <img src="./images/diamond.png" alt=""></b>
</div>
</li>
`
})
isLock = true;
}
$('.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage2 ul').append(str);
} else {
toastMsg(res.message)
isLock = true;
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
isLock = true;
}
})
}
// 滚动
$('.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage2 ul').scroll(function () {
let scrollTop = $(this).scrollTop()
let scrollHeight = $('.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage2 ul')[0].scrollHeight
let ulHeight = $(this).innerHeight()
if (scrollTop + ulHeight + 100 >= scrollHeight) {
if (isLock) {
// 請求下一頁
page = page + 1;
getRecordPage();
isLock = false;
}
}
})
// 打开魔盒规则
$('.page1 .box1 .pageBox1Rule_icon').click(function () {
$('.MagicBoxRule .MagicBoxRule_in .MagicBoxRulePage2 ul li').remove();
getRecordPage();
$('.MagicBoxRule').show();
bodyScroolFun(true);
})
// 关闭魔盒规则
$('.MagicBoxRule').click(function () {
$('.MagicBoxRule').hide();
bodyScroolFun(false);
})
// 打开规则
$('.header .rule_icon').click(function () {
$('.rule').show();
bodyScroolFun(true);
})
// 关闭规则
$('.rule').click(function () {
$('.rule').hide();
bodyScroolFun(false);
})
// 打开限定礼物规则
$('.header .qualifyGift_icon').click(function () {
$('.limitedGift').show();
bodyScroolFun(true);
})
// 关闭限定礼物规则
$('.limitedGift').click(function () {
$('.limitedGift').hide();
bodyScroolFun(false);
})