Commit 7e0c96717c0bfd1893306bc4ea4a91db5bc71b21

Authored by 后端研发-倪永富
1 parent 0d6892b0

1增加小程序直播列表页和详情页分享至朋友圈;

2.直播详情页生成海报,除点击保存图片至相册外,点击其他地方关闭海报;
packageA/pages/liveStream/liveStream.js
... ... @@ -133,6 +133,24 @@ Page({
133 133 * 用户点击右上角分享
134 134 */
135 135 onShareAppMessage: function () {
  136 + if (res.from === 'button') {
  137 + // 来自页面内转发按钮
  138 + console.log(res.target)
  139 + }
  140 + return {
  141 + title: '直播列表'
  142 + // path: '/page/user?id=123'
  143 + }
  144 + },
136 145  
  146 + onShareTimeline: function (res) {
  147 + if (res.from === 'button') {
  148 + // 来自页面内转发按钮
  149 + console.log(res.target)
  150 + }
  151 + return {
  152 + title: '直播列表'
  153 + // path: '/page/user?id=123'
  154 + }
137 155 }
138 156 })
139 157 \ No newline at end of file
... ...
packageA/pages/liveStreamDetails/liveStreamDetails.js
... ... @@ -63,6 +63,17 @@ Page({
63 63 this.setData({
64 64 showActionSheet: 'false'
65 65 })
  66 + if(!this.data.showPlaybill) {
  67 + this.setData({
  68 + showPlaybill: 'true'
  69 + });
  70 + }
  71 + },
  72 +
  73 + closeWin: function () {
  74 + this.setData({
  75 + showPlaybill: 'true'
  76 + });
66 77 },
67 78  
68 79 //生成海报
... ... @@ -550,7 +561,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un
550 561 console.log(res.target)
551 562 }
552 563 return {
553   - title: '自定义转发标题',
  564 + title: this.data.details.name
554 565 // path: '/page/user?id=123'
555 566 }
556 567 }
... ...
packageA/pages/liveStreamDetails/liveStreamDetails.wxml
... ... @@ -74,7 +74,7 @@
74 74  
75 75 <!-- 生成海报 -->
76 76 <view class="{{showPlaybill ? 'playbill':'playbill active'}}" hidden="{{showPlaybill}}">
77   - <image src="{{canvasToImgPath}}" class="playbill-pic" mode="widthFix"></image>
  77 + <image src="{{canvasToImgPath}}" class="playbill-pic" mode="widthFix" bindtap="closeWin"></image>
78 78 <canvas canvas-id="myCanvas" catchtouchmove="true" style="width:480px;height:738px;position:absolute;left:5000%;"></canvas>
79 79 <!-- style="width:{{windowWidth}}px;height:{{windowHeight}}px;" -->
80 80 <view class="playbill-save" bindtap="onSaveToPhone">保存至相册</view>
... ...