欢迎光临
感谢一路有你

微信微站jdk 实现带图片分享功能+打开本地导航功能

<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
wx.config({
appId: '{$signPackage["appId"]}',
timestamp: '{$signPackage["timestamp"]}',
nonceStr: '{$signPackage["nonceStr"]}',
signature: '{$signPackage["signature"]}',
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'openLocation'
]
}); 
wx.ready(function () {
// 1 判断当前版本是否支持指定 JS 接口,支持批量判断
wx.checkJsApi({
jsApiList: [
'getNetworkType',
'previewImage',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo'
], 
});
var shareData = {
//标题
title: '***',
//摘要
desc: '',
//链接,可以换主页
link: '{$signPackage["url"]}',
//缩略图
imgUrl: 'http://{$site_url}template/default/images/bg2.jpg', 
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
wx.onMenuShareQQ(shareData);
wx.onMenuShareWeibo(shareData);
});

$('.daohang').click(function () {
wx.openLocation({
latitude: "{$content['wd']}", // 纬度,浮点数,范围为90 ~ -90
longitude: "{$content['jd']}", // 经度,浮点数,范围为180 ~ -180。
name: "{$content['title']}", // 位置名
address: "{$content['title']}", // 地址详情说明
scale: 10, // 地图缩放级别,整形值,范围从1~28。默认为最大
});
})
</script>


require_once "./module/jssdkMod.class.php"; 
$jssdk = new JSSDK("******", "ca5b81123123132136e3257e5cdde");
$signPackage = $jssdk->GetSignPackage();
赞(0) 打赏
未经允许不得转载:王明昌博客 » 微信微站jdk 实现带图片分享功能+打开本地导航功能
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

隐藏
变装