作者 王晓刚
1 个管道 的构建 通过 耗费 35 秒

分享bug

... ... @@ -9,6 +9,7 @@
namespace app\portal\controller;
use cmf\controller\WeChatBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;
class IndexController extends WeChatBaseController
... ... @@ -204,6 +205,25 @@ class IndexController extends WeChatBaseController
}else{
$data_goods_recommend_new = null;
}
//分享
$options=config('wechat_config');
$app = new Application($options);
$js = $app->js;
$jssdk=$js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline'), false,false,true);
$this->assign('jssdk',$jssdk);
$arr = [];
if($data_my_user['status'] == 3){
$arr['status_id'] = 2;
$arr['my_user_id'] = $data_my_user['id'];
}else if($data_my_user['status'] = 4) {
$arr['status'] = 3;
$arr['my_user_id'] = $data_my_user['id'];
}else{
$arr['status'] = '';
$arr['my_user_id'] = '';
}
$url = cmf_url('portal/index',$arr,false,true);
$this->assign('url',$url);
$this -> assign('data_goods_recommend_new',$data_goods_recommend_new);
$this -> assign('data_goods_hot',$data_goods_hot);
return $this -> fetch();
... ... @@ -354,7 +374,6 @@ class IndexController extends WeChatBaseController
}
}
return json_encode($data_salesman_goods);
}
/**
... ...
... ... @@ -210,6 +210,44 @@
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/swiper.min.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
wx.config({$jssdk});
wx.ready(function () {
wx.onMenuShareAppMessage({
title: '学考无忧',
desc: "{$data.book_name}",
link: '{$url}',
imgUrl: "{:cmf_url('','',false,true)}/logo.jpg", // 分享图标
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: "学考无忧",
link: '{$url}',
imgUrl: "{:cmf_url('','',false,true)}/logo.jpg", // 分享图标
type: 'link', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function (res) {
alert('分享成功');
//分享成功返回信息
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
});
</script>
<script>
/**
*点击搜索
... ... @@ -228,6 +266,9 @@
autoplayDisableOnInteraction: false
});
</script>
<script>
</script>
</body>
</html>
\ No newline at end of file
... ...