<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="//ossweb-img.qq.com/images/js/PTT/ping_tcss_tgideas_https_min.js"></script>
<script src="//ossweb-img.qq.com/images/js/TGMobileShare/TGMobileShare.min.js"></script>
<script>
$(function () {
$.ajax({
url: './jsConfig.php',
type: 'post',
data: {
url: location.href,
},
dataType: 'json',
success: function (r) {
jsApiStart(r);
}
});
});
function jsApiStart(obj) {
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: obj.appId, // 必填,公众号的唯一标识
timestamp: obj.timestamp, // 必填,生成签名的时间戳
nonceStr: obj.noncestr, // 必填,生成签名的随机串
signature: obj.signStr, // 必填,签名,见附录1
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
wx.ready(function () {
wx.onMenuShareAppMessage({
title: "你知道不用拨打110就能报警吗?",
desc: "报警新姿势get",
link: "http://h5.0rh.cn/110/",
imgUrl: 'http://7xj7xs.com1.z0.glb.clouddn.com/jc1.jpg'
});
wx.onMenuShareTimeline({
title: "你知道不用拨打110就能报警吗?",
desc: "报警新姿势get",
link: "http://h5.0rh.cn/110/",
imgUrl: 'http://7xj7xs.com1.z0.glb.clouddn.com/jc1.jpg'
});
});
}
</script>