微信分享

  1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProxyHomePage.aspx.cs" Inherits="PaperYY.WebFile.H5.TGDynamic.ProxyHomePage" %>
  2 
  3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4 
  5 <html xmlns="http://www.w3.org/1999/xhtml">
  6 <head runat="server">
  7     <meta charset="UTF-8">
  8     <meta name="viewport"
  9           content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 10     <meta http-equiv="X-UA-Compatible" content="ie=edge">
 11     <title>推广赚钱</title>
 12     <!-- 微信内分享配置权限必须引入此js -->
 13     <script type="text/javascript" src="http://res2.wx.qq.com/open/js/jweixin-1.4.0.js "></script>
 14 
 15     <script src="js/clipboard.min.js"></script>
 16 
 17     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
 18     <meta name="apple-mobile-web-app-capable" content="yes" />
 19     <meta name="apple-mobile-web-app-status-bar-style" content="black" />
 20     <meta name="format-detection" content="telephone=no, email=no" />
 21 
 22 
 23 
 24 
 25     <link rel="stylesheet" href="css/css.css">
 26     <script src="js/setfontsize.js"></script>
 27     <script src="js/jquery.1.7.2.js"></script>
 28     <script src="js/base.js"></script>
 29     <style type="text/css">
 30         #mcover {
 31         position: fixed;
 32         top: 0;
 33         left: 0;
 34         width: 100%;
 35         height: 100%;
 36         background: rgba(0, 0, 0, 0.7);
 37         display: none;
 38         z-index: 20000;
 39     }
 40     #mcover img {
 41         position: fixed;
 42         right: 18px;
 43         top: 5px;
 44         width: 130px;
 45         height: 90px;
 46         z-index: 999;
 47     }
 48     </style>
 49 </head>
 50 <body>
 51     <form id="form1" runat="server">
 52         <header class="flex-l">
 53             <div class="l">
 54                 <i class="icon hd-prev"></i>
 55             </div>
 56             <div class="c">推广赚钱</div>
 57             <div class="r">
 58             <a href="/h5/Member_New/Account/default.aspx"><img class="pic" src="<%=CurrentUser.Avatar %>"  alt=""></a>
 59                
 60             </div>
 61         </header>
 62         <section class="main">
 63         <section class="bg-f line-b flex-c flexcBox1">
 64             <div class="item">
 65                 <h4 class="f-40" ><%=totalNum %></h4>
 66                 <p class="c-6 f-26">下级会员数量</p>
 67             </div>
 68             <div class="item">
 69                 <h4 class="f-40" ><%=totalMoney %></h4>
 70                 <p class="c-6 f-26" >总佣金(元)</p>
 71             </div>
 72         </section>
 73         <section class="bg-f line mt-16 extension-list">
 74             <div class="layer-inner zf-type">
 75                 <div class="item flex-l"  id="tgzq" >
 76                <i class="icon icon-1" ></i><span>推广赚钱</span>
 77                     <a href="javascript:void(0)" class="share btn-s bor right" open-type="share">分 享</a>
 78                 </div>
 79                 <div class="item flex-l arr-r-div" id="ljtx">
 80                     <i class="icon icon-2"></i><span>立即提现</span>
 81                     <p class="right f-32 c-b" >可提现<span id="ktx"></span></p>
 82                 </div>
 83             </div>
 84         </section>
 85         <section class="bg-f line mt-16 extension-list">
 86             <div class="layer-inner zf-type">
 87                 <div class="item flex-l arr-r-div" id="cjwt">
 88                     <i class="icon icon-3"></i><span>常见问题</span>
 89                 </div>
 90                 <div class="item flex-l arr-r-div" id="lxwm" >
 91                     <i class="icon icon-4"></i><span>联系我们</span>
 92                 </div>
 93             </div>
 94             <div id="mcover" onclick="document.getElementById('mcover').style.display='';" style="display: none;">
 95             <img src="img/fenxiang.png" alt="" />
 96             </div>      
 97         </section>
 98     </section>
 99 
