Files
peko-h5/view/peko/activity/activemodel/js/index.js
2022-09-29 16:09:58 +08:00

138 lines
3.9 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.

/* jslint esversion: 6 */
var info = {};
var betaUrl;
var realUrl;
var share;
var browser = checkVersion();
var api = locateJudge();
var queryData = getQueryString();
var code = queryData.code;
$(function() {
$.ajax({
// url: 'http://beta.doudouyue.com./page/static/activity/' + code,
url: api + '/page/static/activity/' + code,
type: 'GET',
success: function(res) {
console.log(res);
var data = res.data;
document.title = data.title;
betaUrl = 'https://beta.api.pekolive.com/peko/activity/activemodel/index.html?code=' + code;
realUrl = tranUrl + '/peko/activity/activemodel/index.html?code=' + code;
share = {
title: data.title,
link: tranUrl + '/peko/activity/activemodel/index.html?code=' + code,
// imgUrl: 'https://img.letusmix.com/new_logo.png',
// imgUrl: 'https://api.pekolive.com/peko/modules/wxPubPay/images/logo.png',
imgUrl: '../../../common/images/logo.png',
desc: data.secondTitle, // 分享描述
};
$('#img')[0].src = data.imgUrl;
festivalMask("anniversary", "anniversary");
initNav(showTitleRightNoticeFuck());
_hmt.push(['_trackEvent', 'client', 'click', code]);
}
})
});
//分享功能
$('.footer').on('click', function() {
console.log('wwwww');
var browser = checkVersion();
if (browser.app) {
if (browser.android) {
window.androidJsObj.openSharePage();
} else if (browser.ios) {
window.webkit.messageHandlers.openSharePage.postMessage(null);
}
}
});
function festivalMask(channel, tags, params) {
//此函数用于一般的耳伴底层面罩
var browser = checkVersion();
var env = EnvCheck();
// params = params? params:0;
var bol = $.isEmptyObject(params);
var jsonStr = '';
if (!bol) {
jsonStr = JSON.stringify(params);
}
if (!browser.app) {
$('#mask').css('display', 'flex');
var linkData = {
type: env,
channel: channel,
tags: tags,
// ios_custom_url: "https://itunes.apple.com/cn/app/id1252542069?mt=8",
params: jsonStr
// '{"uid":"' + params + '"}'
};
linkedme.init("c7e97cea0afe60557d67e7faaa5d5932", { type: env }, null);
linkedme.link(linkData, function(err, response) {
if (err) {
// 生成深度链接失败返回错误对象err
console.log('err:', err);
} else {
console.log(response);
$('#download a').attr('href', response.url);
}
}, false);
} else {
$('.footer').css('display', 'flex');
}
}
function showTitleRightNoticeFuck() {
var _url = (EnvCheck() == 'test') ? betaUrl : realUrl;
share.link = _url;
var obj = {
type: 2,
data: {
msg: 'wewawa',
link: share.link, //分享进去微信语音页面
title: share.title,
imgUrl: share.imgUrl,
desc: share.desc,
showUrl: share.link
}
};
return obj;
}
wx.ready(function() {
//分享到朋友圈
wx.onMenuShareTimeline({
title: share.title,
link: share.link,
imgUrl: share.imgUrl,
});
//分享给朋友
wx.onMenuShareAppMessage({
title: share.title,
desc: share.desc,
link: share.link,
imgUrl: share.imgUrl,
type: 'link',
dataUrl: '',
});
//分享到QQ
wx.onMenuShareQQ({
title: share.title,
desc: share.desc,
link: share.link,
imgUrl: share.imgUrl,
});
});
//分享
// wxConfig();
function getMessage(key, value) {
// value = parseInt(value);
info[key] = value;
}