Files
peko-h5/view/peko/activity/channel/js/index.js
2023-09-01 15:20:36 +08:00

96 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-disable semi */
/* eslint-disable no-undef */
$(function () {
var env = EnvCheck();
var linkData = {
type: env,
channel: 'homepage',
tages: 'homepage'
};
// linkedme.init('414571f0698afaa1c194f345f0dcc328', {type: env}, null);
// var androidUrl = 'https://image.zhongjialx.com/accompany_release_v1.0.3-05261920_103_2_official_sign.apk';
// var iosUrl = 'http://d.firim.info/66xingqiu';
var env = EnvCheck();
var version = checkVersion()
// console.log(version);
// $.get('http://beta.api.pekolive.com/version/download/link', function (res) {
$.get('https://api.pekolive.com/version/download/link', function (res) {
console.log(res)
if (res.code === 200) {
// let androidUrl = res.data.androidLink
let androidUrl = 'https://image.zhongjialx.com/accompany_release_v1.0.3-05261920_103_1_custom1_sign.apk'
let iosUrl = res.data.iosLink
if (version.ios) {
// $('.button-wrapper a').attr('href', iosUrl);
$('.button-wrapper').on('click', function () {
// $('.toast').stop().fadeIn(100).fadeOut(4000)
// return
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;
})
}
}
})
// linkedme.link(linkData, function(err, response) {
// if (err) {
// // 生成深度链接失败返回错误对象err
// console.log('err:', err);
// } else {
// // if (!device()) {
// // jumpAndroid.attr("href","javascript:void(0)");
// // jumpIos.attr("href","javascript:void(0)");
// // response.url = 'http://www.pgyer.com/doudouyy';
// $('.download a').attr('href',response.url);
// $('#qrcode').qrcode({
// render: 'canvas',
// text: response.url,
// width: '120', //二维码的宽度
// height: '120', //二维码的高度
// background: '#fff', //二维码的后景色
// foreground: '#000', //二维码的前景色
// src: 'http://www.if66.cn/home/images/logo.png'//二维码中间的图片
// });
// $('.jumpUrl').attr('href', response.url);
// }
// }, false);
function EnvCheck() {
if (window.location.href) {
var _url = window.location.href;
var res = _url.match(/beta/);
if (res) {
return 'test';
} else {
return 'live';
}
}
}
});