// 封装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' }) } let urlPrefix = getUrlPrefix() let browser = checkVersion() let env = EnvCheck(); var startTime;//活动开始时间 var endTime;//活动结束时间 var nowTime = new Date().getTime(); var firstExplorer;//是否首次高级探险 var roomUid; let page = 0; let scrollBool = true; var passStatus;//水晶通关状态 var caystalTrialLevel;//水晶当前等级 var caystalTrialLevelIndex;//水晶当前等级 var rankType = 0;//默认日榜 var currentTimes = 1; var amethystStoneArr = [ { giftNick: './images/amethystStoneText1.png', img: './images/amethystStone3.png', num: 700, value: '3天', awardName: '丛林秘藏', imgs: './images/img1.png' }, { giftNick: './images/amethystStoneText2.png', img: './images/amethystStone2.png', num: 1500, value: '3天', awardName: '大魔导师', imgs: './images/img2.png' }, { giftNick: './images/amethystStoneText3.png', img: './images/amethystStone1.png', num: 1800, value: '3天', awardName: '独角兽座驾', imgs: './images/img3.png' }, ] if (env == 'test') { new VConsole(); } var xsSvgaClick = true; $(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) } }) getPageInfo(); getRecommendRoom(); }, 100) }) var player1; var player2; var player3; function xsSvgaFun1 () { bodyScroolFun(true); $('.page1 .darkForest .csvags').show(); player1 = new SVGA.Player('.csvag'); parser1 = new SVGA.Parser('.csvag'); console.log(parser1); parser1.load('./images/csvag.svga', function (videoItem) { player1.loops = 1; player1.clearsAfterStop = false; player1.setVideoItem(videoItem); player1.startAnimation(); player1.setContentMode('AspectFill') player1.onFinished(() => { $('.page1 .darkForest .csvags').hide(); bodyScroolFun(false); }) }) } function xsSvgaFun2 () { bodyScroolFun(true); $('.page1 .darkForest .gsvags').show(); player1 = new SVGA.Player('.gsvag'); parser1 = new SVGA.Parser('.gsvag'); parser1.load('./images/gscag.svga', function (videoItem) { player1.loops = 1; player1.clearsAfterStop = false; player1.setVideoItem(videoItem); player1.startAnimation(); player1.setContentMode('AspectFill') player1.onFinished(() => { bodyScroolFun(false); $('.page1 .darkForest .gsvags').hide(); }) }) } function xsSvgaFun3 () { bodyScroolFun(true); $('.page2 .amethystStone .amethystStoneGiftSvgas').show(); player1 = new SVGA.Player('.ssvag'); parser1 = new SVGA.Parser('.ssvag'); parser1.load('./images/ssvag.svga', function (videoItem) { player1.loops = 1; player1.clearsAfterStop = false; player1.setVideoItem(videoItem); player1.startAnimation(); player1.setContentMode('AspectFill') player1.onFinished(() => { bodyScroolFun(false); $('.page2 .amethystStone .amethystStoneGiftSvgas').hide(); }) }) } // 获取魔法师成就墙接口 function getMagicList () { $('.page2 .amethystStoneList ul li').remove(); showLoading() networkRequest({ type: 'GEt', url: urlPrefix + '/activity/magic/magicList', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid }, success (res) { if (res.code === 200) { var str = ''; res.data.forEach((res => { str += `
  • ${res.nick.length > 4 ? res.nick.slice(0, 4) + '...' : res.nick}
  • ` })) $('.page2 .amethystStoneList ul').append(str) hideLoading(layerIndex) } else { hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 获取房间接口 function getRecommendRoom () { showLoading() networkRequest({ type: 'GEt', url: urlPrefix + '/act/cp/2022/getRecommendRoom', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid }, success (res) { if (res.code === 200) { roomUid = res.data; hideLoading(layerIndex) } else { hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 初始化 function getPageInfo () { showLoading() networkRequest({ type: 'GEt', url: urlPrefix + '/activity/magic/info', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid }, success (res) { if (res.code === 200) { startTime = res.data.startTime; endTime = res.data.endTime; console.log(dateFormat(startTime, "MM月dd日")); console.log(dateFormat(endTime, "MM月dd日")); $('.page3 .list .time b').attr('time', nowTime); $('.page3 .list .time b').text(dateFormat(nowTime, "MM月dd日")); if (nowTime > endTime) { $('.page3 .list .time b').attr('time', endTime); $('.page3 .list .time b').text(dateFormat(endTime, "MM月dd日")); console.log(sessionStorage.getItem('bool')); if (sessionStorage.getItem('bool') != "true") { $('.actOut').show(); bodyScroolFun(true); } } firstExplorer = res.data.firstExplorer if (firstExplorer) { $('.page1 .darkForest .seniorBut img').hide(); } else { $('.page1 .darkForest .seniorBut img').show(); } $('.page1 .darkForest .rough b').text(res.data.stoneNum); var nums = 0; res.data.taskList.forEach((res, index) => { $(`.page1 .toast .toast${index + 1} p b`).text(res.num != undefined ? res.num : ''); if (res.taskStatus == 2) { nums = nums + 33.33333333333333; } if (index + 1 == 3) { $(`.page1 .toast .toast${index + 1} p b`).text(res.taskStatus == 2 ? 30 : 0); } if (res.taskStatus == 1) { $(`.page1 .toast .toast${index + 1} div`).attr('click', 0); if (index + 1 < 4) { $(`.page1 .toast .toast${index + 1} div`).addClass('but'); } else { $(`.page1 .toast .toast${index + 1} div`).addClass('toast_ing'); } } else { $(`.page1 .toast .toast${index + 1} div`).attr('click', 1); if (index + 1 > 4) { $(`.page1 .toast .toast${index + 1} div`).addClass('toast_out'); } else { $(`.page1 .toast .toast${index + 1} div`).addClass('toast_out'); } } if (index + 1 == 1 || index + 1 == 3) { $(`.page1 .toast .toast${index + 1} div`).attr('room', 1); } else { $(`.page1 .toast .toast${index + 1} div`).attr('room', 0); } if (index + 1 == 4) { $(`.page1 .toast .toast4 span i`).text(`(${res.num}/3)`); if (res.taskStatus == 2) { $(`.page1 .toast .toast${index + 1} span b`).css('width', '100%') } else { $(`.page1 .toast .toast${index + 1} span b`).css('width', `${nums}%`) } } hideLoading(layerIndex) }) } else { hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 查看榜单按钮 $('.actOut .actOut_in .but').click(function () { sessionStorage.setItem("bool", 'true'); bodyScroolFun(false); $('.page1').hide(); $('.page2').hide(); $('.tab div:nth-child(3)').attr('id', 'tab3'); $('.tab div:nth-child(1)').attr('id', ''); currentTimes = 1; getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); $('.page3 .list').removeClass('list2'); $('.page3').show(); $('.actOut').hide(); }) // 探险记录接口 function getExplorerRecord (page) { scrollBool = false; showLoading() networkRequest({ type: 'GEt', url: urlPrefix + '/activity/magic/explorerRecord', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid, page, pageSize: 10 }, success (res) { if (res.code === 200) { scrollBool = true; var str = ``; if (res.data.length == 0) { scrollBool = false; } else { res.data.forEach((res, index) => { str += `
  • ${dateFormat(res.createTime, 'yyyy/MM/dd')}

    ${dateFormat(res.createTime, 'hh:mm:ss')}

    ${res.objDes}

  • ` }) } $('.forestReward .forestReward_in .forestRewardPage2 ul').append(str); console.log(page); hideLoading(layerIndex) } else { scrollBool = true; hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { scrollBool = true; hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 探险接口 function getExplorer (explorerType) { showLoading() networkRequest({ type: 'post', url: urlPrefix + '/activity/magic/explorer', data: { explorerType, pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid, }, success (res) { if (res.code === 200) { $('.gx .gx_in .gift').text(res.data.awardName); $('.gx .gx_in .gift_bg img').removeClass('img1'); if (res.data.awardType == 3 || res.data.awardType == 1 || res.data.awardType == 2) { if (res.data.awardType == 1) { $('.gx .gx_in .gift_bg img').addClass('img1'); } $('.gx .gx_in .num').text(res.data.awardPrice + '天'); } else if (res.data.awardType == 4) { $('.gx .gx_in .num').text(res.data.awardPrice + '鉆石'); } else if (res.data.awardType == 5) { $('.gx .gx_in .gift').text(res.data.awardName + '*' + res.data.awardPrice); $('.gx .gx_in .num').text(''); } $('.gx .gx_in .gift_bg img').attr('src', res.data.awardUrl); $('.gx').show(); getPageInfo(); hideLoading(layerIndex) xsSvgaClick = true; } else if (res.code == 10007) { hideLoading(layerIndex); hideLoading(layerIndex); $('.actOut').show(); } else { xsSvgaClick = true; hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { xsSvgaClick = true; hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 水晶试炼场接口 function getCaystalTrial (num) { showLoading() networkRequest({ type: 'POST', url: urlPrefix + '/activity/magic/caystalTrial', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid, num }, success (res) { if (res.code === 200) { xsSvgaClick = true; if (res.data != undefined) { $('.gx .gx_in .gift').text(res.data.awardName); $('.gx .gx_in .gift_bg img').removeClass('img1'); if (res.data.awardType == 3 || res.data.awardType == 1 || res.data.awardType == 2) { if (res.data.awardType == 1) { $('.gx .gx_in .gift_bg img').addClass('img1'); } $('.gx .gx_in .num').text(res.data.awardNum + '天'); } else if (res.data.awardType == 4) { $('.gx .gx_in .num').text(res.data.awardNum + '鉆石'); } else if (res.data.awardType == 5) { $('.gx .gx_in .gift').text(res.data.awardName + '*' + res.data.awardNum); $('.gx .gx_in .num').text(''); } $('.gx .gx_in .gift_bg img').attr('src', res.data.awardUrl); $('.gx').show(); // $('.gx').show(); // $('.gx .gx_in .gift_bg img').attr('src', res.data.awardUrl); // $('.gx .gx_in .gift').text(res.data.awardName); // $('.gx .gx_in .num').text(res.data.awardNum + '天'); } getCaystalTrialInit(); hideLoading(layerIndex) } else { xsSvgaClick = true; hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { xsSvgaClick = true; hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } $('.page2 .amethystStone .amethystStoneBut1').click(function () { if (xsSvgaClick) { var num = $('.page2 .amethystStone .lineBox p b').text(); if (num != 0) { xsSvgaClick = false; xsSvgaFun3() setTimeout(function () { getCaystalTrial(1) }, 2000) } else { toastMsg('水晶石不足') } } }) $('.page2 .amethystStone .amethystStoneBut5').click(function () { if (xsSvgaClick) { var num = $('.page2 .amethystStone .lineBox p b').text(); if (num != 0) { xsSvgaClick = false; xsSvgaFun3() setTimeout(function () { getCaystalTrial(5) }, 2000) } else { toastMsg('水晶石不足') } } }) // 获取水晶试炼场初始化接口 var schedulevale; function getCaystalTrialInit () { showLoading() networkRequest({ type: 'GEt', url: urlPrefix + '/activity/magic/caystalTrialInit', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid }, success (res) { if (res.code === 200) { passStatus = res.data.passStatus; if (passStatus == true) { caystalTrialLevel = 2; caystalTrialLevelIndex = 2; } else { caystalTrialLevel = res.data.caystalTrialLevel; caystalTrialLevelIndex = res.data.caystalTrialLevel; } $('.page2 .amethystStone .lineBox p b').text(res.data.caystalNum); $('.page2 .amethystStone .lineBox i strong').text(res.data.schedule); schedulevale = res.data.schedule; crystalTestingHround(schedulevale); hideLoading(layerIndex) } else { hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 处理水晶切换 function crystalTestingHround (schedulevale) { if (passStatus == true) { $('.page2 .amethystStone .amethystStoneGift').attr('src', amethystStoneArr[caystalTrialLevel].img); $('.page2 .amethystStone .stoneNick').attr('src', amethystStoneArr[caystalTrialLevel].giftNick); $('.page2 .amethystStone .lineBox span').css('width', `${100}%`); $('.page2 .amethystStone .lineBox i em').text(amethystStoneArr[caystalTrialLevel].num); $('.page2 .amethystStone .lineBox i strong').text(amethystStoneArr[caystalTrialLevel].num); $('.amethystStoneBut1').hide(); $('.amethystStoneBut5').hide(); $('.amethystStoneOut').show(); } else { $('.page2 .amethystStone .amethystStoneGift').attr('src', amethystStoneArr[caystalTrialLevel].img); $('.page2 .amethystStone .stoneNick').attr('src', amethystStoneArr[caystalTrialLevel].giftNick); $('.page2 .amethystStone .lineBox i em').text(amethystStoneArr[caystalTrialLevel].num); $('.page2 .amethystStone .lineBox span').css('width', `${(schedulevale / amethystStoneArr[caystalTrialLevel].num) * 100}%`); if (caystalTrialLevel < caystalTrialLevelIndex) { $('.amethystStoneBut1').hide(); $('.amethystStoneBut5').hide(); $('.amethystStoneOut').show(); $('.page2 .amethystStone .lineBox i strong').text(amethystStoneArr[caystalTrialLevel].num); $('.page2 .amethystStone .lineBox span').css('width', `${100}%`); } else if (caystalTrialLevel > caystalTrialLevelIndex) { $('.amethystStoneBut1').hide(); $('.amethystStoneBut5').hide(); $('.amethystStoneOut').hide(); $('.page2 .amethystStone .lineBox i strong').text(0); $('.page2 .amethystStone .lineBox span').css('width', `${0}%`); } else if (caystalTrialLevel == caystalTrialLevelIndex) { $('.amethystStoneBut1').show(); $('.amethystStoneBut5').show(); $('.amethystStoneOut').hide(); $('.page2 .amethystStone .lineBox i strong').text(schedulevale); } } if (caystalTrialLevel == 0) { $('.page2 .amethystStone .right').hide(); } else { $('.page2 .amethystStone .right').show(); } if (caystalTrialLevel == amethystStoneArr.length - 1) { $('.page2 .amethystStone .left').hide(); } else { $('.page2 .amethystStone .left').show(); } } // 水晶左切换 $('.page2 .amethystStone .right').click(function () { if (caystalTrialLevel < amethystStoneArr.length - 1) { caystalTrialLevel = 0; } else { caystalTrialLevel = caystalTrialLevel - 1; } crystalTestingHround(schedulevale); }) // 水晶右切换 $('.page2 .amethystStone .left').click(function () { if (caystalTrialLevel >= amethystStoneArr.length - 1) { caystalTrialLevel = amethystStoneArr.length - 1; } else { caystalTrialLevel = caystalTrialLevel + 1; } crystalTestingHround(schedulevale); }) //点击查看原石奖励 $('.page2 .amethystStone .amethystStoneGift').click(function () { $('.look_put .look_put_in .gift').removeClass('gift2'); if (caystalTrialLevel != 0) { $('.look_put .look_put_in .gift').addClass('gift1'); if (caystalTrialLevel == 2) { $('.look_put .look_put_in .gift').removeClass('gift1'); $('.look_put .look_put_in .gift').addClass('gift2'); } } else { $('.look_put .look_put_in .gift').removeClass('gift1'); } $('.look_put .look_put_in .gift').attr('src', amethystStoneArr[caystalTrialLevel].imgs); $('.look_put .look_put_in .giftNick').text(amethystStoneArr[caystalTrialLevel].awardName) $('.look_put .look_put_in .num').text(amethystStoneArr[caystalTrialLevel].value); if (passStatus == true || caystalTrialLevel < caystalTrialLevelIndex) { $('.look_put .obtained').show(); }; $('.look_put .p2').show(); $('.look_put').show(); bodyScroolFun(true); }) // 问号查看奖励 $('.page2 .amethystStoneList .wenhao').click(function () { $('.look_put .look_put_in .gift').attr('src', './images/shanhu.png'); $('.look_put .look_put_in .giftNick').text("珊瑚头饰") $('.look_put .look_put_in .num').text('3天'); $('.look_put .p1').show(); $('.look_put').show(); }) // 关闭查看奖励弹窗 $('.look_put .look_put_in .but').click(function () { $('.look_put .p2').hide(); $('.look_put .p1').hide(); $('.look_put .obtained').hide(); $('.look_put').hide(); bodyScroolFun(false); }) //关闭恭喜弹窗 $('.gx .gx_in .but').click(function () { $('.gx').hide(); }) // 监听滚动 $('.forestReward .forestReward_in .forestRewardPage2 ul').scroll(function () { let scrollTop = $(this).scrollTop() let scrollHeight = $('.forestReward .forestReward_in .forestRewardPage2 ul')[0].scrollHeight let ulHeight = $(this).innerHeight() if (scrollTop + ulHeight + 100 >= scrollHeight) { if (scrollBool) { page++; getExplorerRecord(page); } } }) // 初级探险 $('.page1 .darkForest .primaryBut').click(function () { if (xsSvgaClick) { var num = $('.page1 .darkForest .rough b').text(); if (num != 0) { xsSvgaClick = false; xsSvgaFun1() setTimeout(function () { getExplorer(0, 1) }, 2000) } else { toastMsg('原石不足') } } }) // 高级探险 $('.page1 .darkForest .seniorBut').click(function () { if (xsSvgaClick) { var num = $('.page1 .darkForest .rough b').text(); if (num != 0) {//num != 0 xsSvgaClick = false; xsSvgaFun2() setTimeout(function () { getExplorer(1, 3) }, 3000) } else { if (firstExplorer == false) { xsSvgaClick = false; xsSvgaFun2() setTimeout(function () { getExplorer(1, 3) }, 3000) } else { toastMsg('原石不足') } } } }) // 处理时间函数 function timeFun (LR,) { var times = Number($('.page3 .list .time b').attr('time')); if (LR == 1) { times = (times - (1000 * 60 * 60 * 24)); if (startTime > times) { $('.page3 .list .time b').text(dateFormat(startTime, "MM月dd日")); $('.page3 .list .time b').attr('time', startTime); times = startTime toastMsg('不能小于活动开始时间'); } else { $('.page3 .list .time b').attr('time', (times)); $('.page3 .list .time b').text(dateFormat(times, "MM月dd日")); getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); } } else { if (times >= endTime) { $('.page3 .list .time b').text(dateFormat(endTime, "MM月dd日")); $('.page3 .list .time b').attr('time', endTime); times = endTime toastMsg('不能大于活动结束时间'); } else { $('.page3 .list .time b').text(dateFormat((times + (1000 * 60 * 60 * 24)), "MM月dd日")); $('.page3 .list .time b').attr('time', (times + (1000 * 60 * 60 * 24))); getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); } } } // 左时间切换按钮 $('.page3 .list .time .timeLeftBg').click(function () { timeFun(1,) }) // 右时间切换按钮 $('.page3 .list .time .timeRightBg').click(function () { timeFun(2,) }) // tab切换 $('.tab div').click(function () { var i = $(this).index() + 1; $(this).siblings().attr('id', ''); $(this).attr("id", `tab${i}`); $(`.page${i}`).show(); if (i == 1) { $('.page2').hide(); $('.page3').hide(); } else if (i == 2) { $('.page1').hide(); $('.page3').hide(); getCaystalTrialInit(); getMagicList(); } else if (i == 3) { $('.page1').hide(); $('.page2').hide(); currentTimes = 1; getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); $('.page3 .list').removeClass('list2'); $('.page3').show(); } else if (i == 4) { $('.page1').hide(); $('.page2').hide(); currentTimes = 2; getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); $('.page3 .list').addClass('list2'); $('.page3').show(); } }) // 切换总榜日榜 $('.page3 .list .tabs div').click(function () { var i = $(this).index() + 1; $(this).addClass('tabAcative').siblings().removeClass('tabAcative'); if (i == 1) { $('.page3 .list .tabs').css('margin',"1.48rem auto 0.3866666667rem") $('.page3 .list .time').show(); rankType = 0; getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); } else { $('.page3 .list .tabs').css('margin',"1.48rem auto 1rem") $('.page3 .list .time').hide(); rankType = 1; getRank(rankType, Number($('.page3 .list .time b').attr('time')), currentTimes); } }) // 获取榜单接口 function getRank (rankType, currentTime, comeFrom) { $('.page3 .list .notTop li').remove() showLoading() networkRequest({ type: 'GEt', url: urlPrefix + '/activity/magic/rank', data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid, rankType, currentTime: Number(currentTime), comeFrom }, success (res) { if (res.code === 200) { var top3 = res.data.rankList.slice(0, 3); var notTop3 = res.data.rankList.slice(3); // 处理自己榜单 $('.page3 .myList img').attr('src', res.data.userRank.avatar); $('.page3 .myList .num').text(res.data.userRank.rank == 0 ? '未上榜' : res.data.userRank.rank); $('.page3 .myList .nick').text(res.data.userRank.nick.length > 8 ? res.data.userRank.nick.slice(0, 8) + '...' : res.data.userRank.nick); $('.page3 .myList .score').text(comeFrom == 1 ? 'piko值:' + unitProcessing(res.data.userRank.rankValue, 10000, 1, 'w') : '魅力值:' + unitProcessing(res.data.userRank.rankValue, 10000, 1, 'w')); hideLoading(layerIndex) // 处理前三 if (top3.length < 3) { let arr = new Array(3 - top3.length).fill({ avatar: './images/logo.png', nick: '虚位以待', rankValue: "" }) top3.push(...arr) } top3.forEach((res, index) => { $(`.page3 .list .top${index + 1} .txBg`).attr('src', res.avatar); $(`.page3 .list .top${index + 1} .nick`).text(res.nick.length > 6 ? res.nick.slice(0, 6) + '...' : res.nick); $(`.page3 .list .top${index + 1} p`).text(comeFrom == 1 ? 'piko值:' + unitProcessing(res.rankValue, 10000, 1, 'w') : '魅力值:' + unitProcessing(res.rankValue, 10000, 1, 'w')); }) // 非前三 var str = ''; notTop3.forEach((res, index) => { str += `
  • NO.${index + 4}
    ${res.nick.length > 6 ? res.nick.slice(0, 6) + '...' : res.nick}
    ${comeFrom == 1 ? 'piko值:' + unitProcessing(res.rankValue, 10000, 1, 'w') : '魅力值:' + unitProcessing(res.rankValue, 10000, 1, 'w')}
  • ` }) $('.page3 .list .notTop').append(str); } else { hideLoading(layerIndex) toastMsg(res.message) } }, error (err) { hideLoading(layerIndex) toastMsg('網絡錯誤,請退出重進') } }) } // 打开榜单奖励 $('.page3 .list .rule_list_icon').click(function () { $('.list_r').show(); bodyScroolFun(true); }) $('.list_r').click(function () { $(this).hide(); bodyScroolFun(false); }) // 首页跳转房间 $('.page1 .toast .to div').click(function (params) { var room = $(this).attr('room'); var click = $(this).attr('click'); if (click == 1) { console.log('已完成'); } else { if (browser.ios) { window.webkit.messageHandlers.openRoom.postMessage(roomUid); } else if (browser.android) { if (androidJsObj && typeof androidJsObj === 'object') { window.androidJsObj.openRoom(roomUid); } } } }) // 控制body是否可以滑动 function bodyScroolFun (bool) { if (bool) { $('body').css('overflow', 'hidden'); } else { $('body').css('overflow', 'auto'); } } // 切换森林奖励/记录按钮 var forestRewardPageClick = true; $('.forestReward .forestReward_in .forestRewardTab div').click(function () { var i = $(this).index() + 1; if (i == 1) { $(this).addClass('forestRewardTab1_active').siblings().removeClass('forestRewardTab2_active').addClass('forestRewardTab2s'); $('.forestRewardPage1').show(); $('.forestRewardPage2').hide(); } else { $(this).addClass('forestRewardTab2_active').siblings().removeClass('forestRewardTab1_active').addClass('forestRewardTab1'); $('.forestRewardPage2').show(); $('.forestRewardPage1').hide(); } return false }) // 高级探险/初级探险切换按钮 $('.forestReward .forestReward_in .forestRewardPage1 .box1 div').click(function () { var i = $(this).index() + 1; $(this).addClass('active').siblings().removeClass('active') if (i == 1) { $('.forestReward .forestReward_in .forestRewardPage1 .forestRewardPage1Bg').attr('src', './images/forestRewardPage1Bg1.png'); } else { $('.forestReward .forestReward_in .forestRewardPage1 .forestRewardPage1Bg').attr('src', './images/forestRewardPage1Bg2.png'); } return false }) // 打开活动规则 $('.hdader .rule_icon').click(function (params) { $('.rule').show(); bodyScroolFun(true); }) //关闭活动规则 $('.rule').click(function (params) { $('.rule').hide(); bodyScroolFun(false); }) // 打开记录以及奖池 $('.page1 .darkForest .prizePoolRecord').click(function (params) { bodyScroolFun(true); $('.forestReward .forestReward_in .forestRewardPage2 ul li').remove(); page = 1; getExplorerRecord(page); $(".forestReward").show(); }) // 关闭记录以及奖池 $(".forestReward").click(function (params) { bodyScroolFun(false); $(this).hide(); }) // 返回页面 重新请求接口 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);