let urlPrefix = getUrlPrefix() let browser = checkVersion() let queryObj = getQueryString(); var langReplace; var localLang; if (EnvCheck() === 'test') new VConsole // 页面全屏 if (browser.app) { if (browser.android) { // window.androidJsObj.initShowNav(false) } else { // window.webkit.messageHandlers.initShowNav.postMessage(0) } } // 封装layer消息提醒框 let layerIndex const showLoading = () => { layer.open({ type: 2, shadeClose: false, content: langReplace(localLang.demoModule.hour_text5), success(e) { layerIndex = $(e).attr('index') } }) } const hideLoading = (index) => { layer.close(index) } const toastMsg = (content = langReplace(localLang.demoModule.hour_text6), time = 2) => { layer.open({ content, time, skin: 'msg' }) } let currHourRank = [] let lastHourRank = [] let currRoomInfo = {} let timestamp let page = 1 let pageSize = 10 let rankList = [] let canNext = true let isLock = true // 获取小时榜数据 const getHourList = () => { networkRequest({ type: 'GET', url: urlPrefix + '/room/permitRoom/hourRank', data: { roomUid: queryObj.roomUid }, success(res) { if (res.code === 200) { currHourRank = res.data.currHourRank lastHourRank = res.data.lastHourRank currRoomInfo = res.data.currRoomInfo timestamp = res.timestamp countDown() renderLastHourThree() renderCurrentList() renderCurrentRoomInfo() } else { toastMsg(res.message) } }, error(err) { toastMsg(langReplace(localLang.demoModule.hour_text7)) } }) } // 渲染小时榜上一小时前三 const renderLastHourThree = () => { lastHourRank = lastHourRank.slice(0, 3) if (lastHourRank.length < 3) { let len = 3 - lastHourRank.length let arr = new Array(len).fill({ nick: '', score: '' }) lastHourRank.push(...arr) } let str = '' lastHourRank.map((item, index) => { str += `
${score}
` ) } `) } $(function () { getInfoFromClient() fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言 setTimeout(() => { langReplace = window.lang.replace; localLang = window.lang; translateFun(); getHourList(); setTimeout(function () { $('#body').show(); }, 300) }, 50) function translateFun() { var langReplace = window.lang.replace; var localLang = window.lang; $('#img1').css('background',`url("${langReplace(localLang.demoModule.img1)}") no-repeat 0 0/100% 100%`); $('#hour_title').html(langReplace(localLang.demoModule.hour_title)); $('#hore_text1').html(langReplace(localLang.demoModule.hore_text1)); $('#hour_text2').html(langReplace(localLang.demoModule.hour_text2)); $('#hour_text3').html(langReplace(localLang.demoModule.hour_text3)); $('#hour_text4').html(langReplace(localLang.demoModule.hour_text4)); } $('.rule_icon').click(() => { window.location.href = './ruleLicense.html' }) //跳转个人主页 // function openPerson(document, dom) { // $(document).on('click', dom, function () { // let erbanUid = $(this).data('uid') // if (!browser.app) return // if (browser.ios) { // window.webkit.messageHandlers.openPersonPage.postMessage(erbanUid); // } else if (browser.android) { // if (androidJsObj && typeof androidJsObj === 'object') { // window.androidJsObj.openPersonPage(erbanUid); // } // } // }) // } // 跳转房间函数 function openRoomFun(document, dom) { $(document).on('click', dom, function () { let erbanUid = $(this).data('uid') // if (!browser.app) return if (browser.ios) { window.webkit.messageHandlers.openRoom.postMessage(erbanUid); } else if (browser.android) { if (androidJsObj && typeof androidJsObj === 'object') { window.androidJsObj.openRoom(erbanUid); } } }) } openRoomFun('.top_three_wrap', '.avatar') openRoomFun('ul', '.others_avatar') openRoomFun('.mine', '.mine_avatar') // openPerson('.top_three_wrap', '.avatar') // openPerson('ul', '.others_avatar') // openPerson('.mine', '.mine_avatar') })