Commit 8b89c696 authored by liyadong's avatar liyadong

update

parent 20397e79
...@@ -65,11 +65,11 @@ ...@@ -65,11 +65,11 @@
function _wechatConfig(o) { function _wechatConfig(o) {
wx.config({ wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 debug: false,
appId: o.appId, // 必填,公众号的唯一标识 appId: o.appId,
timestamp: o.timestamp, // 必填,生成签名的时间戳 timestamp: o.timestamp,
nonceStr: o.nonceStr, // 必填,生成签名的随机串 nonceStr: o.nonceStr,
signature: o.signature,// 必填,签名,见附录1 signature: o.signature,
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
}); });
} }
...@@ -101,36 +101,33 @@ ...@@ -101,36 +101,33 @@
function wx_share(title, link, imgurl, desc) { function wx_share(title, link, imgurl, desc) {
//朋友圈 //朋友圈
wx.onMenuShareTimeline({ wx.onMenuShareTimeline({
title: title, // 分享标题 title: title,
link: link, // 分享链接 link: link,
imgUrl: imgurl, // 分享图标 imgUrl: imgurl,
success: function() { success: function() {
// 用户确认分享后执行的回调函数
}, },
cancel: function() { cancel: function() {
// 用户取消分享后执行的回调函数
} }
}); });
//微信好友 //微信好友
wx.onMenuShareAppMessage({ wx.onMenuShareAppMessage({
title: title, // 分享标题 title: title,
desc: desc, // 分享描述 desc: desc,
link: link, // 分享链接 link: link,
imgUrl: imgurl, // 分享图标 imgUrl: imgurl,
type: 'link', // 分享类型,music、video或link,不填默认为link type: 'link',
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空 dataUrl: '',
success: function() { success: function() {
// 用户确认分享后执行的回调函数
}, },
cancel: function() { cancel: function() {
// 用户取消分享后执行的回调函数
} }
}); });
} }
function random(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
wx.ready(function () { wx.ready(function () {
var title = '阿拉德之怒', var title = '阿拉德之怒',
link = 'http://uc-signin2.srccwl.com', link = 'http://uc-signin2.srccwl.com',
...@@ -140,8 +137,7 @@ ...@@ -140,8 +137,7 @@
}); });
wx.error(function (res) { wx.error(function (res) {
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 console.log(res);
//alert('error');
}); });
}); });
</script> </script>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment