// 封装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(); if (env == 'test') { new VConsole(); } // 初始化函数 $(function () { getInfoFromClient() setTimeout(function () { // 返回事件 $('.back').click(() => { if (browser.app) { if (browser.android) { window.androidJsObj.closeWebView(); } else { window.webkit.messageHandlers.closeWebView.postMessage(null); } } else { toastMsg('请在APP内打开') } }) getPoolList(); }, 100) $('body,html').css('padding-top', `${(document.documentElement.clientWidth / 750 * 120) / 75}rem`); }) // 奖池列表接口 function getPoolList () { $('.tab1 li').remove(); showLoading() networkRequest({ type: 'GET', url: urlPrefix + '/act/seize-treasure/draw/pool/list',//item data: { orderType: 2 }, success (res) { if (res.code === 200) { var str = ''; res.data.forEach((res, i) => { str += `
  • ${res.rewardName}
    ${res.rewardShowValue}
    ${res.showRatio / 1000}%
  • ` }); $('.tab1').append(str); res.data.forEach((res, i) => { if (res.rewardType == "activityProps") { //活动道具 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.4666666667rem", "height": "1.4666666667rem", "top": "0.9066666667rem" }); } else if (res.rewardType == "gift") { //礼物 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.4666666667rem", "height": "1.4666666667rem", "top": "0.9066666667rem" }); } else if (res.rewardType == "namePlate") { //铭牌 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.6rem", "height": "0.5rem", "top": "1rem" }); } else if (res.rewardType == "car") { //座驾 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.8rem", "height": "1.3rem", "top": "0.9066666667rem" }); } else if (res.rewardType == "headwear") { //头饰 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.4666666667rem", "height": "1.4666666667rem", "top": "0.9066666667rem" }); } else if (res.rewardType == "chatBubble") { //气泡 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.4666666667rem", "height": "1.4666666667rem", "top": "0.9066666667rem" }); } else if (res.rewardType == "infoCard") { //资料卡 $(`.tab1 li .txBox .txBoxImg${i + 1}`).css({ "width": "1.4rem", "height": "1rem", "top": "1.1rem" }); } }) hideLoading(layerIndex) } else { toastMsg(res.message) hideLoading(layerIndex) } }, error (err) { hideLoading(layerIndex) toastMsg('网络错误,请退出重进') } }) } // =======================规则页======================= $('.tab div').click(function () { var i = $(this).index() + 1; $(this).addClass('active').siblings().removeClass('active'); if (i == 1) { $('.tab1').show(); $('.tab2').hide(); } else { $('.tab2').show(); $('.tab1').hide(); } })