作者 anyv
1 个管道 的构建 通过 耗费 2 秒

1

... ... @@ -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);
}
/**
... ...
... ... @@ -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>
/**
* 点击跳转购物车页面
... ...