Commit 46eeda46 authored by zhoujun's avatar zhoujun

Merge branch 'test'

parents 1b75f51d 8b89c696
...@@ -57,53 +57,89 @@ ...@@ -57,53 +57,89 @@
$('.btn-start').click(function (){ $('.btn-start').click(function (){
card.handleGetServer(); card.handleGetServer();
}); });
var isWeixin = function () {
//判断是否是微信
var ua = navigator.userAgent.toLowerCase();
return ua.match(/MicroMessenger/i) == "micromessenger";
};
function _wechatConfig(o) {
wx.config({
debug: false,
appId: o.appId,
timestamp: o.timestamp,
nonceStr: o.nonceStr,
signature: o.signature,
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
}
function _getWechatJsSdkInfo(callback) {
$.ajax({ $.ajax({
url : "/wx/config", type:"GET",
data : { url:"/wx/config",
url:location.href.split('#')[0] data:{
url:location.href
}, },
type:'GET', async:false,
dataType : "json", success:function(data){
async: false, callback(data);
timeout : 5000,
error : function(XMLHttpRequest, textStatus, errorThrown) {
if (textStatus == "timeout") { // 请求超时
} else {
} }
},
success : function(res) {
var data = res.data;
wx.config({
debug : true,
appId : data.appId,
timestamp : data.timestamp,
nonceStr : data.nonceStr,
signature : data.signature,
url:location.href.split('#')[0],
jsApiList : [ 'onMenuShareAppMessage', 'onMenuShareTimeline' ]
}); });
}
wx.ready(function () { if (isWeixin()) {
wx.onMenuShareAppMessage({ _getWechatJsSdkInfo(_wechatConfig);
title: '阿拉德之怒', // 分享标题 }
desc: '阿拉德之怒', // 分享描述
link: 'http://uc-signin2.srccwl.com', // 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致 wx.checkJsApi({
imgUrl: 'https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png', jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'],
success: function (res) {
}
}); });
function wx_share(title, link, imgurl, desc) {
//朋友圈
wx.onMenuShareTimeline({
title: title,
link: link,
imgUrl: imgurl,
success: function() {
},
cancel: function() {
}
}); });
//微信好友
wx.onMenuShareAppMessage({
title: title,
desc: desc,
link: link,
imgUrl: imgurl,
type: 'link',
dataUrl: '',
success: function() {
},
cancel: function() {
} }
}); });
$('.btn-share').click(function(){ }
wx.ready(function () { wx.ready(function () {
wx.onMenuShareAppMessage({ var title = '阿拉德之怒',
title: '阿拉德之怒', // 分享标题 link = 'http://uc-signin2.srccwl.com',
desc: '阿拉德之怒', // 分享描述 img = "https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png",
link: 'http://uc-signin2.srccwl.com', // 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致 desc = "Warning!阿拉德之怒";
imgUrl: 'https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png', wx_share(title,link,img,desc);
});
wx.error(function (res) {
console.log(res);
}); });
}); });
})
})
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
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