Files
peko-h5/view/peko/homeCheck/js/index.js

133 lines
4.3 KiB
JavaScript
Raw Normal View History

2023-04-27 16:55:41 +08:00
/* eslint-disable semi */
/* eslint-disable no-undef */
let version = checkVersion()
let urlData = getQueryString()
const urlPrefix = getUrlPrefix()
//获取url参数
let channelData = urlData.channel
//定义官方渠道包
const channelDict = {
'peko0': 'https://image.lecheng163.com/peko_peko0.apk',
'peko1': 'https://image.lecheng163.com/peko_peko1.apk',
'peko2': 'https://image.lecheng163.com/peko_peko2.apk',
'peko3': 'https://image.lecheng163.com/peko_peko3.apk',
'peko4': 'https://image.lecheng163.com/peko_peko4.apk',
'peko5': 'https://image.lecheng163.com/peko_peko5.apk',
'peko6': 'https://image.lecheng163.com/peko_peko6.apk',
'peko7': 'https://image.lecheng163.com/peko_peko7.apk',
'peko8': 'https://image.lecheng163.com/peko_peko8.apk',
'peko9': 'https://image.lecheng163.com/peko_peko9.apk',
'peko10': 'https://image.lecheng163.com/peko_peko10.apk',
'gongzhonghao': 'https://image.lecheng163.com/peko_gongzhonghao.apk',
'zhaohui': 'https://image.lecheng163.com/zhaohui.apk'
// 'baomihua01': 'https://image.lecheng163.com/accompany_release_v_213_1_baomihua01_sign.apk'
}
function swiperFun() {
var swiper = new Swiper('.swiper', {
direction: 'vertical',
pagination: '.swiper-pagination',
paginationClickable: true,
loop: true,
autoplay: 4000,
// nextButton: ".swiper-button-next",
// prevButton: ".swiper-button-prev",
});
}
function swiperFun2() {
var swiper2 = new Swiper('.swiper2', {
direction: 'horizontal',
pagination: '.swiper-pagination',
paginationClickable: true,
loop: true,
autoplay: 4000,
// nextButton: ".swiper-button-next",
// prevButton: ".swiper-button-prev",
});
}
$(function () {
//判断url参数是否是与渠道包名一致
let androidUrl = null;
channelDict.hasOwnProperty(channelData) ? androidUrl = channelDict[channelData] : androidUrl = 'https://play.google.com/store/apps/details?id=com.vele.peko';
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 () {
$(document).ready(function () {
var deviceWidth = document.documentElement.clientWidth;
2023-04-27 18:29:13 +08:00
// if (deviceWidth > 768) {
2023-04-27 16:55:41 +08:00
document.documentElement.style.fontSize = deviceWidth / 19.20 + 'px';
swiperFun();
2023-04-27 18:29:13 +08:00
// } else {
// document.documentElement.style.fontSize = deviceWidth / 7.50 + 'px';
// swiperFun2()
// }
2023-04-27 16:55:41 +08:00
});
window.onresize = function () {
var deviceWidth = document.documentElement.clientWidth;
// console.log('deviceWidth', deviceWidth);
2023-04-27 18:29:13 +08:00
// if (deviceWidth > 768) {
2023-04-27 16:55:41 +08:00
document.documentElement.style.fontSize = deviceWidth / 19.20 + 'px';
swiperFun();
2023-04-27 18:29:13 +08:00
// } else {
// document.documentElement.style.fontSize = deviceWidth / 7.50 + 'px';
// swiperFun2()
// }
2023-04-27 16:55:41 +08:00
}
//跳转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';
})
// goglo跳转
$('.googlePlay').click(function () {
window.location.href = 'https://play.google.com/store/apps/details?id=com.vele.peko'
})
$('.appleStore').click(function () {
// console.log(version, 'version');
if (version.webKit && version.ios) {
window.location.href = 'itms-services:///?action=download-manifest&url=https://img.pekolive.com/distribute.plist'
} else {
window.location.href = 'http://doudouyue.com/h958'
}
})
$('.apk').click(function () {
window.location.href = 'https://img.pekolive.com/peko_official.apk'
})
})