wpfw_ewei_shopv2/template/mobile/default/_share.html
2023-02-14 19:57:32 +08:00

110 lines
4.4 KiB
HTML
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.

{php $this->shopShare()}
{php echo regSdk(false);}
<script language="javascript">
// 以下代码用来解决文章详情的分享问题强制加external
$(function () {
var a_collections = $('a');
$.each(a_collections,function (index,val) {
var that = $(val);
var href = that.attr('href') ||'';
var bool = href.indexOf('r=article');
if (bool>0){
that.addClass('external');
}
});
});
window.shareData = {php echo json_encode($_W['shopshare'])};
setTimeout(function(){
//var verify_url = window.location.href.toString();
// 以下代码处理 ios 和 安卓的分享问题
var location_href = window.location.href.toString();
var verify_url = sessionStorage.getItem('verify_url');
if (isIOS()){
if( verify_url==null){
verify_url =location_href;
sessionStorage.setItem('verify_url',verify_url);
// alert("set url");
}
}else{
verify_url =location_href;
}
if(location_href.indexOf("r=member.address")!=-1){
verify_url=location_href;
if (sessionStorage.getItem('refreshed') !== 'true') {
sessionStorage.setItem('refreshed', 'true');
window.location.reload();
}
}
$.ajax({
type: "GET",
url:'{php echo mobileUrl('index.share_url',array(),true);}',
data:{url:verify_url.replace(location.hash,'')},
dataType: "json",
success: function(data){
// jssdkconfig = data.result || { jsApiList:[] };
// jssdkconfig.debug = false;
// jssdkconfig.jsApiList = ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','showOptionMenu', 'hideMenuItems', 'onMenuShareQZone', 'editAddress','scanQRCode','openLocation','openAddress','addCard','chooseCard','openCard'];
// wx.config(jssdkconfig);
wx.ready(function () {
wx.showOptionMenu();
{if !empty($_W['shopshare']['hideMenus'])}
wx.hideMenuItems({
menuList: {php echo json_encode($_W['shopshare']['hideMenus'])}
});
{/if}
window.shareData.success = "{$_W['shopshare']['way']}";
if(window.shareData.success){
var success = window.shareData.success;
window.shareData.success = function(){
eval(success)
};
}
wx.onMenuShareAppMessage(window.shareData);
wx.onMenuShareTimeline(window.shareData);
var qqShareData = {
title: shareData.title || " ", // 分享标题
desc: shareData.desc || " ", // 分享描述
link: shareData.link || " ", // 分享链接
imgUrl: shareData.imgUrl || " ", // 分享图标
success: shareData.success || "",
cancel: shareData.cancel || " ",
};
wx.onMenuShareQQ(qqShareData);
wx.onMenuShareWeibo(window.shareData);
wx.onMenuShareQZone(window.shareData);
});
},
error:function(e){
console.log(JSON.stringify(e));
}
});
},700);
{if !empty($_W['shopset']['wap']['open']) && !is_weixin()}
// Share to qq
require(['//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js'], function(setShareInfo) {
setShareInfo({
title: "{$_W['shopshare']['title']}",
summary: "{php echo str_replace(array("\r","\n"),'',$_W['shopshare']['desc'])}",
pic: "{$_W['shopshare']['imgUrl']}",
url: "{$_W['shopshare']['link']}"
});
});
{/if}
//判断设备系统
function isIOS() {
var ua = navigator.userAgent;
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
if (ipad || iphone || ipod) {
return true;
}
return false;
}
</script>