homepagePHP/app/Home/View/mobile/Public/wx_share.html

82 lines
3.3 KiB
HTML
Executable File
Raw Permalink 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
!isset($share_title) && $share_title = "解困式报道中国案例库";
!isset($share_desc) && $share_desc = "解困式报道中国案例库";
!isset($share_link) && $share_link = '';
!isset($share_img) && $share_img = showFileUrl(C('CONFIG_WEBSITE_LOGO'));
?>
<script>
if(!window.wx){
$.getScript('https://res.wx.qq.com/open/js/jweixin-1.0.0.js', function () {
wx.config({$signPackage});
wx.ready(function () {
wx.onMenuShareTimeline({
title: '{$share_title}',
desc: '{$share_desc}',
link: '{$share_link}',
imgUrl:'{$share_img}',
trigger: function (res) {
// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容因为客户端分享操作是一个同步操作这时候使用ajax的回包会还没有返回
},
success: function (res) {
},
cancel: function (res) {
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
wx.onMenuShareAppMessage({
title: '{$share_title}',
desc: '{$share_desc}',
link: '{$share_link}',
imgUrl:'{$share_img}',
trigger: function (res) {
// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容因为客户端分享操作是一个同步操作这时候使用ajax的回包会还没有返回
},
success: function (res) {
},
cancel: function (res) {
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
wx.onMenuShareQQ({
title: '{$share_title}', // 分享标题
desc: '{$share_desc}', // 分享描述
link: '{$share_link}', // 分享链接
imgUrl: '{$share_img}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
wx.onMenuShareQZone({
title: '{$share_title}', // 分享标题
desc: '{$share_desc}', // 分享描述
link: '{$share_link}', // 分享链接
imgUrl: '{$share_img}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
});
});
}
</script>