找传奇、传世资源到传世资源站!

微信分享实例Demo

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

2015微信分享接口DEMO
微信分享实例Demo C#网络编程-第1张
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="weixinjs._default" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>te</title> <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script> wx.config({ debug: true, appId: 'appId111111111111111111111111111111111111111111111111111111111111', timestamp: <%= Hd_timestamp.Value %>, nonceStr: '<%=Hd_nonceStr.Value %>', signature: '<%= Hd_signature.Value %>', jsApiList: [ 'checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem', 'translateVoice', 'startRecord', 'stopRecord', 'onRecordEnd', 'playVoice', 'pauseVoice', 'stopVoice', 'uploadVoice', 'downloadVoice', 'chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'getNetworkType', 'openLocation', 'getLocation', 'hideOptionMenu', 'showOptionMenu', 'closeWindow', 'scanQRCode', 'chooseWXPay', 'openProductSpecificView', 'addCard', 'chooseCard', 'openCard' ] }); wx.ready(function(){ alert('test'); // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。 wx.onMenuShareTimeline({ title: '互联网之子', link: 'http://movie.douban.com/subject/25785114/', imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg', trigger: function(res) { alert('用户点击分享到朋友圈'); }, success: function(res) { alert('已分享'); }, cancel: function(res) { alert('已取消'); }, fail: function(res) { alert("bbb" JSON.stringify(res)); } }); }); wx.error(function(res){ alert("aaa" res) // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 }); </script></head><body> <form id="form1" runat="server"> <div> <asp:HiddenField ID="Hd_nonceStr" runat="server" /> <asp:HiddenField ID="Hd_timestamp" runat="server" /> <asp:HiddenField ID="Hd_signature" runat="server" /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> 使用注意:<br /> 此版本是c#版本的demo 其余使用请参考微信 官网文档<br /> 文档地址http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html<br /> 进入页面稍等片刻,会弹出两个alert,直接点上面的分享到朋友圈即可,会获取到网址和分享的图片,分享的标题<br /> 如不能分享,1清空缓存,2请升级到最新版本的微信6.0.2.58,其他的功能拷贝文档内的js使用即可,如还是不行,联系QQ:346590246<br /> 需要修改的地方为CS代码的96行,access_token我是写的我自己的,需修改为用户自己的access_token<br /> <br /> html代码的19行 appId修改为自己的APPID<br /> 需要注意在微信设置里面确定设置1js接口的安全域名2是否有jssdk调用的权限,检查后</form></body></html>

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复