Files
peko-h5/view/peko/home/js/index.js
2023-08-09 10:57:48 +08:00

120 lines
4.2 KiB
JavaScript

/* eslint-disable semi */
/* eslint-disable no-undef */
let version = checkVersion()
let urlData = getQueryString()
const urlPrefix = getUrlPrefix()
//获取url参数
let channelData = urlData.channel
//定义官方渠道包
const channelDict = {
'poke0': 'https://image.lecheng163.com/poke_poke0.apk',
'poke1': 'https://image.lecheng163.com/poke_poke1.apk',
'poke2': 'https://image.lecheng163.com/poke_poke2.apk',
'poke3': 'https://image.lecheng163.com/poke_poke3.apk',
'poke4': 'https://image.lecheng163.com/poke_poke4.apk',
'poke5': 'https://image.lecheng163.com/poke_poke5.apk',
'poke6': 'https://image.lecheng163.com/poke_poke6.apk',
'poke7': 'https://image.lecheng163.com/poke_poke7.apk',
'poke8': 'https://image.lecheng163.com/poke_poke8.apk',
'poke9': 'https://image.lecheng163.com/poke_poke9.apk',
'poke10': 'https://image.lecheng163.com/poke_poke10.apk',
'gongzhonghao': 'https://image.lecheng163.com/poke_gongzhonghao.apk',
'zhaohui': 'https://image.lecheng163.com/zhaohui.apk'
// 'baomihua01': 'https://image.lecheng163.com/accompany_release_v_213_1_baomihua01_sign.apk'
}
$(function () {
//判断url参数是否是与渠道包名一致
let androidUrl = null;
channelDict.hasOwnProperty(channelData) ? androidUrl = channelDict[channelData] : androidUrl = 'https://play.google.com/store/apps/details?id=com.vele.pekolive';
let iosUrl = 'http://doudouyue.com/8axv' //ios企业包
// let iosUrl = 'https://apps.apple.com/cn/app/id1571083482' //ios商店包
if (version.ios) {
$('.button-wrapper').on('click', function () {
if (version.weixin) {
$('.tips').show()
return
}
window.location.href = iosUrl;
})
} else if (version.android) {
$('.button-wrapper').on('click', function () {
if (version.weixin) {
$('.tips').show()
return
}
window.location.href = androidUrl;
})
} else {
$('.button-wrapper').on('click', function () {
window.location.href = androidUrl;
})
$('.button2-wrapper').on('click', function () {
window.location.href = iosUrl;
})
}
})
function swiperFun () {
var swiper = new Swiper('.swiper', {
direction: 'horizontal',
loop: true,
autoplay: 5000,
slidesPerView: "auto",
centeredSlides: true,
spaceBetween: 0,
initialSlide: 1,//默认第二个居中
});
}
$(function () {
$(document).ready(function () {
var deviceWidth = document.documentElement.clientWidth;
if (deviceWidth > 768) {
document.documentElement.style.fontSize = deviceWidth / 19.20 + 'px';
} else {
document.documentElement.style.fontSize = deviceWidth / 7.50 + 'px';
}
});
window.onresize = function () {
var deviceWidth = document.documentElement.clientWidth;
// console.log('deviceWidth', deviceWidth);
if (deviceWidth > 768) {
document.documentElement.style.fontSize = deviceWidth / 19.20 + 'px';
} else {
document.documentElement.style.fontSize = deviceWidth / 7.50 + 'px';
}
}
swiperFun();
//跳转pc端充值
$('.homePc .charge').click(function () {
window.location.href = urlPrefix + '/peko/modules/payPc/index.html?channelType=4';
})
// 跳转移动端h5充值
$('.homeM .charge').click(function () {
window.location.href = urlPrefix + '/peko/modules/pay/index.html?channelType=4';
})
// logo跳转
$('.googlePlay').click(function () {
window.location.href = 'https://play.google.com/store/apps/details?id=com.vele.pekolive'
})
$('.appleStore').click(function () {
// console.log(version, 'version');
if (version.webKit && version.ios) {
window.location.href = 'https://apps.apple.com/cn/app/id6446155565'
}
else {
window.location.href = 'http://doudouyue.com/3gh2'
}
})
$('.apk').click(function () {
window.location.href = 'https://img.pekolive.com/piko_official.apk'
})
})