1367 lines
53 KiB
JavaScript
1367 lines
53 KiB
JavaScript
let urlPrefix = getUrlPrefix()
|
||
let browser = checkVersion()
|
||
let env = EnvCheck();
|
||
if (env == 'test') {
|
||
new VConsole();
|
||
}
|
||
// 封装layer消息提醒框
|
||
let layerIndex
|
||
const showLoading = (content = '加载中...') => {
|
||
layer.open({
|
||
type: 2,
|
||
shadeClose: false,
|
||
content,
|
||
success (e) {
|
||
layerIndex = $(e).attr('index')
|
||
}
|
||
})
|
||
}
|
||
const hideLoading = (index) => {
|
||
layer.close(index)
|
||
}
|
||
const toastMsg = (content = '操作完成', time = 2) => {
|
||
layer.open({
|
||
content,
|
||
time,
|
||
skin: 'msg'
|
||
})
|
||
}
|
||
var roomUid;//随机获取房间uid
|
||
var taskType = 2;//任务列表参数(2=送榜,4=收榜)
|
||
var taskList = [];//任务奖励状态列表暂存
|
||
var taskListIndex1 = 0;
|
||
var taskListIndex2 = 0;
|
||
var taskGiftList1 = {
|
||
1: [
|
||
{
|
||
img: './images/taksmp11.png',
|
||
nick: '探索新星铭牌', dec: '1天',
|
||
value: 1000,
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '1张'
|
||
},
|
||
],
|
||
2: [
|
||
{
|
||
img: './images/taksmp11.png',
|
||
nick: '探索新星铭牌', dec: '3天',
|
||
value: 5000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '2张'
|
||
},
|
||
],
|
||
3: [
|
||
{
|
||
img: './images/taksmp11.png',
|
||
nick: '探索新星铭牌', dec: '5天',
|
||
value: 10000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '5张'
|
||
},
|
||
],
|
||
4: [
|
||
{
|
||
img: './images/taksmp11.png',
|
||
nick: '探索新星铭牌', dec: '20天',
|
||
value: 50000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '20张'
|
||
},
|
||
{
|
||
img: './images/taksqp11.png',
|
||
nick: '探索新星气泡', dec: '5天'
|
||
},
|
||
],
|
||
5: [
|
||
{
|
||
img: './images/taksmp12.png',
|
||
nick: '全民星探铭牌', dec: '25天',
|
||
value: 100000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '40张'
|
||
},
|
||
{
|
||
img: './images/taksqp12.png',
|
||
nick: '全民星探气泡', dec: '10天'
|
||
},
|
||
],
|
||
6: [
|
||
{
|
||
img: './images/taksmp12.png',
|
||
nick: '全民星探铭牌', dec: '30天',
|
||
value: 300000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '90张'
|
||
},
|
||
{
|
||
img: './images/taksqp12.png',
|
||
nick: '全民星探气泡', dec: '15天'
|
||
},
|
||
{
|
||
img: './images/taksqp12.png',
|
||
nick: '全民星探资料卡', dec: '10天'
|
||
},
|
||
],
|
||
7: [
|
||
{
|
||
img: './images/taksmp13.png',
|
||
nick: '明星星探铭牌', dec: '30天',
|
||
value: 600000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '150张'
|
||
},
|
||
{
|
||
img: './images/taksqp13.png',
|
||
nick: '明星星探气泡', dec: '15天'
|
||
},
|
||
{
|
||
img: './images/taksqp13.png',
|
||
nick: '明星星探资料卡', dec: '10天'
|
||
},
|
||
],
|
||
8: [
|
||
{
|
||
img: './images/taksmp13.png',
|
||
nick: '明星星探铭牌', dec: '90天',
|
||
value: 1000000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '300张'
|
||
},
|
||
{
|
||
img: './images/taksqp13.png',
|
||
nick: '明星星探气泡', dec: '30天'
|
||
},
|
||
{
|
||
img: './images/taksqp13.png',
|
||
nick: '全明星星探资料卡', dec: '30天'
|
||
},
|
||
],
|
||
};//任务奖励列表
|
||
var taskGiftList2 = {
|
||
1: [
|
||
{
|
||
img: './images/taksts21.png',
|
||
nick: '娱乐新秀头饰', dec: '1天',
|
||
value: 1000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '1张'
|
||
},
|
||
],
|
||
2: [
|
||
{
|
||
img: './images/taksmp21.png',
|
||
nick: '娱乐新秀头饰', dec: '3天',
|
||
value: 5000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '2张'
|
||
},
|
||
],
|
||
3: [
|
||
{
|
||
img: './images/taksmp21.png',
|
||
nick: '娱乐新秀头饰', dec: '5天',
|
||
value: 10000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '5张'
|
||
},
|
||
],
|
||
4: [
|
||
{
|
||
img: './images/taksmp21.png',
|
||
nick: '娱乐新秀头饰', dec: '20天',
|
||
value: 50000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '20张'
|
||
},
|
||
{
|
||
img: './images/taksqp21.png',
|
||
nick: '娱乐新秀铭牌', dec: '5天'
|
||
},
|
||
],
|
||
5: [
|
||
{
|
||
img: './images/taksmp22.png',
|
||
nick: '人气小花头饰', dec: '25天',
|
||
value: 100000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '40张'
|
||
},
|
||
{
|
||
img: './images/taksqp22.png',
|
||
nick: '人气小花铭牌', dec: '10天'
|
||
},
|
||
],
|
||
6: [
|
||
{
|
||
img: './images/taksmp22.png',
|
||
nick: '人气小花头饰', dec: '30天',
|
||
value: 300000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '90张'
|
||
},
|
||
{
|
||
img: './images/taksqp22.png',
|
||
nick: '人气小花铭牌', dec: '15天'
|
||
},
|
||
{
|
||
img: './images/taksqp22.png',
|
||
nick: '人气小花资料卡', dec: '10天'
|
||
},
|
||
],
|
||
7: [
|
||
{
|
||
img: './images/taksmp23.png',
|
||
nick: '当红小花头饰', dec: '30天',
|
||
value: 600000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '150张'
|
||
},
|
||
{
|
||
img: './images/taksqp23.png',
|
||
nick: '当红小花气泡', dec: '15天'
|
||
},
|
||
{
|
||
img: './images/taksqp23.png',
|
||
nick: '当红小花资料卡', dec: '10天'
|
||
},
|
||
],
|
||
8: [
|
||
{
|
||
img: './images/taksmp23.png',
|
||
nick: '娱乐巨星头饰', dec: '90天',
|
||
value: 1000000
|
||
},
|
||
{
|
||
img: './images/popularity.png',
|
||
nick: '人气票', dec: '300张'
|
||
},
|
||
{
|
||
img: './images/taksqp23.png',
|
||
nick: '娱乐巨星气泡', dec: '30天'
|
||
},
|
||
{
|
||
img: './images/taksqp23.png',
|
||
nick: '娱乐巨星资料卡', dec: '30天'
|
||
},
|
||
],
|
||
};//任务奖励列表
|
||
var popularGetRankRound = null;//人气榜
|
||
var roomGetRankRound = null;//房间帮
|
||
var getGiftRankType = 1;//礼物代言人排行榜传参
|
||
var roundList = [];//页面3赛事时间存储
|
||
var hourCountupTime = null;//小时榜计时器
|
||
var popularGetRankTime = null;//人气榜计时器
|
||
var roomGetRankTime = null;//房间榜计时器
|
||
// 初始化函数
|
||
$(function () {
|
||
getInfoFromClient()
|
||
setTimeout(function () {
|
||
// 页面全屏
|
||
if (browser.app) {
|
||
if (browser.android) {
|
||
window.androidJsObj.initShowNav(false)
|
||
} else {
|
||
window.webkit.messageHandlers.initShowNav.postMessage(0)
|
||
}
|
||
};
|
||
// 顶部返回事件
|
||
$('.back').click(() => {
|
||
if (browser.android) {
|
||
window.androidJsObj.closeWebView()
|
||
} else {
|
||
window.webkit.messageHandlers.closeWebView.postMessage(null)
|
||
}
|
||
})
|
||
// getRoomUid();
|
||
getTask();
|
||
cpRank();
|
||
}, 100)
|
||
})
|
||
// tab总切换
|
||
$('.header .tab').click(function () {
|
||
var i = $(this).index() - 1;
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
$('.page1,.page2,.page3,.page4,.page5').hide();
|
||
$(`.page${i}`).show();
|
||
if (i == 1) {
|
||
cpRank();
|
||
} else if (i == 2) {
|
||
getGiftRank();
|
||
} else if (i == 3) {
|
||
popularGetRank();
|
||
} else if (i == 4) {
|
||
roomGetRank();
|
||
} else if (i == 5) {
|
||
tyrantGetRank();
|
||
}
|
||
})
|
||
// 获取CP榜单
|
||
function cpRank () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/cpRank/getRank',
|
||
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({
|
||
leftAvatar: './images/logo.png',
|
||
rightAvatar: './images/logo.png',
|
||
leftNick: '虚位以待',
|
||
rightNick: '虚位以待',
|
||
score: "0"
|
||
})
|
||
top3.push(...arr)
|
||
}
|
||
top3.forEach((res, i) => {
|
||
$(`.page1 .box .no${i + 1} .leftTx`).attr('src', res.leftAvatar);
|
||
$(`.page1 .box .no${i + 1} .rightTx`).attr('src', res.rightAvatar);
|
||
$(`.page1 .box .no${i + 1} .leftName`).text(res.leftNick);
|
||
$(`.page1 .box .no${i + 1} .right`).text(res.rightNick);
|
||
$(`.page1 .box .no${i + 1} .score`).text(unitProcessing(res.score, 10000, 1, 'w') + '友谊值');
|
||
})
|
||
// 非前三
|
||
var str = '';
|
||
$('.page1 .box ul li').remove();
|
||
notTop3.forEach((res, i) => {
|
||
str += `
|
||
<li>
|
||
<div class="num">${res.ranking}</div>
|
||
<img src="./images/page1notTop3ts.png" alt="" class="ts">
|
||
<img src="${res.leftAvatar}" alt="" class="ltx">
|
||
<img src="${res.rightAvatar}" alt="" class="rtx">
|
||
<div class="lName">${res.leftNick}</div>
|
||
<div class="rName">${res.rightNick}</div>
|
||
<div class="score">${unitProcessing(res.score, 10000, 1, 'w')}友谊值</div>
|
||
</li>
|
||
`
|
||
})
|
||
$('.page1 .box ul').append(str);
|
||
// 处理自己榜单组合
|
||
var myStr = '';
|
||
$('.page1 .my .myBox .myBox_in').remove();
|
||
$('.page1 .my .myBox .NotUser').remove();
|
||
if (res.data.meRankList.length == 0) {
|
||
myStr += `<div class="NotUser">暂无组合~</div>`
|
||
} else {
|
||
res.data.meRankList.forEach((res, i) => {
|
||
myStr += `
|
||
<div class="myBox_in">
|
||
<img src="./images/page1notTop3ts.png" alt="" class="ts">
|
||
<img src="${res.leftAvatar}" alt="" class="ltx">
|
||
<img src="${res.rightAvatar}" alt="" class="rtx">
|
||
<div class="lName">${res.leftNick}</div>
|
||
<div class="rName">${res.rightNick}</div>
|
||
<div class="score"><div class="score"><p>${unitProcessing(res.score, 10000, 1, 'w')}友谊值</p><span>${res.ranking == 0 ? '暂未上榜' : '当前排名:' + res.ranking}</span></div></div>
|
||
</div>
|
||
`
|
||
})
|
||
}
|
||
$('.page1 .my .myBox').append(myStr);
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 上拉更多组合
|
||
var pageMyiconBool = true;
|
||
$('.page1 .my .pageMyicon').click(function () {
|
||
if (pageMyiconBool) {
|
||
$('.page1 .my .pageMyicon').css({
|
||
'transform': 'translateX(-50%) rotate(180deg)',
|
||
})
|
||
$('.page1 .my').addClass('act')
|
||
$('.page1 .my').css({
|
||
'height': '10.4rem',
|
||
})
|
||
$('.page1 .my .myBox').css({
|
||
'height': '9.8rem',
|
||
'overflow-y': 'scroll',
|
||
})
|
||
} else {
|
||
$('.page1 .my .pageMyicon').css({
|
||
'transform': 'translateX(-50%) rotate(0deg)',
|
||
})
|
||
$('.page1 .my').removeClass('act')
|
||
$('.page1 .my').css({
|
||
'height': '2.26667rem',
|
||
})
|
||
$('.page1 .my .myBox').css({
|
||
'height': '1.76rem',
|
||
'overflow-y': 'hidden',
|
||
})
|
||
}
|
||
$('.page1 .my .myBox').scrollTop(0)
|
||
pageMyiconBool = !pageMyiconBool;
|
||
})
|
||
// page2tab切换
|
||
$('.page2 .tabBox .tab').click(function () {
|
||
var i = $(this).index() + 1;
|
||
$('.page2 .page2Gift').attr('src', `./images/page2Gift${i}.png`);
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
getGiftRankType = i;
|
||
getGiftRank();
|
||
})
|
||
// 获取礼物代言人接口
|
||
function getGiftRank () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/gift/getRank',
|
||
data: { type: getGiftRankType },
|
||
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) => {
|
||
$(`.page2 .top3Box .no${i + 1} .tx`).attr('src', res.avatar);
|
||
$(`.page2 .top3Box .no${i + 1} p`).text(res.nick);
|
||
$(`.page2 .top3Box .no${i + 1} span b`).text(`${unitProcessing(res.score, 10000, 1, 'w')}`);
|
||
})
|
||
// 非前三
|
||
var str = '';
|
||
$('.page2 ul li').remove();
|
||
notTop3.forEach((res, i) => {
|
||
str += `
|
||
<li>
|
||
<div class="num">${res.ranking}</div>
|
||
<img src="./images/page2UlTs.png" alt="" class="ts">
|
||
<img src="${res.avatar}" alt="" class="tx">
|
||
<div class="name">${res.nick}</div>
|
||
<div class="score">闪耀值: ${unitProcessing(res.score, 10000, 1, 'w')}</div>
|
||
</li>
|
||
`
|
||
})
|
||
$('.page2 ul').append(str);
|
||
// 处理自己榜单
|
||
$('.page2 .my .num').text(res.data.meRank.ranking == 0 ? '未上榜' : res.data.meRank.ranking);
|
||
$('.page2 .my .ts .tx').attr('src', res.data.meRank.avatar);
|
||
$('.page2 .my .name').text(res.data.meRank.nick);
|
||
$('.page2 .my .score').text(`闪耀值: ${unitProcessing(res.data.meRank.score, 10000, 1, 'w')}`);
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 年度盛典榜单接口
|
||
function tyrantGetRank () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/tyrant/getRank',
|
||
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) => {
|
||
$(`.page5 .top3Box .no${i + 1} .tx`).attr('src', res.avatar);
|
||
$(`.page5 .top3Box .no${i + 1} p`).text(res.nick);
|
||
$(`.page5 .top3Box .no${i + 1} span b`).text(`${unitProcessing(res.score, 10000, 1, 'w')}`);
|
||
})
|
||
// 非前三
|
||
var str = '';
|
||
$('.page5 ul li').remove();
|
||
notTop3.forEach((res, i) => {
|
||
str += `
|
||
<li>
|
||
<div class="num">${res.ranking}</div>
|
||
<img src="./images/page2UlTs.png" alt="" class="ts">
|
||
<img src="${res.avatar}" alt="" class="tx">
|
||
<div class="name">${res.nick}</div>
|
||
<div class="score">神豪值: ${unitProcessing(res.score, 10000, 1, 'w')}</div>
|
||
</li>
|
||
`
|
||
})
|
||
$('.page5 ul').append(str);
|
||
// 处理自己榜单
|
||
$('.page5 .my .num').text(res.data.meRank.ranking == 0 ? '未上榜' : res.data.meRank.ranking);
|
||
$('.page5 .my .ts .tx').attr('src', res.data.meRank.avatar);
|
||
$('.page5 .my .name').text(res.data.meRank.nick);
|
||
$('.page5 .my .score').text(`神豪值: ${unitProcessing(res.data.meRank.score, 10000, 1, 'w')}`);
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 获取任务接口
|
||
function getTask () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/task/getTask',
|
||
data: { type: taskType },
|
||
success (res) {
|
||
if (res.code === 200) {
|
||
// 处理自己
|
||
$('.celebrationTask .celebrationTask_in .user .tx').attr('src', res.data.avatar);
|
||
$('.celebrationTask .celebrationTask_in .user .score .sp1 b').text(unitProcessing(res.data.score, 10000, 1, 'w'))
|
||
$('.celebrationTask .celebrationTask_in .user .score .sp2 b').text(res.data.nextStageDist == 0 ? '已满级' : res.data.nextStageDist)
|
||
$('.celebrationTask .celebrationTask_in .user p').text(res.data.nick);
|
||
// 处理当前展示奖励
|
||
taskList = res.data.taskList;
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but').hide();
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').hide();
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').hide();
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').hide();
|
||
if (taskType == 2) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .giftBox div').remove();
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox p b').text(taskGiftList1[taskListIndex1 + 1][0].value);
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .title').text(`LV1`);
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox i').text(`1/8`);
|
||
var str = ''
|
||
taskGiftList1[taskListIndex1 + 1].forEach((res, i) => {
|
||
str += `
|
||
<div>
|
||
<img src="${res.img}" alt="">
|
||
<span>${res.dec}</span>
|
||
<i>${res.nick}</i>
|
||
</div>
|
||
`
|
||
});
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .giftBox').append(str);
|
||
if (taskList[0].status == 0) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').text('未满足条件');
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').show();
|
||
} else if (taskList[0].status == 1) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').attr('taskId', taskList[0].taskId);
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').show();
|
||
} else {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').text('已领取');
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').show();
|
||
}
|
||
} else {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .giftBox div').remove();
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox p b').text(taskGiftList1[taskListIndex1 + 1][0].value);
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .title').text(`LV1`);
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox i').text(`1/8`);
|
||
var str = ''
|
||
taskGiftList1[taskListIndex1 + 1].forEach((res, i) => {
|
||
str += `
|
||
<div>
|
||
<img src="${res.img}" alt="">
|
||
<span>${res.dec}</span>
|
||
<i>${res.nick}</i>
|
||
</div>
|
||
`
|
||
});
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .giftBox').append(str);
|
||
if (taskList[0].status == 0) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').text('未满足条件');
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').show();
|
||
} else if (taskList[0].status == 1) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but').attr('taskId', taskList[0].taskId);
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but').show();
|
||
} else {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').text('已领取');
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').show();
|
||
}
|
||
}
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 任务盛典大咖左切换
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .left').click(function () {
|
||
taskListIndex1 = taskListIndex1 - 1 < 0 ? 0 : taskListIndex1 - 1;
|
||
taskListFunction1(1);
|
||
return false;
|
||
})
|
||
// 任务盛典大咖右切换
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .right').click(function () {
|
||
taskListIndex1 = taskListIndex1 + 1 > 7 ? 7 : taskListIndex1 + 1;
|
||
taskListFunction1(1);
|
||
return false;
|
||
})
|
||
// 任务盛典新秀左切换
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .left').click(function () {
|
||
taskListIndex2 = taskListIndex2 - 1 < 0 ? 0 : taskListIndex2 - 1;
|
||
taskListFunction1(2);
|
||
return false;
|
||
})
|
||
// 任务盛典新秀右切换
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .right').click(function () {
|
||
taskListIndex2 = taskListIndex2 + 1 > 7 ? 7 : taskListIndex2 + 1;
|
||
taskListFunction1(12);
|
||
return false;
|
||
})
|
||
// 任务不能领取按钮
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot,.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').click(function () {
|
||
return false;
|
||
})
|
||
// 任务可领取按钮
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but,.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').click(function () {
|
||
var taskId = $(this).attr('taskId');
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/task/getTaskReward',
|
||
data: { type: taskType, taskId },
|
||
success (res) {
|
||
if (res.code === 200) {
|
||
taskListIndex1 = 0;
|
||
taskListIndex2 = 0;
|
||
getTask();
|
||
toastMsg('领取成功,奖励已自动发放背包');
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
return false;
|
||
})
|
||
// 任务切换函数
|
||
function taskListFunction1 (type) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but').hide();
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').hide();
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').hide();
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').hide();
|
||
if (type == 1) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .giftBox div').remove();
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox p b').text(taskGiftList1[taskListIndex1 + 1][0].value);
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .title').text(`LV${taskListIndex1 + 1}`);
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox i').text(`${taskListIndex1 + 1}/8`);
|
||
var str = ''
|
||
taskGiftList1[taskListIndex1 + 1].forEach((res, i) => {
|
||
str += `
|
||
<div>
|
||
<img src="${res.img}" alt="">
|
||
<span>${res.dec}</span>
|
||
<i>${res.nick}</i>
|
||
</div>
|
||
`
|
||
});
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .giftBox').append(str);
|
||
if (taskList[taskListIndex1].status == 0) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').text('未满足条件');
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').show();
|
||
} else if (taskList[taskListIndex1].status == 1) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').attr('taskId', taskList[taskListIndex1].taskId);
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .but').show();
|
||
} else {
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').text('已领取');
|
||
$('.celebrationTask .celebrationTask_in .tabBox1 .celebrationTaskBox .butNot').show();
|
||
}
|
||
|
||
} else {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .giftBox div').remove();
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox p b').text(taskGiftList2[taskListIndex2 + 1][0].value);
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .title').text(`LV${taskListIndex2 + 1}`);
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox i').text(`${taskListIndex2 + 1}/8`);
|
||
var str = ''
|
||
taskGiftList2[taskListIndex2 + 1].forEach((res, i) => {
|
||
str += `
|
||
<div>
|
||
<img src="${res.img}" alt="">
|
||
<span>${res.dec}</span>
|
||
<i>${res.nick}</i>
|
||
</div>
|
||
`
|
||
});
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .giftBox').append(str);
|
||
if (taskList[taskListIndex2].status == 0) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').text('未满足条件');
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').show();
|
||
} else if (taskList[taskListIndex2].status == 1) {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but').attr('taskId', taskList[taskListIndex2].taskId);
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .but').show();
|
||
} else {
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').text('已领取');
|
||
$('.celebrationTask .celebrationTask_in .tabBox2 .celebrationTaskBox .butNot').show();
|
||
}
|
||
}
|
||
}
|
||
// 盛典任务弹窗切换
|
||
$('.celebrationTask .celebrationTask_in .tab div').click(function () {
|
||
var i = $(this).index() + 1;
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
$('.celebrationTask .celebrationTask_in .tabBox1,.celebrationTask .celebrationTask_in .tabBox2').hide();
|
||
$(`.celebrationTask .celebrationTask_in .tabBox${i}`).show();
|
||
taskType = i == 1 ? 2 : 4;//(2=送榜,4=收榜)
|
||
$('.celebrationTask .celebrationTask_in .user .score i').text(i == 1 ? '贡献值' : '新秀值')
|
||
taskListIndex1 = 0;
|
||
taskListIndex2 = 0;
|
||
getTask();
|
||
return false
|
||
})
|
||
// 关闭盛典任务弹窗
|
||
$('.celebrationTask').click(function () {
|
||
$('.celebrationTask').hide();
|
||
bodyScroolFun(false);
|
||
})
|
||
// 打开盛典任务弹窗
|
||
$('.header .toast').click(function () {
|
||
getTask();
|
||
$('.celebrationTask').show();
|
||
bodyScroolFun(true);
|
||
})
|
||
// 页面3切换tab
|
||
$('.page3 .page3tabBox .tabBox .tab').click(function () {
|
||
var i = $(this).index() + 1;
|
||
popularGetRankRound = $(this).attr('round');
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
popularGetRank();
|
||
})
|
||
// 获取人气榜
|
||
function popularGetRank () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/popular/getRank',
|
||
data: { round: popularGetRankRound },
|
||
success (res) {
|
||
if (res.code === 200) {
|
||
// 人气倒计时
|
||
if (popularGetRankRound == null || popularGetRankRound == undefined) {
|
||
console.log(res.data.roundList[res.data.curRound - 1].endTime - res.timestamp);
|
||
popularGetRankCountup(res.data.roundList[res.data.curRound - 1].endTime - res.timestamp);
|
||
}
|
||
// 渲染赛事时间
|
||
roundList = res.data.roundList ? res.data.roundList : roundList;
|
||
roundList.forEach((val, i) => {
|
||
$(`.page3 .page3tabBox .tabBox .tab`).eq(i).attr('round', val.round);
|
||
$(`.page3 .page3tabBox .tabBox .tab`).eq(i).children('span').text(`${dateFormat(val.startTime, 'MM.dd')}-${dateFormat(val.endTime, 'MM.dd')}`);
|
||
if (popularGetRankRound == null || popularGetRankRound == undefined) {
|
||
if (res.data.curRound == val.round) {
|
||
$(`.page3 .page3tabBox .tabBox .tab`).eq(i).addClass('act').siblings().removeClass('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) => {
|
||
$(`.page3 .top3Box .no${i + 1} .ts`).attr('uid', res.uid);
|
||
$(`.page3 .top3Box .no${i + 1} .tx`).attr('src', res.avatar);
|
||
$(`.page3 .top3Box .no${i + 1} p`).text(res.nick);
|
||
$(`.page3 .top3Box .no${i + 1} span b`).text(unitProcessing(res.score, 10000, 1, 'w'));
|
||
})
|
||
// 非前三
|
||
$('.page3 ul li').remove();
|
||
var str = '';
|
||
notTop3.forEach((res, i) => {
|
||
str += `
|
||
<li>
|
||
<div class="num">${res.ranking}</div>
|
||
<img src="./images/page2UlTs.png" alt="" class="ts" uid="${res.uid}">
|
||
<img src="${res.avatar}" alt="" class="tx">
|
||
<div class="name">${res.nick}</div>
|
||
<div class="score">人气值: ${unitProcessing(res.score, 10000, 1, 'w')}</div>
|
||
</li>
|
||
`
|
||
})
|
||
$('.page3 ul').append(str);
|
||
// 处理自己榜单
|
||
$('.page3 .my .num').text(res.data.meRank.ranking == 0 ? '未上榜' : res.data.meRank.ranking);
|
||
$('.page3 .my .ts .tx').attr('src', res.data.meRank.avatar);
|
||
$('.page3 .my .name').text(res.data.meRank.nick);
|
||
$('.page3 .my .score').text(`人气值: ${unitProcessing(res.data.meRank.score, 10000, 1, 'w')}`)
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 点击人气榜前三跳转个人信息页
|
||
$('.page3 .top3Box .no .ts').click(function () {
|
||
var uid = $(this).attr('uid');
|
||
// 跳转个人资料页
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openPersonPage(uid);
|
||
}
|
||
} else {
|
||
console.log('web');
|
||
}
|
||
})
|
||
// 点击人气榜非前三跳转个人信息页
|
||
$('.page3 ul li').on('click', '.ts', function () {
|
||
var uid = $(this).attr('uid');
|
||
// 跳转个人资料页
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openPersonPage(uid);
|
||
}
|
||
} else {
|
||
console.log('web');
|
||
}
|
||
})
|
||
// 人气榜倒计时
|
||
function popularGetRankCountup (leftTime) {
|
||
clearTimeout(popularGetRankTime)
|
||
//获取当前时间
|
||
// var now = nowTime;
|
||
var d = 0;
|
||
var h = 0;
|
||
var m = 0;
|
||
var s = 0;
|
||
//定义变量 d,h,m,s保存倒计时的时间
|
||
var d, h, m, s;
|
||
//递归每秒调⽤countTime⽅法,显⽰动态时间效果
|
||
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中
|
||
$('.page3 .page3tabBox .timeBox p .sp1').text(d);
|
||
$('.page3 .page3tabBox .timeBox p .sp2').text(h);
|
||
$('.page3 .page3tabBox .timeBox p .sp3').text(m);
|
||
$('.page3 .page3tabBox .timeBox p .sp4').text(s);
|
||
} else {
|
||
popularGetRank();
|
||
|
||
}
|
||
if (leftTime > 0) {
|
||
leftTime = leftTime - 1000;
|
||
}
|
||
popularGetRankTime = setTimeout(function () {
|
||
popularGetRankCountup(leftTime);
|
||
}, 1000);
|
||
}
|
||
// 打开页面3小时榜弹窗
|
||
$('.page3 .page3RuleIcon').click(function () {
|
||
getHourRank();
|
||
})
|
||
$('.page3 ul').on('click', 'li .ts', function () {
|
||
var uid = $(this).attr('uid');
|
||
// 跳转个人资料页
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openPersonPage(uid);
|
||
}
|
||
} else {
|
||
console.log('web');
|
||
}
|
||
return false;
|
||
})
|
||
// 获取小时榜接口
|
||
function getHourRank () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/popular/getHourRank',
|
||
success (res) {
|
||
if (res.code === 200) {
|
||
// 渲染小时榜时间
|
||
$('.page3_pop .page3_pop_in .timeBox .div1').text(`${res.data.curHour}点小时榜`);
|
||
if (res.data.curHourEndTime) {
|
||
hourCountup(res.data.curHourEndTime - res.timestamp);
|
||
} else {
|
||
toastMsg('小时榜仅在每晚19:00-23:59开启')
|
||
hideLoading(layerIndex)
|
||
}
|
||
// 渲染上期小时榜榜首
|
||
if (res.data.lastTopOne) {
|
||
$('.page3_pop .page3_pop_in .lastTop3 .tx').attr('src', res.data.lastTopOne.avatar);
|
||
$('.page3_pop .page3_pop_in .lastTop3 .ts').attr('uid', res.data.lastTopOne.uid);
|
||
$('.page3_pop .page3_pop_in .lastTop3 p').text(res.data.lastTopOne.nick);
|
||
$('.page3_pop .page3_pop_in .lastTop3 .right img').attr('src', res.data.lastTopOne.assistance.avatar);
|
||
} else {
|
||
$('.page3_pop .page3_po p_in .lastTop3 .tx').attr('src', './images/logo.png');
|
||
$('.page3_pop .page3_pop_in .lastTop3 p').text('虚位以待');
|
||
$('.page3_pop .page3_pop_in .lastTop3 .right img').attr('src', './images/logo.png');
|
||
}
|
||
// 渲染小时榜列表
|
||
$('.page3_pop .page3_pop_in ul li').remove();
|
||
var str = '';
|
||
res.data.rankList.forEach((res) => {
|
||
str += `
|
||
<li>
|
||
<div class="num">${res.ranking}</div>
|
||
<img src="./images/celebrationTaskTs.png" alt="" class="ts" uid=${res.uid}>
|
||
<img src="${res.avatar}" alt="" class="tx">
|
||
<div class="user">
|
||
<p>${res.nick}</p>
|
||
<span>人气值:${res.score}</span>
|
||
</div>
|
||
<div class="right">
|
||
<img src="${res.assistance.avatar}" alt="">
|
||
<i>最佳助力</i>
|
||
</div>
|
||
</li>
|
||
`
|
||
})
|
||
$('.page3_pop .page3_pop_in ul').append(str)
|
||
$('.page3_pop').show();
|
||
bodyScroolFun(true);
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 小时榜倒计时
|
||
function hourCountup (leftTime) {
|
||
clearTimeout(hourCountupTime)
|
||
//获取当前时间
|
||
// var now = nowTime;
|
||
var d = 0;
|
||
var h = 0;
|
||
var m = 0;
|
||
var s = 0;
|
||
//定义变量 d,h,m,s保存倒计时的时间
|
||
var d, h, m, s;
|
||
//递归每秒调⽤countTime⽅法,显⽰动态时间效果
|
||
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中
|
||
$('.page3_pop .page3_pop_in .timeBox .div2').text(`剩余${m}分${s}秒`);
|
||
} else {
|
||
getHourRank();
|
||
}
|
||
if (leftTime > 0) {
|
||
leftTime = leftTime - 1000;
|
||
}
|
||
hourCountupTime = setTimeout(function () {
|
||
hourCountup(leftTime)
|
||
}, 1000);
|
||
}
|
||
$('.page3_pop .page3_pop_in .lastTop3 .ts').click(function () {
|
||
var uid = $(this).attr('uid');
|
||
// 跳转个人资料页
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openPersonPage(uid);
|
||
}
|
||
} else {
|
||
console.log('web');
|
||
}
|
||
return false;
|
||
})
|
||
$('.page3_pop .page3_pop_in ul').on('click', ' li .ts', function () {
|
||
var uid = $(this).attr('uid');
|
||
// 跳转个人资料页
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openPersonPage(uid);
|
||
}
|
||
} else {
|
||
console.log('web');
|
||
}
|
||
return false;
|
||
})
|
||
// 关闭页面3弹窗
|
||
$('.page3_pop').click(function () {
|
||
$('.page3_pop').hide();
|
||
bodyScroolFun(false);
|
||
})
|
||
// 页面4切换tab
|
||
$('.page4 .page3tabBox .tabBox .tab').click(function () {
|
||
var i = $(this).index() + 1;
|
||
roomGetRankRound = $(this).attr('round');
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
// if (roomGetRankRound >= 4) {
|
||
// $('.page4 .page4Title2').show();
|
||
// } else {
|
||
// $('.page4 .page4Title2').hide();
|
||
// }
|
||
roomGetRank();
|
||
})
|
||
// 获取人气榜
|
||
function roomGetRank () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/room/getRank',
|
||
data: { round: roomGetRankRound },
|
||
success (res) {
|
||
if (res.code === 200) {
|
||
// 人气倒计时
|
||
if (roomGetRankRound == null || roomGetRankRound == undefined) {
|
||
console.log(res.data.roundList[res.data.curRound - 1].endTime - res.timestamp);
|
||
roomGetRankCountup(res.data.roundList[res.data.curRound - 1].endTime - res.timestamp);
|
||
}
|
||
if (res.data.rankType == 4) {
|
||
$('.page4_pop .page3_pop_in .page4_popTop').attr('src', './images/page4_popTop.png')
|
||
} else if (res.data.rankType == 5) {
|
||
$('.page4_pop .page3_pop_in .page4_popTop').attr('src', './images/page4_popTop2.png')
|
||
}
|
||
if (res.data.rankType >= 4) {
|
||
$('.page4 .page4Title2').show();
|
||
} else {
|
||
$('.page4 .page4Title2').hide();
|
||
}
|
||
// 渲染赛事时间
|
||
roundList = res.data.roundList ? res.data.roundList : roundList;
|
||
roundList.forEach((val, i) => {
|
||
$(`.page4 .page3tabBox .tabBox .tab`).eq(i).attr('round', val.round);
|
||
$(`.page4 .page3tabBox .tabBox .tab`).eq(i).children('span').text(`${dateFormat(val.startTime, 'MM.dd')}-${dateFormat(val.endTime, 'MM.dd')}`);
|
||
if (roomGetRankRound == null || roomGetRankRound == undefined) {
|
||
if (res.data.curRound == val.round) {
|
||
$(`.page4 .page3tabBox .tabBox .tab`).eq(i).addClass('act').siblings().removeClass('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 .top3Box .no${i + 1} .ts`).attr('roomUid', res.uid);
|
||
$(`.page4 .top3Box .no${i + 1} .tx`).attr('src', res.avatar);
|
||
$(`.page4 .top3Box .no${i + 1} p`).text(res.nick);
|
||
$(`.page4 .top3Box .no${i + 1} span b`).text(unitProcessing(res.score, 10000, 1, 'w'));
|
||
})
|
||
// 非前三
|
||
$('.page4 ul li').remove();
|
||
var str = '';
|
||
notTop3.forEach((res, i) => {
|
||
str += `
|
||
<li>
|
||
<div class="num">${res.ranking}</div>
|
||
<img src="./images/page2UlTs.png" alt="" class="ts" roomUid="${res.uid}">
|
||
<img src="${res.avatar}" alt="" class="tx">
|
||
<div class="name">${res.nick}</div>
|
||
<div class="score">荣耀值: ${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 .ts .tx').attr('src', res.data.meRank.avatar);
|
||
$('.page4 .my .name').text(res.data.meRank.nick);
|
||
$('.page4 .my .score').text(`荣耀值: ${unitProcessing(res.data.meRank.score, 10000, 1, 'w')}`)
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 点击人气榜前三跳转个人信息页
|
||
$('.page4 .top3Box .no .ts').click(function () {
|
||
// 跳转房间
|
||
var roomUid = $(this).attr('roomUid');
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openRoom.postMessage(roomUid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openRoom(roomUid);
|
||
}
|
||
}
|
||
})
|
||
// 点击人气榜非前三跳转个人信息页
|
||
$('.page4 ul').on('click', ' li .ts', function () {
|
||
// 跳转房间
|
||
var roomUid = $(this).attr('roomUid');
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openRoom.postMessage(roomUid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openRoom(roomUid);
|
||
}
|
||
}
|
||
})
|
||
// 房间明厅倒计时
|
||
function roomGetRankCountup (leftTime) {
|
||
clearTimeout(roomGetRankTime)
|
||
//获取当前时间
|
||
// var now = nowTime;
|
||
var d = 0;
|
||
var h = 0;
|
||
var m = 0;
|
||
var s = 0;
|
||
//定义变量 d,h,m,s保存倒计时的时间
|
||
var d, h, m, s;
|
||
//递归每秒调⽤countTime⽅法,显⽰动态时间效果
|
||
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中
|
||
$('.page4 .page3tabBox .timeBox p .sp1').text(d);
|
||
$('.page4 .page3tabBox .timeBox p .sp2').text(h);
|
||
$('.page4 .page3tabBox .timeBox p .sp3').text(m);
|
||
$('.page4 .page3tabBox .timeBox p .sp4').text(s);
|
||
} else {
|
||
popularGetRank();
|
||
}
|
||
if (leftTime > 0) {
|
||
leftTime = leftTime - 1000;
|
||
}
|
||
roomGetRankTime = setTimeout(function () {
|
||
roomGetRankCountup(leftTime)
|
||
}, 1000);
|
||
}
|
||
// 打开页面4弹窗
|
||
$('.page4 .page4Title2').click(function () {
|
||
getRoomPkInfo();
|
||
$('.page4_pop').show();
|
||
bodyScroolFun(true);
|
||
})
|
||
// 获取名厅房间接口
|
||
function getRoomPkInfo () {
|
||
showLoading()
|
||
networkRequest({
|
||
type: 'GET',
|
||
url: urlPrefix + '/act/2023Annual/room/getRoomPkInfo',
|
||
success (res) {
|
||
if (res.code === 200) {
|
||
$('.page4_pop .page3_pop_in ul li').remove();
|
||
var str = '';
|
||
res.data.roomPkList.forEach((res, i) => {
|
||
str += `
|
||
<li>
|
||
<div class="lts">
|
||
<img src="${res.leftAvatar}" alt="" class="tx">
|
||
<p>${res.leftNick}</p>
|
||
</div>
|
||
<div class="rts">
|
||
<img src="${res.rightAvatar}" alt="" class="tx">
|
||
<p>${res.rightNick}</p>
|
||
</div>
|
||
<span class="right" roomUid=${res.leftUid}>
|
||
<b>围观助力</b>
|
||
</span>
|
||
</li>
|
||
`
|
||
})
|
||
$('.page4_pop .page3_pop_in ul').append(str);
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error (err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg('网络错误,请退出重进')
|
||
}
|
||
})
|
||
}
|
||
// 页面4跳转房间
|
||
$('.page4_pop .page3_pop_in ul').on('click', ' li .right', function () {
|
||
var roomUid = $(this).attr('roomUid');
|
||
if (browser.ios) {
|
||
window.webkit.messageHandlers.openRoom.postMessage(roomUid);
|
||
} else if (browser.android) {
|
||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||
window.androidJsObj.openRoom(roomUid);
|
||
}
|
||
}
|
||
|
||
})
|
||
// 关闭页面4弹窗
|
||
$('.page4_pop').click(function () {
|
||
$('.page4_pop').hide();
|
||
bodyScroolFun(false);
|
||
})
|
||
// 打开规则
|
||
$('.header .rule_icon').click(function () {
|
||
$('.rule').show();
|
||
bodyScroolFun(true);
|
||
})
|
||
|
||
// 规则弹窗切换
|
||
var ruleType = 1;
|
||
var contentTabBoxType = 3;
|
||
$('.rule .rule_in .TabBox div').click(function () {
|
||
var i = $(this).index() + 1;
|
||
ruleType = i;
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
$('.rule .rule_in .tabs div').eq(0).addClass('act').siblings().removeClass('act');
|
||
$('.rule .rule_in .content_tabBox .tab').eq(0).addClass('act').siblings().removeClass('act');
|
||
$('.rule .rule_in .content_tabBox').hide();
|
||
$('.rule .rule_in .content_tabBox2').hide();
|
||
$('.content1,.content2').hide();
|
||
$(`.content${i}`).show();
|
||
if (i == 1) {
|
||
$('.rule .rule_in .content1 img').attr('src', `./images/rule1.png`);
|
||
} else {
|
||
$('.rule .rule_in .content2 img').attr('src', `./images/rule21.png`);
|
||
}
|
||
return false;
|
||
})
|
||
// 规则弹窗小切换
|
||
var arr1 = ['01.05-01.08', '01.09-01.11', '01.12-01.14', '01.15-01.17', '1.18-01.19'];
|
||
var arr2 = ['01.05-01.07', '01.08-01.10', '01.11-01.13', '01.14-01.16', '1.17-01.19'];
|
||
$('.rule .rule_in .tabs div').click(function () {
|
||
var i = $(this).index() + 1;
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
contentTabBoxType = i;
|
||
if (ruleType == 1) {
|
||
$('.rule .rule_in .content_tabBox').hide();
|
||
if (i == 3) {
|
||
$('.rule .rule_in .content_tabBox').css('display', 'flex');
|
||
$('.rule .rule_in .content1 img').attr('src', `./images/rule${i}1.png`);
|
||
$('.rule .rule_in .content_tabBox .tab').eq(0).addClass('act').siblings().removeClass('act');
|
||
} else if (i == 4) {
|
||
$('.rule .rule_in .content_tabBox').css('display', 'flex');
|
||
$('.rule .rule_in .content1 img').attr('src', `./images/rule${i}1.png`);
|
||
$('.rule .rule_in .content_tabBox .tab').eq(0).addClass('act').siblings().removeClass('act');
|
||
} else {
|
||
$('.rule .rule_in .content1 img').attr('src', `./images/rule${i}.png`);
|
||
}
|
||
} else {
|
||
$('.rule .rule_in .content_tabBox2').hide();
|
||
if (i == 3) {
|
||
$('.rule .rule_in .content2 img').attr('src', `./images/rule23${1}.png`);
|
||
$('.rule .rule_in .content_tabBox2').css('display', 'flex');
|
||
$('.rule .rule_in .content_tabBox2 .tab').eq(0).addClass('act').siblings().removeClass('act');
|
||
} else {
|
||
$('.rule .rule_in .content2 img').attr('src', `./images/rule2${i}.png`);
|
||
}
|
||
}
|
||
if (i == 3) {
|
||
arr1.forEach((res, i) => {
|
||
$('.rule .rule_in .content_tabBox .tab span').eq(i).text(res);
|
||
})
|
||
$('.rule .rule_in .content_tabBox .tab p').eq(3).text('冲刺赛');
|
||
} else if (i == 4) {
|
||
arr2.forEach((res, i) => {
|
||
$('.rule .rule_in .content_tabBox .tab span').eq(i).text(res);
|
||
})
|
||
$('.rule .rule_in .content_tabBox .tab p').eq(3).text('半决赛');
|
||
}
|
||
return false;
|
||
})
|
||
// 规则弹窗晋级赛切换
|
||
$('.rule .rule_in .content_tabBox .tab').click(function () {
|
||
var i = $(this).index() + 1;
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
$('.rule .rule_in .content1 img').attr('src', `./images/rule${contentTabBoxType}${i}.png`);
|
||
return false;
|
||
})
|
||
// 规则弹窗晋级赛切换2
|
||
$('.rule .rule_in .content_tabBox2 .tab').click(function () {
|
||
var i = $(this).index() + 1;
|
||
$(this).addClass('act').siblings().removeClass('act');
|
||
$('.rule .rule_in .content2 img').attr('src', `./images/rule23${i}.png`);
|
||
return false;
|
||
})
|
||
// 关闭规则
|
||
$('.rule').click(function () {
|
||
$('.rule').hide();
|
||
bodyScroolFun(false);
|
||
})
|
||
//补0操作
|
||
function getzf (num) {
|
||
if (parseInt(num) < 10) {
|
||
num = '0' + num;
|
||
}
|
||
return num;
|
||
} |