基本信息
源码名称:微信分享实例Demo
源码大小:0.18M
文件格式:.rar
开发语言:C#
更新时间:2015-10-16
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
2015微信分享接口DEMO


<%@ 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>