正在显示
6 个修改的文件
包含
62 行增加
和
49 行删除
@@ -541,8 +541,7 @@ class LoginController extends HomeBaseController | @@ -541,8 +541,7 @@ class LoginController extends HomeBaseController | ||
541 | "signature" => $signature, | 541 | "signature" => $signature, |
542 | "rawString" => $string | 542 | "rawString" => $string |
543 | ]; | 543 | ]; |
544 | - $this->assign('data',$data); | ||
545 | - return $this->fetch(); | 544 | + $this->apiResponse(1, '分享成功!',$data); |
546 | } | 545 | } |
547 | 546 | ||
548 | //获取微信分享签名随机字符串 | 547 | //获取微信分享签名随机字符串 |
@@ -11,47 +11,4 @@ | @@ -11,47 +11,4 @@ | ||
11 | <h1>分享主题</h1> | 11 | <h1>分享主题</h1> |
12 | </body> | 12 | </body> |
13 | </html> | 13 | </html> |
14 | -<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script> | ||
15 | -<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> | ||
16 | -<script> | ||
17 | - $(function () { | ||
18 | - wx.config({ | ||
19 | - debug: true, | ||
20 | - appId: '{$data.appId}', | ||
21 | - timestamp: '{$data.timestamp}', | ||
22 | - nonceStr: '{$data.nonceStr}', | ||
23 | - signature: '{$data.signature}', | ||
24 | - jsApiList: [ | ||
25 | - 'updateAppMessageShareData', | ||
26 | - 'updateTimelineShareData', | ||
27 | - ] | ||
28 | - }); | ||
29 | - wx.ready(function () { //需在用户可能点击分享按钮前就先调用 | ||
30 | - wx.updateAppMessageShareData({ | ||
31 | - title: '分享标题', // 分享标题 | ||
32 | - desc: '分享描述', // 分享描述 | ||
33 | - link: 'http://www.starplanet.cn/portal/enjoy/getEnjoyDetail?id=81', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 | ||
34 | - imgUrl: '', // 分享图标 | ||
35 | - success: function (e) { | ||
36 | - // 设置成功 | ||
37 | - alert('分享朋友'); | ||
38 | - } | ||
39 | - }); | ||
40 | - wx.updateTimelineShareData({ | ||
41 | - title: '分享朋友圈', // 分享标题 | ||
42 | - link: 'http://www.starplanet.cn/portal/enjoy/getEnjoyDetail?id=81', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 | ||
43 | - imgUrl: '', // 分享图标 | ||
44 | - success: function () { | ||
45 | - // 设置成功 | ||
46 | - alert('分享朋友圈 '); | ||
47 | - } | ||
48 | - }); | ||
49 | - }); | ||
50 | - wx.error(function (res) { | ||
51 | - // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 | ||
52 | - alert(res); | ||
53 | - }); | ||
54 | 14 | ||
55 | - }); | ||
56 | - | ||
57 | -</script> |
@@ -135,7 +135,7 @@ | @@ -135,7 +135,7 @@ | ||
135 | <div class="index_seventh_bottom_five"> | 135 | <div class="index_seventh_bottom_five"> |
136 | <div class="index_seventh_bottom_title">分享:</div> | 136 | <div class="index_seventh_bottom_title">分享:</div> |
137 | <div class="index_seventh_bottom_img1"> | 137 | <div class="index_seventh_bottom_img1"> |
138 | - <img src="__TMPL__/public/assets/images/cicon_71@2x.png" alt="" /> | 138 | + <img src="__TMPL__/public/assets/images/cicon_71@2x.png" alt="" id="wx_share_video"/> |
139 | </div> | 139 | </div> |
140 | <div class="index_seventh_bottom_img1"> | 140 | <div class="index_seventh_bottom_img1"> |
141 | <img src="__TMPL__/public/assets/images/cicon_72@2x.png" alt="" class="wb_share_video"/> | 141 | <img src="__TMPL__/public/assets/images/cicon_72@2x.png" alt="" class="wb_share_video"/> |
@@ -151,7 +151,8 @@ | @@ -151,7 +151,8 @@ | ||
151 | <input type="hidden" class="like" value=""> | 151 | <input type="hidden" class="like" value=""> |
152 | </div> | 152 | </div> |
153 | </div> | 153 | </div> |
154 | - | 154 | + <!--微信分享--> |
155 | + <include file="public@share" /> | ||
155 | <include file="public@footer" /> | 156 | <include file="public@footer" /> |
156 | </body> | 157 | </body> |
157 | <script src="__TMPL__/public/assets/js/base.js"></script> | 158 | <script src="__TMPL__/public/assets/js/base.js"></script> |
@@ -273,7 +273,9 @@ $(function() { | @@ -273,7 +273,9 @@ $(function() { | ||
273 | }); | 273 | }); |
274 | 274 | ||
275 | //微信分享 | 275 | //微信分享 |
276 | - | 276 | + $('#wx_share,#wx_share_video').click(function(){ |
277 | + mask('打开微信,点击右上角即可分享网页'); | ||
278 | + }); | ||
277 | }); | 279 | }); |
278 | //第三方分享 | 280 | //第三方分享 |
279 | function thirdShare(url){ | 281 | function thirdShare(url){ |
@@ -306,7 +308,7 @@ function mask(msg) { | @@ -306,7 +308,7 @@ function mask(msg) { | ||
306 | setTimeout(function() { | 308 | setTimeout(function() { |
307 | $('.mask').hide(); | 309 | $('.mask').hide(); |
308 | $('.mask').text(''); | 310 | $('.mask').text(''); |
309 | - }, 4000); | 311 | + }, 6000); |
310 | } | 312 | } |
311 | 313 | ||
312 | //弹框 | 314 | //弹框 |
1 | +<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script> | ||
2 | +<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> | ||
3 | +<script> | ||
4 | + $(function () { | ||
5 | + var url = window.location.href; | ||
6 | + var title_title = $(document).attr('title'); | ||
7 | + $.ajax({ | ||
8 | + type: 'POST', | ||
9 | + url: "/portal/login/wxShare", | ||
10 | + data: { | ||
11 | + }, | ||
12 | + dataType: 'json', | ||
13 | + success: function(data) { | ||
14 | + wx.config({ | ||
15 | + debug: true, | ||
16 | + appId: data.appId, | ||
17 | + timestamp: data.timestamp, | ||
18 | + nonceStr: data.nonceStr, | ||
19 | + signature: data.signature, | ||
20 | + jsApiList: [ | ||
21 | + 'updateAppMessageShareData', | ||
22 | + 'updateTimelineShareData', | ||
23 | + ] | ||
24 | + }); | ||
25 | + wx.ready(function () { //需在用户可能点击分享按钮前就先调用 | ||
26 | + wx.updateAppMessageShareData({ | ||
27 | + title: title_title, // 分享标题 | ||
28 | + desc: '', // 分享描述 | ||
29 | + link: url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 | ||
30 | + imgUrl: '', // 分享图标 | ||
31 | + success: function (e) { | ||
32 | + // 设置成功 | ||
33 | + } | ||
34 | + }); | ||
35 | + wx.updateTimelineShareData({ | ||
36 | + title: title_title, // 分享标题 | ||
37 | + link: url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 | ||
38 | + imgUrl: '', // 分享图标 | ||
39 | + success: function () { | ||
40 | + // 设置成功 | ||
41 | + } | ||
42 | + }); | ||
43 | + }); | ||
44 | + wx.error(function (res) { | ||
45 | + // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 | ||
46 | + }); | ||
47 | + } | ||
48 | + }); | ||
49 | + | ||
50 | + }); | ||
51 | + | ||
52 | +</script> |
-
请 注册 或 登录 后发表评论