From 6a4415a9272f5bffded98005ee9cd18394c46fc3 Mon Sep 17 00:00:00 2001
From: anyv <anyu@bronet.cn>
Date: Wed, 19 Jun 2019 15:04:01 +0800
Subject: [PATCH] 1

---
 app/portal/controller/GoodsdetailsController.php                 | 10 ++++++++++
 public/themes/simpleboot3/portal/goodsdetails/goods_details.html | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/app/portal/controller/GoodsdetailsController.php b/app/portal/controller/GoodsdetailsController.php
index 678f21a..0c862af 100644
--- a/app/portal/controller/GoodsdetailsController.php
+++ b/app/portal/controller/GoodsdetailsController.php
@@ -9,6 +9,7 @@
 namespace app\portal\controller;
 
 use cmf\controller\WeChatBaseController;
+use EasyWeChat\Foundation\Application;
 use think\Db;
 
 class GoodsdetailsController extends WeChatBaseController{
@@ -60,6 +61,15 @@ class GoodsdetailsController extends WeChatBaseController{
         }
         return $this -> fetch();
 
+        //商品详情分享
+        $options=config('wechat_config');
+        $app = new Application($options);
+        $js = $app->js;
+        $jssdk=$js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline','onMenuShareQQ'), false,false,true);
+        $this->assign('jssdk',$jssdk);
+        $url = "http://xkeasy.w.bronet.cn/portal/goodsdetails/goods_details/goods_id/".$goods_id['goods_id'];
+        $this -> assign('url',$url);
+
     }
 
     /**
diff --git a/public/themes/simpleboot3/portal/goodsdetails/goods_details.html b/public/themes/simpleboot3/portal/goodsdetails/goods_details.html
index e8f43ef..ba2148d 100755
--- a/public/themes/simpleboot3/portal/goodsdetails/goods_details.html
+++ b/public/themes/simpleboot3/portal/goodsdetails/goods_details.html
@@ -154,6 +154,45 @@
 </div>
 <script src="__TMPL__/public/assets/js/base.js"></script>
 <script src="__TMPL__/public/assets/js/jquery.js"></script>
+<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
+<script>
+    wx.config({$jssdk});
+    wx.ready(function () {
+        wx.onMenuShareAppMessage({
+            title: '学考无忧',
+            desc: "{$vo.book_name}",
+            link: '{$url}',
+            imgUrl: "{:cmf_get_image_url($data.show_img)}", // 分享图标
+            type: 'link', // 分享类型,music、video或link,不填默认为link
+            dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+            success: function (res) {
+
+                alert('分享成功');
+
+                //分享成功返回信息
+            },
+            fail: function (res) {
+                alert(JSON.stringify(res));
+            }
+        });
+        wx.onMenuShareTimeline({
+            title: '学考无忧',
+            desc: "{$vo.book_name}",
+            link: '{$url}',
+            imgUrl: "{:cmf_get_image_url($data.show_img)}", // 分享图标
+            type: 'link', // 分享类型,music、video或link,不填默认为link
+            dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+            success: function (res) {
+
+                alert('分享成功');
+                //分享成功返回信息
+            },
+            fail: function (res) {
+                alert(JSON.stringify(res));
+            }
+        });
+    });
+</script>
 <script>
     /**
      * 点击跳转购物车页面
--
libgit2 0.24.0