100         <!-- popup s -->
101 
102      <section class="popup">
103         <div class="bg"></div>
104 
105         <div class="container pop-share">
106             <form action="">
107                 <div class="share-icons">
108                     <div class="inner flex-l" style="670px">
109                     
110                        
111                     
112             </form>
113         </div>
114     </section>
115 
116   
117     <!-- popup e -->
118 
119     </form>
120     <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script> 
121     <script type="text/javascript">
122     
123             $(function(){
124             //推广赚钱
125                 $("#tgzq").click(function () {
126                     var ua = navigator.userAgent.toLowerCase();
127                     var isWeixin = ua.indexOf('micromessenger') != -1;
128                    
129                     if (!isWeixin) {
130                         //非微信浏览器
131                         $('.popup').fadeIn();
132                         return false;
133                     }
134                     
135           //查看该用户是否已经是推广员,不是推广员进入注册,是推广员分享链接
136             $.ajax({
137                 async: false,
138                 type: "post",
139                 dataType: "json",
140                 data: "userid=<%=Id%>&",
141                 url: "ajax.aspx?oper=ajaxIsPromoters",
142                 success: function (d) {
143                     if (d.result == 1) {
144                         $("#mcover").show();    
145                     }
146                     else {
147                         //不是推广员
148                         //注册超过5天充值大于10元直接跳转申请页面
149                         $.ajax({
150                             async: false,
151                             type: "post",
152                             dataType: "json",
153                             data: "userid=" + <%=Id%>,
154                             url: "ajax.aspx?oper=ajaxIsPromote",
155                             success: function (d) {
156                                 if (d.result == 1) {
157                                     //满足条件
158                                     window.location.href = 'ApplicationForm.aspx';
159                                 }
160                                 else {
161                                     window.location.href = "ApplicationFailure.aspx";
162                                 }
163                             }
164                         });
165                     }
166                 }
167             });
168                 })
169 
170 
171     });
172                             //立即提现
173                             $("#ljtx").click(function () {
174                                 window.location.href = "ImmediateCash.aspx";
175                             })
176                             //常见问题
177                             $("#cjwt").click(function () {
178                                 window.location.href = "TGCJWT.aspx";
179                             })
180                             //联系我们
181                             $("#lxwm").click(function () {
182                                 window.location.href = "ContactUs.aspx";
183                             })
184                             $('#cancel').on('touchend', function (e) {
185                                 e.preventDefault();
186                                 $('.popup').fadeOut();
187                             });
188                     
189         </script>
190         <script type="text/javascript">
191            
192            var URL="https://mtest.paperyy.com";
193             //var URL="http://m.paperyy.com";
194            window.onload = function () {
195                $("#txt_link").val("<%=site.Url %>/h5/TGDynamic/ProxyHomePage.aspx?id=<%=Id%>&fenxiang=0");
196                // alert(location.href.split('#')[0]);
197                 //注入权限
198                 wx.config({
199                     debug: false,
200                     appId: '<%=AppId %>',
201                     timestamp: '<%=TimesTamp %>',
202                     nonceStr: '<%=nonceStr %>',
203                     signature: '<%=Signature%>',
204                     jsApiList: [
205                      'onMenuShareAppMessage',
206                      'onMenuShareTimeline',
207                      'onMenuShareQQ',
208                      'onMenuShareQZone',
209                      'hideMenuItems'
210                       ]
211                 });
212                  wx.hideMenuItems({
213                     menuList: ["menuItem:share:timeline", "menuItem:share:qq", "menuItem:share:weiboApp", "menuItem:favorite", "menuItem:share:QZone", "menuItem:copyUrl", "menuItem:share:email", "menuItem:openWithQQBrowser", "menuItem:openWithSafari"] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
214                  });
215                 //判断当前客户端版本是否支持指定JS接口
216                  wx.checkJsApi({
217                      jsApiList: [ 
218                      'onMenuShareAppMessage',
219                      'onMenuShareTimeline',
220                      'onMenuShareQQ',
221                      'onMenuShareQZone',
222                      'hideMenuItems'
223                      ], // 需要检测的JS接口列表,所有JS接口列表见附录2,
224                      success: function(res) {
225                         // alert("检测的JS接口:"+JSON.stringify(+res));  
226                          // 以键值对的形式返回,可用的api值true,不可用为false
227                          // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
228                      }
229                  });
230                  wx.ready(function () {
231                      //alert("注入成功");
232                     //分享给朋友
233                     wx.onMenuShareAppMessage({
234                         title: '标题?',
235                         desc: '',
236                         link:encodeURI(URL+'/h5/TGDynamic/ProxyHomePage.aspx?id=<%=Id%>&fenxiang=0'),
237                         imgUrl: URL+'/Skins/paperyy.jpg',
238                         trigger: function (res) {
239                         },
240                         success: function (res) {
241                         },
242                         cancel: function (res) {
243                             layer.alert('已取消');
244                         },
245                         fail: function (res) {
246                             layer.alert(JSON.stringify(res));
247                             //alert(JSON.stringify(res));
248                         }
249                     });
250                     //分享到朋友圈
251                         wx.onMenuShareTimeline({
252                         title: '标题!',
253                         link:encodeURI(URL+'/h5/TGDynamic/ProxyHomePage.aspx'),
254                         imgUrl: URL+'/Skins/paperyy.jpg',
255                         trigger: function (res) {
256                         },
257                         success: function (res) {
258                             layer.alert('微信已分享');
259                         },
260                         cancel: function (res) {
261                             layer.alert('已取消');
262                         },
263                         fail: function (res) {
264                             alert(JSON.stringify(res));
265                         }
266                     });
267                     //分享到QQ测试
268                     wx.onMenuShareQQ({
269                         title: '标题?',
270                         desc: '',
271                         link:encodeURI(URL+'/h5/TGDynamic/ProxyHomePage.aspx'),
272                         imgUrl: URL+'/Skins/paperyy.jpg',
273                         type: 'link',
274                         dataUrl:'',
275                         success: function () {
276                             layer.alert('QQ分享成功');
277                         },
278                         cancel: function () {
279                             layer.alert('QQ分享失败');
280                         }
281                     });
282                    // 分享到QQ空间接口测试
283                     wx.onMenuShareQZone({
284                         title: '标题?',
285                         desc: '',
286                         link:encodeURI(URL+'/h5/TGDynamic/ProxyHomePage.aspx'),
287                         imgUrl: URL+'/Skins/paperyy.jpg',
288                         type: 'link',
289                         dataUrl:'',
290                         success: function () {
291                             layer.alert('QQ空间分享成功');
292                         },
293                         cancel: function () {
294                             layer.alert('QQ空间分享失败');
295                         }
296                     });                       
297                 });
298             }
299         </script>
300         
301 
302 
303 
304     <script type="text/javascript">
305         
306         var clipboard = new ClipboardJS('.btn');
307         clipboard.on('success', function(e) {
308             console.log(e);
309         });
310 
311         clipboard.on('error', function(e) {
312             console.log(e);
313         });
314     </script>
315 
316 
317   
318 
319 </body>
320 
321 </html>
原文地址:https://www.cnblogs.com/xiaz/p/10144827.html