2024-10-29 19:17:08 +08:00
|
|
|
|
let urlPrefix = getUrlPrefix()
|
|
|
|
|
let browser = checkVersion()
|
|
|
|
|
let env = EnvCheck();
|
|
|
|
|
if (env == 'test') {
|
|
|
|
|
new VConsole();
|
|
|
|
|
}
|
|
|
|
|
// 封裝layer消息提醒框
|
|
|
|
|
let layerIndex
|
|
|
|
|
var langReplace;
|
|
|
|
|
var localLang;
|
|
|
|
|
const showLoading = (content = langReplace(localLang.demoModule.layerIndex1)) => {
|
|
|
|
|
layer.open({
|
|
|
|
|
type: 2,
|
|
|
|
|
shadeClose: false,
|
|
|
|
|
content,
|
|
|
|
|
success(e) {
|
|
|
|
|
layerIndex = $(e).attr('index')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const hideLoading = (index) => {
|
|
|
|
|
layer.close(index)
|
|
|
|
|
}
|
|
|
|
|
const toastMsg = (content = langReplace(localLang.demoModule.layerIndex2), time = 2) => {
|
|
|
|
|
layer.open({
|
|
|
|
|
content,
|
|
|
|
|
time,
|
|
|
|
|
skin: 'msg'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
var countupTime;//倒计时容器
|
|
|
|
|
var page = 0;
|
|
|
|
|
var maxPage = 0;
|
|
|
|
|
var arr = [];
|
|
|
|
|
var music = true;
|
2025-09-02 14:42:54 +08:00
|
|
|
|
var weekRewardData;
|
2024-10-29 19:17:08 +08:00
|
|
|
|
// 初始化函數
|
|
|
|
|
$(function () {
|
|
|
|
|
getInfoFromClient();
|
|
|
|
|
fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
// 頁面全屏
|
|
|
|
|
if (browser.app) {
|
|
|
|
|
if (browser.android) {
|
|
|
|
|
window.androidJsObj.initShowNav(false)
|
|
|
|
|
} else {
|
|
|
|
|
window.webkit.messageHandlers.initShowNav.postMessage(0)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 頂部返回事件
|
|
|
|
|
$('.back .backIcon').click(() => {
|
|
|
|
|
window.history.back()
|
|
|
|
|
})
|
|
|
|
|
fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言
|
|
|
|
|
langReplace = window.lang.replace;
|
|
|
|
|
localLang = window.lang;
|
|
|
|
|
translateFun();
|
|
|
|
|
getConfig();
|
|
|
|
|
}, 100)
|
|
|
|
|
})
|
|
|
|
|
function translateFun() {
|
|
|
|
|
var langReplace = window.lang.replace;
|
|
|
|
|
var localLang = window.lang;
|
|
|
|
|
$('.text1').text(langReplace(localLang.weeklyRewards.text1));
|
2024-12-09 17:46:53 +08:00
|
|
|
|
if (window.localStorage.getItem('partitionId') == 2) {
|
|
|
|
|
$('.text2').html(langReplace(localLang.weeklyRewards.text2));
|
|
|
|
|
} else if (window.localStorage.getItem('partitionId') == 8) {
|
|
|
|
|
$('.text2').html(langReplace(localLang.weeklyRewards.text22));
|
|
|
|
|
}
|
2024-10-29 19:17:08 +08:00
|
|
|
|
$('.text3').text(langReplace(localLang.weeklyRewards.text3));
|
|
|
|
|
$('.text4').text(langReplace(localLang.weeklyRewards.text4));
|
|
|
|
|
$('.text5').text(langReplace(localLang.weeklyRewards.text5));
|
2025-09-02 14:42:54 +08:00
|
|
|
|
$('.Day').text(langReplace(localLang.demoModule.Day));
|
|
|
|
|
$('.Countdown').text(langReplace(localLang.demoModule.Countdown));
|
|
|
|
|
$('.Host_Level').text(langReplace(localLang.demoModule.Host_Level));
|
|
|
|
|
$('.Daily_Rewards').text(langReplace(localLang.demoModule.Daily_Rewards));
|
|
|
|
|
$('.Extra_Rewards').text(langReplace(localLang.demoModule.Extra_Rewards));
|
|
|
|
|
$('.Complete_days').text(langReplace(localLang.demoModule.Complete_days));
|
|
|
|
|
$('.mic_chat').text(langReplace(localLang.demoModule.mic_chat));
|
|
|
|
|
$('.Unlock_time').text(langReplace(localLang.demoModule.Unlock_time));
|
|
|
|
|
$('.Days').text(langReplace(localLang.demoModule.Days));
|
|
|
|
|
|
2024-10-29 19:17:08 +08:00
|
|
|
|
}
|
2025-09-02 14:42:54 +08:00
|
|
|
|
var tabActive = 0;
|
2024-10-29 19:17:08 +08:00
|
|
|
|
// 配置接口
|
|
|
|
|
function getConfig() {
|
2025-09-02 14:42:54 +08:00
|
|
|
|
$('.rewards_list .rewards_box').remove();
|
2024-10-29 19:17:08 +08:00
|
|
|
|
$('.tab div').remove();
|
|
|
|
|
showLoading()
|
|
|
|
|
networkRequest({
|
|
|
|
|
type: 'get',
|
2024-10-30 10:20:25 +08:00
|
|
|
|
url: urlPrefix + '/guildMemberWeekLevelReward/get',
|
2024-10-29 19:17:08 +08:00
|
|
|
|
success(res) {
|
|
|
|
|
if (res.code === 200) {
|
2025-09-02 14:42:54 +08:00
|
|
|
|
weekRewardData = res.data;
|
2024-10-29 19:17:08 +08:00
|
|
|
|
var tabStr = '';
|
2025-09-02 14:42:54 +08:00
|
|
|
|
weekRewardData.forEach(((res, i) => {
|
2024-10-29 19:17:08 +08:00
|
|
|
|
tabStr += `
|
2025-09-02 14:42:54 +08:00
|
|
|
|
<div class="${i == tabActive ? 'act' : ''}">${res.dateRange}</div>
|
2024-10-29 19:17:08 +08:00
|
|
|
|
`
|
|
|
|
|
}))
|
|
|
|
|
$('.tab').append(tabStr);
|
2025-09-02 14:42:54 +08:00
|
|
|
|
ulFun(tabActive);
|
2024-10-29 19:17:08 +08:00
|
|
|
|
// tab切换
|
|
|
|
|
$('.tab div').click(function () {
|
|
|
|
|
var i = $(this).index();
|
2025-09-02 14:42:54 +08:00
|
|
|
|
tabActive = i;
|
2024-10-29 19:17:08 +08:00
|
|
|
|
$(this).addClass('act').siblings().removeClass('act');
|
2025-09-02 14:42:54 +08:00
|
|
|
|
ulFun(tabActive)
|
|
|
|
|
getConfig();
|
2024-10-29 19:17:08 +08:00
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
toastMsg(res.message)
|
|
|
|
|
}
|
|
|
|
|
hideLoading(layerIndex)
|
|
|
|
|
},
|
|
|
|
|
error(err) {
|
|
|
|
|
hideLoading(layerIndex)
|
|
|
|
|
toastMsg(langReplace(localLang.demoModule.layerIndex3))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function ulFun(index) {
|
2025-09-02 14:42:54 +08:00
|
|
|
|
let weekLevelData = weekRewardData[index]
|
|
|
|
|
countup(weekLevelData.countDownSecond)
|
|
|
|
|
$('.preMaxNum').text(weekLevelData.preMaxNum);
|
|
|
|
|
$('.maxNum').text(weekLevelData.maxNum);
|
|
|
|
|
$('.processNum').text(weekLevelData.processNum);
|
|
|
|
|
if (window.lang.code == 'ar') {
|
|
|
|
|
$('.preLevel').text(weekLevelData.curLevel);
|
|
|
|
|
$('.curLevel').text(weekLevelData.preLevel);
|
|
|
|
|
} else {
|
|
|
|
|
$('.preLevel').text(weekLevelData.preLevel);
|
|
|
|
|
$('.curLevel').text(weekLevelData.curLevel);
|
|
|
|
|
}
|
|
|
|
|
// 计算进度条
|
|
|
|
|
let progressWidth = CalculateProgress(weekLevelData.processNum, weekLevelData.preMaxNum, weekLevelData.maxNum)
|
|
|
|
|
$('.progress-bar').css('width', progressWidth + '%');
|
|
|
|
|
|
|
|
|
|
// 渲染奖励列表
|
|
|
|
|
$('.rewards_list .rewards_box').remove();
|
|
|
|
|
let str = ''
|
|
|
|
|
weekLevelData.itemList.forEach((item, index) => {
|
2024-10-29 19:17:08 +08:00
|
|
|
|
str += `
|
2025-09-02 14:42:54 +08:00
|
|
|
|
<div class="rewards_box">
|
|
|
|
|
<div class="left_box" status="${item.status}" id="${item.id}">
|
|
|
|
|
<img src="./images/epconis.png" alt="">
|
|
|
|
|
${item.rewardNum}
|
|
|
|
|
<img src="./images/weiwancheng.png" alt="" class="status_img" style="display: ${item.status == 0 ? 'block' : 'none'}">
|
|
|
|
|
<img src="./images/yilingqu.png" alt="" class="status_img" style="display: ${item.status == 2 ? 'block' : 'none'}">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="middle_box">
|
|
|
|
|
<div class="level">${item.level}</div>
|
|
|
|
|
<div class="progress_box">
|
|
|
|
|
<div class="progress_bar" style="height: ${CalculateProgress(item.processNum, item.preMaxNum, item.maxNum)}%"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-09-02 15:38:54 +08:00
|
|
|
|
<div class="right_box" status="${item.bonusStatus}" id="${item.id}">
|
2025-09-02 14:42:54 +08:00
|
|
|
|
<img src="./images/epconis.png" alt="">
|
|
|
|
|
${item.bonusRewardNum}
|
|
|
|
|
<img src="./images/weiwancheng.png" alt="" class="status_img" style="display: ${item.bonusStatus == 0 ? 'block' : 'none'}">
|
|
|
|
|
<img src="./images/yilingqu.png" alt="" class="status_img" style="display: ${item.bonusStatus == 2 ? 'block' : 'none'}">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
`
|
|
|
|
|
});
|
|
|
|
|
$('.rewards_list').append(str)
|
|
|
|
|
|
|
|
|
|
// 底部
|
|
|
|
|
$('.bottom_fixed_box .bonusPreMaxNum').text(weekLevelData.bonusPreMaxNum)
|
|
|
|
|
$('.bottom_fixed_box .bonusMaxNum').text(weekLevelData.bonusProcessNum + '/' + weekLevelData.bonusMaxNum)
|
|
|
|
|
// 计算进度条
|
|
|
|
|
let progressWidthBottomFixed = CalculateProgress(weekLevelData.bonusProcessNum, weekLevelData.bonusPreMaxNum, weekLevelData.bonusMaxNum)
|
|
|
|
|
$('.bottom_fixed_box .progress_bar').css('width', progressWidthBottomFixed + '%');
|
2024-10-29 19:17:08 +08:00
|
|
|
|
}
|
2025-09-02 14:42:54 +08:00
|
|
|
|
// 计算进度条 (进度-初始值) / (最大值-初始值)
|
|
|
|
|
function CalculateProgress(processNum, preMaxNum, maxNum) {
|
|
|
|
|
let num = Math.min(100, Math.round((processNum - preMaxNum) / (maxNum - preMaxNum) * 100))
|
|
|
|
|
return num
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getReward(id, isBonus) {
|
2024-10-29 19:17:08 +08:00
|
|
|
|
showLoading()
|
|
|
|
|
networkRequest({
|
|
|
|
|
type: 'post',
|
2024-10-30 10:20:25 +08:00
|
|
|
|
url: urlPrefix + '/guildMemberWeekLevelReward/getReward',
|
2024-10-29 19:17:08 +08:00
|
|
|
|
data: {
|
|
|
|
|
id,
|
2025-09-02 14:42:54 +08:00
|
|
|
|
isBonus
|
2024-10-29 19:17:08 +08:00
|
|
|
|
},
|
|
|
|
|
success(res) {
|
|
|
|
|
if (res.code === 200) {
|
2025-09-04 14:33:05 +08:00
|
|
|
|
toastMsg(langReplace(localLang.demoModule.The_wallet))
|
2024-10-30 11:09:32 +08:00
|
|
|
|
getConfig();
|
2024-10-29 19:17:08 +08:00
|
|
|
|
} else {
|
|
|
|
|
toastMsg(res.message)
|
|
|
|
|
}
|
|
|
|
|
hideLoading(layerIndex)
|
|
|
|
|
},
|
|
|
|
|
error(err) {
|
|
|
|
|
hideLoading(layerIndex)
|
|
|
|
|
toastMsg(langReplace(localLang.demoModule.layerIndex3))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 领取按钮
|
2025-09-02 14:42:54 +08:00
|
|
|
|
$('.rewards_list ').on('click', '.rewards_box .left_box', function () {
|
2024-10-29 19:17:08 +08:00
|
|
|
|
var status = $(this).attr('status');
|
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
|
if (status == 1) {
|
2025-09-02 14:42:54 +08:00
|
|
|
|
getReward(id, false);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 领取按钮
|
|
|
|
|
$('.rewards_list ').on('click', '.rewards_box .right_box', function () {
|
|
|
|
|
var status = $(this).attr('status');
|
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
|
if (status == 1) {
|
|
|
|
|
getReward(id, true);
|
2024-10-29 19:17:08 +08:00
|
|
|
|
}
|
2025-04-07 11:11:17 +08:00
|
|
|
|
})
|
|
|
|
|
// 计算- 取消中文向下取整
|
|
|
|
|
function unitProcessingZhuan(val, toFixeds) { //值 保留几位小数
|
|
|
|
|
if (getQueryString().lang && getQueryString().lang == 'zh') {
|
|
|
|
|
return val >= 10000 ? ((val / 1000) / 10).toFixed(toFixeds) + 'w' : val;
|
|
|
|
|
} else {
|
|
|
|
|
if (val < 1000) {
|
|
|
|
|
return val;
|
|
|
|
|
} else if (val >= 1000 && val < 1000000) {
|
|
|
|
|
return (val / 1000).toFixed(toFixeds) + 'K'
|
|
|
|
|
} else if (val >= 1000000) {
|
|
|
|
|
return (val / 1000000).toFixed(toFixeds) + 'M'
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-02 14:42:54 +08:00
|
|
|
|
}
|
|
|
|
|
var countupTime1;//倒计时容器
|
|
|
|
|
// 倒計時
|
|
|
|
|
function countup(leftTime, type) {
|
|
|
|
|
clearTimeout(countupTime1)
|
|
|
|
|
//獲取當前時間
|
|
|
|
|
// 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 / 60 / 60 / 24));
|
|
|
|
|
h = getzf(Math.floor(leftTime / 60 / 60 % 24));
|
|
|
|
|
m = getzf(Math.floor(leftTime / 60 % 60));
|
|
|
|
|
s = getzf(Math.floor(leftTime % 60));
|
|
|
|
|
//將倒計時賦值到div中
|
|
|
|
|
$('.day_txt').text(d);
|
|
|
|
|
$('.hour_txt').text(h);
|
|
|
|
|
$('.min_txt').text(m);
|
|
|
|
|
$('.secs_txt').text(s);
|
|
|
|
|
} else {
|
|
|
|
|
$('.day_txt').text('00');
|
|
|
|
|
$('.hour_txt').text('00');
|
|
|
|
|
$('.min_txt').text('00');
|
|
|
|
|
$('.secs_txt').text('00');
|
|
|
|
|
}
|
|
|
|
|
if (leftTime > 0) {
|
|
|
|
|
leftTime = leftTime - 1;
|
|
|
|
|
} else {
|
|
|
|
|
clearTimeout(countupTime1);
|
|
|
|
|
}
|
|
|
|
|
countupTime1 = setTimeout(function () {
|
|
|
|
|
countup(leftTime);
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
//补0操作
|
|
|
|
|
function getzf(num) {
|
|
|
|
|
if (parseInt(num) < 10) {
|
|
|
|
|
num = '0' + num;
|
|
|
|
|
}
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
// 清除计时器
|
|
|
|
|
function pauseCountdown() {
|
|
|
|
|
clearInterval(countupTime1);
|
|
|
|
|
}
|
|
|
|
|
// 监听页面显示事件
|
|
|
|
|
document.addEventListener('visibilitychange', () => {
|
|
|
|
|
if (document.hidden) {
|
|
|
|
|
pauseCountdown();
|
|
|
|
|
} else {
|
|
|
|
|
// 重新请求接口获取最新的倒计时数据
|
|
|
|
|
pauseCountdown();
|
|
|
|
|
getConfig();
|
|
|
|
|
}
|
|
|
|
|
});
|