|
|
|
|
|
|
- <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- var currurl = decodeURIComponent(location.href.split('#')[0]);
-
-
- $.ajax({
- url : "initWXJSInterface",
- dataType : 'json',
- data : {
- 'url' : currurl
- },
- complete : function(XMLHttpRequest, textStatus) {},
- error : function(XMLHttpRequest, textStatus, errorThrown) {
- alert("发生错误:" + errorThrown);
- },
- success : function(res) {
- var appId = res.appId;
- var nonceStr = res.nonceStr;
- var jsapi_ticket = res.jsapi_ticket;
- var timestamp = res.timestamp;
- var signature = res.signature;
-
- wx.config({
- debug : false,
- appId : appId,
- timestamp : timestamp,
- nonceStr : nonceStr,
- signature : signature,
- jsApiList : [ 'onMenuShareAppMessage', 'onMenuShareTimeline' ]
- });
-
-
- wx.ready(function() {
-
-
- wx.onMenuShareAppMessage({
- title : '分享好友标题',
- desc : '分享好友描述',
- link : currurl,
- imgUrl : 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505419265109&di=cc30743d364e5ae89172c62a662e1321&imgtype=0&src=http%3A%2F%2Fpic.qqtn.com%2Fup%2F2017-6%2F14973136731543515.jpg', // 分享图标
- type : '',
- dataUrl : '',
- success : function() {
-
-
- },
- cancel : function() {
-
-
- }
- });
-
-
- wx.onMenuShareTimeline({
- title : '分享朋友圈标题',
- link : currurl,
- imgUrl : 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505419265109&di=cc30743d364e5ae89172c62a662e1321&imgtype=0&src=http%3A%2F%2Fpic.qqtn.com%2Fup%2F2017-6%2F14973136731543515.jpg', // 分享图标
- success : function() {
-
- },
- cancel : function() {
-
- }
- });
- });
-
- wx.error(function(res) {
-
- alert('error');
- });
- }
- });
-
- });
-
- </script>
发表于
2018-01-27 15:08
zlfei
阅读( 222)
评论()
收藏
举报
|
|