<!----如果是微信登录,引导微信自有分享------>
|
<script src="{yun:}$wap_style{/yun}/js/nativeshare/nativeshare.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
|
<link rel="stylesheet" href="{yun:}$wap_style{/yun}/js/nativeshare/nativeshare.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
|
|
{yun:}if $isweixin{/yun}
|
|
{yun:}if strpos($config.sy_wapdomain, 'https://')!==false{/yun}
|
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js?v={yun:}$config.cachecode{/yun}"></script>
|
{yun:}else{/yun}
|
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js?v={yun:}$config.cachecode{/yun}"></script>
|
{yun:}/if{/yun}
|
|
<script>
|
|
$(function () {
|
|
$('#shareClick').click(function () {
|
|
var url = $(this).attr('data-url');
|
|
if (new RegExp('http://').test(url)) {
|
window.location.href = url;
|
} else {
|
|
var regurl = '{yun:}$reg_url{/yun}';
|
|
if (regurl != '') {
|
wx.ready(function () {
|
var shareData = {
|
title: '邀请注册-{yun:}$config.sy_webname{/yun}',
|
desc: '{yun:}$description{/yun}',
|
link: regurl,
|
imgUrl: '{yun:}$config.sy_ossurl{/yun}/{yun:}$config.sy_wx_sharelogo{/yun}',
|
success: function () {
|
// 用户确认分享后执行的回调函数
|
},
|
cancel: function () {
|
// 用户取消分享后执行的回调函数
|
}
|
};
|
wx.updateAppMessageShareData(shareData);
|
wx.updateTimelineShareData(shareData);
|
});
|
wx.error(function (res) {
|
console.log(res.errMsg);
|
});
|
}
|
$("#weixinBrowser").show();
|
}
|
});
|
$('#weixinBrowser').click(function () {
|
|
$(this).hide();
|
});
|
});
|
</script>
|
|
{yun:}if $signPackage{/yun}
|
<script>
|
var shareurl = '{yun:}$shareurl{/yun}';
|
wx.config({
|
appId: '{yun:}$signPackage.appId{/yun}',
|
timestamp: '{yun:}$signPackage.timestamp{/yun}',
|
nonceStr: '{yun:}$signPackage.nonceStr{/yun}',
|
signature: '{yun:}$signPackage.signature{/yun}',
|
jsApiList: [
|
'updateAppMessageShareData',
|
'updateTimelineShareData',
|
'onMenuShareTimeline',
|
'onMenuShareAppMessage',
|
'onMenuShareQQ',
|
'onMenuShareWeibo',
|
'onMenuShareQZone'
|
]
|
});
|
if (shareurl != '') {
|
var link = shareurl;
|
} else {
|
var link = '{yun:}$signPackage.url{/yun}';
|
}
|
wx.ready(function () {
|
var shareData = {
|
title: '{yun:}$title{/yun}',
|
desc: '{yun:}$description{/yun}',
|
link: link,
|
imgUrl: '{yun:}if $job.logo{/yun}{yun:}$job.logo{/yun}{yun:}else if $Info.photo{/yun}{yun:}$Info.photo{/yun}{yun:}else if $Info.newsphoto_n{/yun}{yun:}$Info.newsphoto_n{/yun}{yun:}else if $row.logo{/yun}{yun:}$row.logo{/yun}{yun:}else{/yun}{yun:}$config.sy_ossurl{/yun}/{yun:}$config.sy_wx_sharelogo{/yun}{yun:}/if{/yun}',
|
success: function () {
|
|
}
|
};
|
wx.updateAppMessageShareData(shareData);
|
wx.updateTimelineShareData(shareData);
|
});
|
wx.error(function (res) {
|
console.log(res.errMsg);
|
});
|
</script>
|
{yun:}/if{/yun}
|
|
{yun:}else{/yun}
|
|
<!----如果是UC QQ浏览器,弹出分享界面------>
|
<script src='{yun:}$wap_style{/yun}/js/appshare.js?v={yun:}$config.cachecode{/yun}' type='text/javascript'></script>
|
|
<div id="nativeShare"></div>
|
|
<script language="javascript">
|
if (navigator.userAgent.indexOf('Html5Plus') > -1) {
|
|
var shares = null;
|
|
// 监听plusready事件
|
document.addEventListener("plusready", function () {
|
document.getElementById("shareClick").addEventListener("click", function () {
|
var message = {
|
title: '{yun:}$title{/yun}',
|
content: '{yun:}$title{/yun}',
|
href: '{yun:}$shareurl{/yun}',
|
thumbs: ["{yun:}if $job.com_logo{/yun}{yun:}$config.sy_ossurl{/yun}/{yun:}$job.com_logo{/yun}{yun:}else if $Info.photo{/yun}{yun:}$Info.photo{/yun}{yun:}else if $row.logo{/yun}{yun:}$row.logo{/yun}{yun:}else{/yun}{yun:}$config.sy_ossurl{/yun}/{yun:}$config.sy_wx_sharelogo{/yun}{yun:}/if{/yun}"] //分享缩略图
|
}
|
plusShare(message, function (res) {
|
if (res) {
|
plus.nativeUI.toast("分享成功");
|
} else {
|
plus.nativeUI.toast("分享失败");
|
}
|
})
|
});
|
});
|
} else {
|
$(function () {
|
$('#shareClick').on('click', function () {
|
new nativeShare('nativeShare', config);
|
});
|
$('#otherBrowser').click(function () {
|
$(this).hide();
|
});
|
$('#nativeShare').click(function (evt) {
|
if ($(evt.target).parents(".share_bgbox").length == 0) {
|
$(this).hide();
|
}
|
});
|
});
|
}
|
</script>
|
<!----如果是其他浏览器分享,则弹出分享指引------>
|
{yun:}/if{/yun}
|
|
<!--微信分享公共代码--->
|
|
<!--分享-->
|
<div id="otherBrowser" style="width:100%;height:100%; background:rgba(51,51,51,0.9); position:fixed;left:0px;top:0px ; z-index:100000001;display:none">
|
<div class="yun_wap_share_tip" style="width:100%; position:absolute; z-index:100000001;top:50%; margin-top:-90px;">
|
<div class="yun_wap_share_tip_p"><i class="yun_wap_share_n">1.</i>点击浏览器顶部或底部的<i class="yun_wap_share_tip_i3"></i>或<i class="yun_wap_share_tip_i4"></i></div>
|
<div class="yun_wap_share_tip_p"><i class="yun_wap_share_n">2.</i>然后点击分享按钮<i class="yun_wap_share_tip_i"></i>或<i class="yun_wap_share_tip_i2"></i></div>
|
<div class="yun_wap_share_tip_p"><i class="yun_wap_share_n">3.</i>分享给朋友或者朋友圈</div>
|
</div>
|
</div>
|
<!--分享-->
|
<div id="weixinBrowser"
|
style="width:100%;height:100%; background:rgba(51,51,51,0.9); position:fixed;left:0px;top:0px ; z-index:100000001;display:block;display:none">
|
<div class="yun_wap_share_tip" style="width:100%; position:absolute; z-index:100000001;">
|
<i class="yun_wap_share_tip_wxicon_more"></i>
|
<i class="yun_wap_share_tip_wxicon"></i>
|
</div>
|
</div>
|